More tweaking with grids that need to be reloaded immediately after page load. Fixed a bug with the statement_entry balance field, as there were two of them.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@534 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-11 15:56:40 +00:00
parent b6ee958c35
commit fc4e812d67
4 changed files with 16 additions and 7 deletions

View File

@@ -64,7 +64,8 @@ class StatementEntriesController extends AppController {
function gridDataTables(&$params, &$model) {
$tables = $this->gridDataCountTables($params, $model);
if (in_array('applied', $params['post']['fields'])) {
if (in_array('applied', $params['post']['fields']) ||
isset($params['post']['custom']['statement_entry_id'])) {
$tables['link']['DisbursementEntry'] = array();
$tables['link']['ChargeEntry'] = array();
}
@@ -80,11 +81,13 @@ class StatementEntriesController extends AppController {
" SUM(COALESCE(DisbursementEntry.amount,0))," .
" SUM(COALESCE(ChargeEntry.amount,0)))" .
" AS 'applied'");
}
if (in_array('unapplied', $params['post']['fields'])) {
$fields[] = ("StatementEntry.amount - (" .
"IF(StatementEntry.type = 'CHARGE'," .
" SUM(COALESCE(DisbursementEntry.amount,0))," .
" SUM(COALESCE(ChargeEntry.amount,0)))" .
") AS 'balance'");
") AS 'unapplied'");
}
$fields = array_merge($fields,