Extra stats on booking summary page

This commit is contained in:
2014-02-07 00:56:51 +11:00
parent 5726691168
commit 9152b53390
3 changed files with 40 additions and 21 deletions

View File

@@ -21,8 +21,12 @@ function booking_report_summary() {
$male_dob_total = 0;
$female_dob_total = 0;
$person_count = 0;
$welfare_count = 0;
$fullypaid_count = 0;
$stats_attributes = array('style' => 'max-width:30%');
//TODO: add count of welfare people, and number of people fully paid
//define sorting information with the header
//as per http://www.drup-all.com/blog/table-sort-pagination-drupal-7
@@ -123,13 +127,30 @@ function booking_report_summary() {
t($person->booking_welfare_required == 'Y' ? 'Yes' : 'No'),
);
$total_paid += $person->booking_amount_paid;
//booking status
if ($person->booking_status == 0)
$notpaid_counter++;
elseif ($person->booking_status == 1)
$bookedin_counter++;
elseif ($person->booking_status == 2)
$waiting_counter++;
$waiting_counter++;
//welfare
if ($person->booking_welfare_required == 'Y')
$welfare_count++;
//fully paid?
if ($person->booking_amount_paid >= $person->booking_total_pay_reqd || $person->booking_total_pay_reqd == "0.00")
{
//watchdog('booking', "Fully paid person, ID !id (!first !last)", array('!id' => $person->nid,'!first' => ucwords($person->booking_firstname), '!last' => ucwords($person->booking_lastname)));
$fullypaid_count++;
}
elseif ($person->booking_partner_id > 0 && _booking_amount_owing($person->nid) == 0)
{
//watchdog('booking', "Fully paid married person, ID !id (!first !last)", array('!id' => $person->nid,'!first' => ucwords($person->booking_firstname), '!last' => ucwords($person->booking_lastname)));
$fullypaid_count++;
}
}
//output everything
@@ -141,8 +162,11 @@ function booking_report_summary() {
array('!average' => _booking_avg_age($dob_total, $person_count, $event->booking_event_start), '!maleaverage' => _booking_avg_age($male_dob_total, $male_count, $event->booking_event_start),
'!femaleaverage' => _booking_avg_age($female_dob_total, $female_count, $event->booking_event_start)
));
$output .= t("There are !bookedin registrations currently booked in, !waiting on waiting list, and !notpaid haven't paid, which comes to a total of !total people who have filled in the registration form.<br />",
$output .= t("There are !bookedin registrations currently booked in, !waiting on waiting list, and !notpaid haven't paid, which comes to a total of !total people who have filled in the registration form.</p>",
array('!bookedin' => $bookedin_counter, '!waiting' => $waiting_counter, '!notpaid' => $notpaid_counter, '!total' => $person_count));
$output .= t("<p>There are !welfare people with special financial consideration approved. !fullypaid people have completed their payments.<br />",
array('!welfare' => $welfare_count, '!fullypaid' => $fullypaid_count
));
$output .= t("Total amount paid: $!paid</p>", array('!paid' => $total_paid));
$output .= t("<h3>Bookings by state</h3>");
$output .= theme('table', array('header' => $state_header, 'rows' => $state_rows, 'attributes' => $stats_attributes));