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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user