Fixed the total amount collected to reflect the _actual_ total, not just the page total. Now the grid no longer needs to be 500 rows long.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@340 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-15 07:47:13 +00:00
parent 8f2b43239d
commit e8d12882cc
2 changed files with 9 additions and 9 deletions

View File

@@ -325,16 +325,16 @@ class LedgerEntriesController extends AppController {
return $order;
}
function jqGridDataOutputRecords(&$params, &$model, &$records) {
function jqGridDataRecords(&$params, &$model, $query) {
if ($params['action'] === 'collected') {
$total = 0;
foreach ($records AS &$record)
$total += $record['LedgerEntry']['applied'];
echo ' <userdata name="total">' . $total . '</userdata>' . "\n";
$tquery = array_diff_key($query, array('fields'=>1,'group'=>1,'limit'=>1,'order'=>1));
$tquery['fields'] = array('SUM(Reconciliation.amount) AS applied');
$total = $model->find('first', $tquery);
$params['userdata']['total'] = $total[0]['applied'];
}
parent::jqGridDataOutputRecords($params, $model, $records);
return parent::jqGridDataRecords($params, $model, $query);
}

View File

@@ -86,7 +86,7 @@ if (!isset($reconcile_id) && !isset($collected_account_id))
else
$cols['Sub-Total']['index'] = 'subtotal-applied';
if (isset($account_ftype))
if (isset($account_ftype) || isset($collected_account_id))
$grid->invalidFields('Sub-Total');
@@ -108,7 +108,7 @@ if (isset($reconcile_id)) {
if (isset($collected_account_id)) {
$config['action'] = 'collected';
$grid->customData(compact('collected_account_id'))->limit(500);
$grid->customData(compact('collected_account_id'))->limit(50);
$grid->sortField('Last Payment');
}