Code to manually update studygroup sessions

This commit is contained in:
2014-04-27 01:00:23 +10:00
parent 37f9d53dd8
commit a57a6a2242
4 changed files with 131 additions and 7 deletions

View File

@@ -24,6 +24,7 @@ function booking_report_summary() {
$person_count = 0;
$welfare_count = 0;
$fullypaid_count = 0;
$travelform_count = 0;
$stats_attributes = array('style' => 'max-width:30%');
@@ -34,6 +35,7 @@ function booking_report_summary() {
$header = array(
array('data' => t('Id'), 'field' => 'nid', 'sort' => 'asc'),
array('data' => t('Name'), 'field' => 'booking_lastname'),
array('data' => t('Edit Studygroups')),
array('data' => t('Email'), 'field' => 'booking_email'),
array('data' => t('Payment To Date'), 'field' => 'booking_amount_paid'),
array('data' => t('Total Payment Required')),
@@ -82,11 +84,13 @@ function booking_report_summary() {
//more detailed summary
//allow user-selectable sorting of columns as per http://www.drup-all.com/blog/table-sort-pagination-drupal-7
$query = db_select('booking_person', 'p')
->fields('p')
->fields('pr', array('booking_price', 'booking_late_price'))
->condition('p.booking_event_id', $event->eid, '=');
$query = db_select('booking_person', 'p');
$query->join('booking_price', 'pr', 'pr.pid = p.booking_payment_id');
$query->leftJoin('booking_travel', 't', 'p.nid = t.booking_person_nid');
$query->condition('p.booking_event_id', $event->eid, '=')
->fields('p')
->fields('t')
->fields('pr', array('booking_price', 'booking_late_price'));
$table_sort = $query->extend('TableSort')->orderbyHeader($header);
$result = $table_sort->execute();
@@ -101,6 +105,7 @@ function booking_report_summary() {
l(t('!first !last', array('!first' => ucwords($person->booking_firstname), '!last' => ucwords($person->booking_lastname))),
t('node/!id/edit', array('!id' => $person->nid))
),
l(t('Edit'), t('admin/booking/!id/edit-studygroup', array('!id' => $person->nid))),
t('!email', array('!email' => $person->booking_email)),
t('!payment', array('!payment' => $person->booking_amount_paid)),
t('!payment', array('!payment' => $amount_owing == 0 ? $person->booking_total_pay_reqd : _booking_total_due($person))),
@@ -110,6 +115,10 @@ function booking_report_summary() {
//add up the total paid
$total_paid += $person->booking_amount_paid;
//travel form completed?
if (! empty($person->tid))
$travelform_count++;
//booking status
if ($person->booking_status == 0)
$notpaid_counter++;
@@ -162,8 +171,8 @@ function booking_report_summary() {
$output .= t("There are !bookedin registrations currently booked in, !waiting on waiting list, !notpaid haven't paid, and !notcoming are no longer coming, 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,
'!notcoming' => $notcoming_counter));
$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("<p>There are !welfare people with special financial consideration approved. !fullypaid people have completed their payments and !travel people have filled in their travel form.<br />",
array('!welfare' => $welfare_count, '!fullypaid' => $fullypaid_count, '!travel' => $travelform_count,
));
$output .= t("Total amount paid: $!paid</p>", array('!paid' => $total_paid));
$output .= t("<h3>Bookings by state</h3>");