[guadec-web] Add footer for accommodation report



commit be70621bc6fd956b771ed10c102acdfdf4a96b0a
Author: Alexandre Franke <alexandre franke gmail com>
Date:   Tue Jul 22 19:45:19 2014 +0200

    Add footer for accommodation report

 guadec/access-register.php |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/guadec/access-register.php b/guadec/access-register.php
index 84c6556..fd2b3d0 100644
--- a/guadec/access-register.php
+++ b/guadec/access-register.php
@@ -135,6 +135,10 @@ function display_totals($result){
 }
 
 function display_accommodation($result){
+       $total_single = 0;
+       $total_double = 0;
+       $total_accomfee = 0;
+
        echo "<div>";
        echo "<table class='regtable'><thead><tr><th>ID</th><th>Name</th>
                                <th>Email</th><th>Gender</th>
@@ -153,11 +157,19 @@ function display_accommodation($result){
                echo "<td>"; echo $results['arrive']; echo "</td>";
                echo "<td>"; echo $results['depart']; echo "</td>";
                echo "<td>"; echo $results['room']; echo "</td>";
+                       if ($results['room'] == 'single') { $total_single += 1;}
+                       else if ($results['room'] == 'double') { $total_double += 1;}
                echo "<td>"; echo $results['accomfee']; echo "</td>";
+                       $total_accomfee += $results['accomfee'];
                echo "<td>"; echo $results['payment']; echo "</td>";
                echo "</tr>";
        }
        echo"</tbody>";
+       echo "<tfoot><tr><td>Total</td><td colspan='2'>"; echo count($result); echo " booked beds</td>
+                               <td></td><td></td><td></td>
+                               <td>"; echo $total_single; echo " single, "; echo $total_double; echo " 
double</td>
+                               <td>Total: "; echo $total_accomfee; echo "</td>
+                               <td></td></tr></tfoot>";
        echo "</table></div>";
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]