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; return $order;
} }
function jqGridDataOutputRecords(&$params, &$model, &$records) { function jqGridDataRecords(&$params, &$model, $query) {
if ($params['action'] === 'collected') { if ($params['action'] === 'collected') {
$total = 0; $tquery = array_diff_key($query, array('fields'=>1,'group'=>1,'limit'=>1,'order'=>1));
foreach ($records AS &$record) $tquery['fields'] = array('SUM(Reconciliation.amount) AS applied');
$total += $record['LedgerEntry']['applied']; $total = $model->find('first', $tquery);
echo ' <userdata name="total">' . $total . '</userdata>' . "\n";
$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 else
$cols['Sub-Total']['index'] = 'subtotal-applied'; $cols['Sub-Total']['index'] = 'subtotal-applied';
if (isset($account_ftype)) if (isset($account_ftype) || isset($collected_account_id))
$grid->invalidFields('Sub-Total'); $grid->invalidFields('Sub-Total');
@@ -108,7 +108,7 @@ if (isset($reconcile_id)) {
if (isset($collected_account_id)) { if (isset($collected_account_id)) {
$config['action'] = 'collected'; $config['action'] = 'collected';
$grid->customData(compact('collected_account_id'))->limit(500); $grid->customData(compact('collected_account_id'))->limit(50);
$grid->sortField('Last Payment'); $grid->sortField('Last Payment');
} }