diff --git a/booking.reports.inc b/booking.reports.inc index ffb37b2..a83445f 100644 --- a/booking.reports.inc +++ b/booking.reports.inc @@ -11,6 +11,10 @@ function booking_report_summary() { $bookedin_counter = 0; $notpaid_counter = 0; $waiting_counter = 0; + $male_count = 0; + $female_count = 0; + $baptised_count = 0; + $married_count = 0; $total_paid = 0; $stats_attributes = array('style' => 'max-width:30%'); @@ -41,7 +45,25 @@ function booking_report_summary() { //non australian states $state_rows[] = array('International',$non_australia_count); - + //general stats + $query = db_select('booking_person', 'p') + ->fields('p', array('booking_baptised', 'booking_married', 'booking_gender')) + ->condition('p.booking_event_id', $event->eid, '='); + $general_stats = $query->execute(); + + foreach ($general_stats as $person) + { + if ($person->booking_gender == 'M') + $male_count++; + else + $female_count++; + + if ($person->booking_baptised == 'Y') + $baptised_count++; + + if ($person->booking_married == 'Y') + $married_count++; + } //bookings by ecclesia $ecclesia_heaeder = array('State','Ecclesia', 'Count'); @@ -79,6 +101,8 @@ function booking_report_summary() { } //output everything + $output .= t("

There are !boys males and !girls females registered. Of these, !baptised are baptised and !married are married.

", + array('!boys' => $male_count, '!girls' => $female_count, '!baptised' => $baptised_count, '!married' => $married_count)); $output .= t("

Bookings by state

"); $output .= theme('table', array('header' => $state_header, 'rows' => $state_rows, 'attributes' => $stats_attributes)); $output .= t("

Bookings by ecclesia

");