Added initial support for ledger entry reconciliation (e.g. matching payments to charges).

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605@152 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-16 21:40:46 +00:00
parent a83edef049
commit fae90c3fa9
5 changed files with 141 additions and 22 deletions

View File

@@ -8,19 +8,38 @@ $cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' =>
$cols['Debit Account'] = array('index' => 'DebitAccount.name', 'formatter' => 'longname');
$cols['Credit Account'] = array('index' => 'CreditAccount.name', 'formatter' => 'longname');
$cols['Source'] = array('index' => 'MonetarySource.name', 'formatter' => 'name');
$cols['Comment'] = array('index' => 'LedgerEntry.comment', 'formatter' => 'comment');
$cols['Comment'] = array('index' => 'LedgerEntry.comment', 'formatter' => 'comment', 'width'=>150);
$cols['Debit'] = array('index' => 'debit', 'formatter' => 'currency');
$cols['Credit'] = array('index' => 'credit', 'formatter' => 'currency');
if (isset($reconcile))
$cols['Applied'] = array('index' => "Reconciliation.amount", 'formatter' => 'currency');
$custom_post_data = array('ledger_id' => $ledger_id,
'account_type' => $account_type);
$jqGrid_options = array('jqGridColumns' => $cols,
'grid_id' => isset($grid_id) ? $grid_id : null,
'caption' => isset($caption) ? $caption : null,
'controller' => 'ledger_entries',
'caption' => isset($caption) ? $caption : null);
);
if (isset($ledger_id)) {
$jqGrid_options += array('custom_post_data' => array('ledger_id' => $ledger_id,
'account_type' => $account_type),
if (isset($ledger_entries)) {
$jqGrid_options += array('custom_ids' =>
array_map(create_function('$data',
'return $data["id"];'),
$ledger_entries),
'limit' => 10);
}
elseif (isset($reconcile)) {
$custom_post_data += compact('reconcile', 'reconcile_id');
$jqGrid_options += array('action' => 'reconcile',
'limit' => 5);
}
else {
$jqGrid_options += array('action' => 'ledger',
'limit' => 50);
}
$jqGrid_options += compact('custom_post_data');
echo $this->element('jqGrid', $jqGrid_options);