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

@@ -228,7 +228,11 @@ function _booking_process_payment($data) {
->execute();
//send an email
_booking_registration_email($payment->booking_partner_id, $balance_payment);
_booking_registration_email($payment->booking_partner_id, $balance_payment);
}
elseif (variable_get('booking_enable_combined_pricing', 0) == 1)
{
watchdog('booking', 'Combined pricing is enabled, but this person has a partner id of !id.', array('!id' => $payment->booking_partner_id));
} //end spouse check
}
else //this person still has an outstanding balance so just send a confirmation email

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));

View File

@@ -223,9 +223,14 @@ function shuffle_assoc($list) {
*/
function booking_studygroups_calculate() {
global $event;
$attendees = array();
$working_list = array();
//master attendee list
$attendees = array();
//temporary working copy of attendee list
$working_list = array();
//create an array to keep track of the number of people in each session for each group
$session_count = array();
//delete from booking_studygroup_mapping;
//alter table booking_studygroup_mapping AUTO_INCREMENT=1;
@@ -240,17 +245,12 @@ function booking_studygroups_calculate() {
$limit = variable_get('booking_regn_limit','500');
//add an extra one to the maximum size, to cater for some larger groups when the number of people doesn't divide evenly
$max_people = (int) ($limit / $firstgroup->booking_num_group_sessions) + 1;
//drupal_set_message(t('Fitting !num people in each group.', array('!num' => $max_people)));
//select all the attendees booked in
$query = db_query("SELECT p.nid, p.booking_partner_id, p.booking_event_id, p.booking_status, l.booking_total_lead, l.booking_available_lead, l.booking_total_help, l.booking_available_help FROM {booking_person} p left outer join {booking_leadhelp_list} l on p.nid = l.booking_node_id WHERE p.booking_event_id = :eid AND p.booking_status = 1",
array(':eid' => $event->eid));
$attendees = $query->fetchAllAssoc('nid');
//create an array to keep track of the number of people in each session for this group
$session_count = array();
//select any entries already in the mapping table
$group_mapping_query = db_query("SELECT * FROM {booking_studygroup_mapping} WHERE booking_eventid = :eid", array(':eid' => $event->eid));
$group_mapping = $group_mapping_query->fetchAllAssoc('sid');
@@ -439,15 +439,6 @@ function booking_studygroups_calculate() {
//cycle the session counter if we already reached the end
if ($i > $group->booking_num_group_sessions)
$i = 1;
/*
//check we have attendees left
if (! $it->valid() )
{
drupal_set_message("Ran out of attendees to process.");
break;
}
*/
//check this session has room in it
$break_condition = false;