Modified Transaction view to use jqGrid for entries. Also fixed a bug in the ledger entries element, since there is no way for credit/debit to be populated without a ledger_id, it makes sense to base the column displays on the presence of ledger_id.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@167 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-18 04:07:52 +00:00
parent d5388e7767
commit d06f34de9a
2 changed files with 8 additions and 59 deletions

View File

@@ -14,13 +14,13 @@ else {
}
$cols['Source'] = array('index' => 'MonetarySource.name', 'formatter' => 'name');
$cols['Comment'] = array('index' => 'LedgerEntry.comment', 'formatter' => 'comment', 'width'=>150);
if (isset($account_ftype)) {
$cols['Amount'] = array('index' => 'LedgerEntry.amount', 'formatter' => 'currency');
}
else {
if (isset($ledger_id)) {
$cols['Debit'] = array('index' => 'debit', 'formatter' => 'currency');
$cols['Credit'] = array('index' => 'credit', 'formatter' => 'currency');
}
else {
$cols['Amount'] = array('index' => 'LedgerEntry.amount', 'formatter' => 'currency');
}
if (isset($reconcile_id)) {
$cols['Applied'] = array('index' => "Reconciliation.amount", 'formatter' => 'currency');
}

View File

@@ -52,61 +52,10 @@ echo '<div CLASS="detail supporting">' . "\n";
* Entries
*/
$headers = array('Entry', 'Debit', 'Credit', 'Amount', 'Comment',/* 'Total'*/);
$column_class = array();
foreach (array_intersect($headers, array('Entry')) AS $k => $v) {
$column_class[$k] = 'id';
}
foreach (array_intersect($headers, array('Amount', 'Total')) AS $k => $v) {
$column_class[$k] = 'currency';
}
foreach (array_intersect($headers, array('Comment')) AS $k => $v) {
$column_class[$k] = 'slack';
}
$rows = array();
$running_total = 0;
foreach($transaction['LedgerEntry'] AS $entry) {
$amount = $entry['amount'];
$running_total += $amount;
$rows[] = array($html->link('#'.$entry['id'],
array('controller' => 'ledger_entries',
'action' => 'view',
$entry['id'])),
($html->link($entry['DebitLedger']['Account']['name'],
array('controller' => 'accounts',
'action' => 'view',
$entry['DebitLedger']['Account']['id']))
. ' ('
. $html->link('#' . $entry['DebitLedger']['Account']['id']
. '-' . $entry['DebitLedger']['sequence'],
array('controller' => 'ledgers',
'action' => 'view',
$entry['DebitLedger']['id']))
. ')'),
($html->link($entry['CreditLedger']['Account']['name'],
array('controller' => 'accounts',
'action' => 'view',
$entry['CreditLedger']['Account']['id']))
. ' ('
. $html->link('#' . $entry['CreditLedger']['Account']['id']
. '-' . $entry['CreditLedger']['sequence'],
array('controller' => 'ledgers',
'action' => 'view',
$entry['CreditLedger']['id']))
. ')'),
FormatHelper::currency($entry['amount']),
$entry['comment'],
//FormatHelper::currency($running_total),
);
}
echo $this->element('table',
array('class' => 'item entry list',
'caption' => 'Entries in Transaction',
'headers' => $headers,
'rows' => $rows,
'column_class' => $column_class));
echo $this->element('ledger_entries',
array('caption' => 'Entries in Transaction',
'ledger_entries' => $transaction['LedgerEntry'],
));
/* End "detail supporting" div */