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

@@ -229,6 +229,10 @@ function _booking_process_payment($data) {
//send an email //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 } //end spouse check
} }
else //this person still has an outstanding balance so just send a confirmation email else //this person still has an outstanding balance so just send a confirmation email

View File

@@ -21,9 +21,13 @@ function booking_report_summary() {
$male_dob_total = 0; $male_dob_total = 0;
$female_dob_total = 0; $female_dob_total = 0;
$person_count = 0; $person_count = 0;
$welfare_count = 0;
$fullypaid_count = 0;
$stats_attributes = array('style' => 'max-width:30%'); $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 //define sorting information with the header
//as per http://www.drup-all.com/blog/table-sort-pagination-drupal-7 //as per http://www.drup-all.com/blog/table-sort-pagination-drupal-7
$header = array( $header = array(
@@ -124,12 +128,29 @@ function booking_report_summary() {
); );
$total_paid += $person->booking_amount_paid; $total_paid += $person->booking_amount_paid;
//booking status
if ($person->booking_status == 0) if ($person->booking_status == 0)
$notpaid_counter++; $notpaid_counter++;
elseif ($person->booking_status == 1) elseif ($person->booking_status == 1)
$bookedin_counter++; $bookedin_counter++;
elseif ($person->booking_status == 2) 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 //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), 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) '!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)); 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("Total amount paid: $!paid</p>", array('!paid' => $total_paid));
$output .= t("<h3>Bookings by state</h3>"); $output .= t("<h3>Bookings by state</h3>");
$output .= theme('table', array('header' => $state_header, 'rows' => $state_rows, 'attributes' => $stats_attributes)); $output .= theme('table', array('header' => $state_header, 'rows' => $state_rows, 'attributes' => $stats_attributes));

View File

@@ -223,8 +223,13 @@ function shuffle_assoc($list) {
*/ */
function booking_studygroups_calculate() { function booking_studygroups_calculate() {
global $event; global $event;
//master attendee list
$attendees = array(); $attendees = array();
//temporary working copy of attendee list
$working_list = array(); $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; //delete from booking_studygroup_mapping;
//alter table booking_studygroup_mapping AUTO_INCREMENT=1; //alter table booking_studygroup_mapping AUTO_INCREMENT=1;
@@ -241,16 +246,11 @@ function booking_studygroups_calculate() {
//add an extra one to the maximum size, to cater for some larger groups when the number of people doesn't divide evenly //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; $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 //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", $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)); array(':eid' => $event->eid));
$attendees = $query->fetchAllAssoc('nid'); $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 //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_query = db_query("SELECT * FROM {booking_studygroup_mapping} WHERE booking_eventid = :eid", array(':eid' => $event->eid));
$group_mapping = $group_mapping_query->fetchAllAssoc('sid'); $group_mapping = $group_mapping_query->fetchAllAssoc('sid');
@@ -440,15 +440,6 @@ function booking_studygroups_calculate() {
if ($i > $group->booking_num_group_sessions) if ($i > $group->booking_num_group_sessions)
$i = 1; $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 //check this session has room in it
$break_condition = false; $break_condition = false;
while ($session_count[$i] >= $max_people) while ($session_count[$i] >= $max_people)