From 33ba912a7e0a04df2a43de04df1fe58c03e1fe12 Mon Sep 17 00:00:00 2001 From: abijah Date: Wed, 15 Jul 2009 05:42:10 +0000 Subject: [PATCH] Fixed the balance summary of the collected report, and marked off NSF and collected report requirements. git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@335 97e9348a-65ac-dc4b-aefc-98561f571b83 --- controllers/ledger_entries_controller.php | 14 ++-- views/accounts/collected.ctp | 89 ++++++++++++++++------- 2 files changed, 71 insertions(+), 32 deletions(-) diff --git a/controllers/ledger_entries_controller.php b/controllers/ledger_entries_controller.php index 3879f8f..92a26cb 100644 --- a/controllers/ledger_entries_controller.php +++ b/controllers/ledger_entries_controller.php @@ -325,12 +325,16 @@ class LedgerEntriesController extends AppController { return $order; } - function jqGridDataOutputRecordCell(&$params, &$model, &$record, $field, $data) { -/* if ($field === 'CreditAccount.name') { */ -/* $data .= '-OK'; */ -/* } */ + function jqGridDataOutputRecords(&$params, &$model, &$records) { - parent::jqGridDataOutputRecordCell($params, $model, $record, $field, $data); + if ($params['action'] === 'collected') { + $total = 0; + foreach ($records AS &$record) + $total += $record['LedgerEntry']['applied']; + echo ' ' . $total . '' . "\n"; + } + + parent::jqGridDataOutputRecords($params, $model, $records); } diff --git a/views/accounts/collected.ctp b/views/accounts/collected.ctp index 6e43190..1c2fd93 100644 --- a/views/accounts/collected.ctp +++ b/views/accounts/collected.ctp @@ -15,25 +15,14 @@ echo '
' . "\n"; // Reset the form function resetForm() { -/* $('#payment-entry-id').val(1); */ -/* $('#payments').html(''); */ - -/* $("#receipt-customer-id").html("INTERNAL ERROR"); */ -/* $("#receipt-customer-name").html("INTERNAL ERROR"); */ -/* $("#receipt-balance").html("INTERNAL ERROR"); */ -/* $("#receipt-charges-caption").html("Outstanding Charges"); */ - -/* datepickerBOM(null, 'TxFromDate'); */ -/* datepickerNow('TxThroughDate', false); */ - - // REVISIT : 20090714 - // Figure out how to just prevent jqGrid - // from loading in the first place - -/* $('#collected-entries-jqGrid').clearGridData(); */ /* updateEntriesGrid(); */ } +function onGridLoadComplete() { + var userdata = $('#collected-entries-jqGrid').getGridParam('userData'); + $('#collected-total').html(fmtCurrency(userdata['total'])); +} + function updateEntriesGrid() { var cust = new Array(); @@ -58,8 +47,33 @@ function updateEntriesGrid() { --> ' . "\n"; + +/********************************************************************** + ********************************************************************** + ********************************************************************** + ********************************************************************** + * Summary Info Box + */ + +echo '
' . "\n"; + +$rows = array(); +$rows[] = array('Total:', ''); +echo $this->element('table', + array('class' => 'summary', + 'rows' => $rows, + 'column_class' => array('field', 'value'), + 'suppress_alternate_rows' => true, + )); +echo '
' . "\n"; + + +/********************************************************************** + ********************************************************************** + ********************************************************************** + ********************************************************************** + * User Configuration + */ echo $form->create(null, array('id' => 'receipt-form', //'onsubmit' => 'updateEntriesGrid(); return false', @@ -101,6 +115,25 @@ echo $form->button('Update', echo $form->end(); + +/********************************************************************** + ********************************************************************** + ********************************************************************** + ********************************************************************** + * Supporting Elements Section + */ + +echo '
' . "\n"; + + +/********************************************************************** + * Entries + */ + +$grid_setup = + array('loadComplete' => + array('--special' => "function() {url=jQuery('#collected-entries-jqGrid').getGridParam('url');url=url.replace(/\/debug.*$/,'?'); pd=jQuery('#collected-entries-jqGrid').getPostData();$.each(pd,function(i){ url+=i+'='+escape(pd[i])+'&'; }); jQuery('#collected-entries-jqGrid-query').html('Grid Query
'); onGridLoadComplete();}")); + echo $this->element('ledger_entries', array (// Element configuration 'collected_account_id' => $account['id'], @@ -111,18 +144,12 @@ echo $this->element('ledger_entries', array ( 'grid_div_id' => 'collected-entries', 'grid_div_class' => 'text-below', + 'grid_setup' => $grid_setup, //'caption' => '', - 'caption' => 'Collected Charges', + 'caption' => 'Collected ' . Inflector::pluralize($account['name']) ), )); -echo('
' . - '' . - '' . - '
Balance:
' . - '
' . - "\n"); - ?> -
+' . "\n"; + +/* End page div */ +echo '
' . "\n"; + +?> Clear Debug Output