Change url for booking summary page

Add state analytics
This commit is contained in:
2013-09-30 12:13:24 +10:00
parent 1598a272c4
commit 264dcbc475
2 changed files with 21 additions and 15 deletions

View File

@@ -4,7 +4,7 @@
/**
* List people and how much they have paid
*/
function booking_report_payments() {
function booking_report_summary() {
global $event;
$text = "";
$output = "";
@@ -14,12 +14,31 @@ function booking_report_payments() {
$total_paid = 0;
$header = array('Id', 'Name', 'Email', 'Payment To Date', 'Total Payment Required');
$rows = array();
$result = db_query("SELECT * FROM {booking_person} p WHERE p.booking_event_id = :eid",
array(':eid' => $event->eid));
//do some analysis about the people booked in
//first the summary of states
$state_header = array('State', 'Count');
$state_rows = array();
$state_stats = db_select('booking_person', 'p')
->fields('p', array('booking_state'))
->condition('p.booking_event_id', $event->eid, '=')
->addExpression('COUNT(booking_state)', 'state_count')
->execute();
foreach ($state_stats as $state) {
$state_rows[] = array($state->booking_state, $state->state_count);
}
$output .= t("<p>Bookings by state</p>");
$output .= theme('table', array('header' => $state_header, 'rows' => $state_rows));
$output .= t("<p>The following table presents a summary of payments that have been made for !event.</p>", array('!event' => $event->booking_eventname));
foreach ($result as $person) {
$rows[] = array(
l(t('!id', array('!id' => $person->nid)), t('node/!id', array('!id' => $person->nid))),
@@ -38,20 +57,7 @@ function booking_report_payments() {
$waiting_counter++;
}
/*
return array(
'first_para' => array(
'#type' => 'markup',
'#markup' => t("<p>The following table presents a summary"),
),
'table' => theme('table', array(
'header' => $header,
'rows' => $rows,
)),
);*/
$output .= t("<p>The following table presents a summary of payments that have been made for !event.</p>", array('!event' => $event->booking_eventname));
$output .= theme('table', array('header' => $header, 'rows' => $rows));
$output .= t("<p>Total of !bookedin registrations currently booked in, !waiting on waiting list, and !notpaid haven't paid.</p>",
array('!bookedin' => $bookedin_counter, '!waiting' => $waiting_counter, '!notpaid' => $notpaid_counter));