Fixed to handle the possibility of a NULL monetary source, and tidied the formatting a bit.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@93 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-10 21:14:26 +00:00
parent 4a53ebd70b
commit ab766c2dc5

View File

@@ -12,37 +12,49 @@
* LedgerEntry Detail Main Section * LedgerEntry Detail Main Section
*/ */
$rows = array(array('ID', $entry['LedgerEntry']['id']), $transaction = $entry['Transaction'];
array('Transaction', $html->link('#'.$entry['Transaction']['id'], $debit_ledger = $entry['DebitLedger'];
array('controller' => 'transactions', $credit_ledger = $entry['CreditLedger'];
'action' => 'view', $source = $entry['MonetarySource'];
$entry['Transaction']['id']))), $entry = $entry['LedgerEntry'];
array('Timestamp', FormatHelper::datetime($entry['Transaction']['stamp'])),
array('Source', $entry['MonetarySource']['id']), $rows = array(array('ID', $entry['id']),
array('Amount', FormatHelper::currency($entry['LedgerEntry']['amount'])), array('Transaction', $html->link('#'.$transaction['id'],
array('Debit', ($html->link($entry['DebitLedger']['Account']['name'], array('controller' => 'transactions',
array('controller' => 'accounts', 'action' => 'view',
'action' => 'view', $transaction['id']))),
$entry['DebitLedger']['Account']['id'])) array('Timestamp', FormatHelper::datetime($transaction['stamp'])),
. ' (' array('Monetary Source', (isset($source['id'])
. $html->link('#' . $entry['DebitLedger']['Account']['id'] ? $html->link('#'.$source['id'],
. '-' . $entry['DebitLedger']['sequence'], array('controller' => 'monetary_sources',
array('controller' => 'ledgers', 'action' => 'view',
'action' => 'view', $source['id']))
$entry['DebitLedger']['id'])) : null)),
. ')')), array('Amount', FormatHelper::currency($entry['amount'])),
array('Credit', ($html->link($entry['CreditLedger']['Account']['name'], array('Debit', ($html->link($debit_ledger['Account']['name'],
array('controller' => 'accounts', array('controller' => 'accounts',
'action' => 'view', 'action' => 'view',
$entry['CreditLedger']['Account']['id'])) $debit_ledger['Account']['id']))
. ' (' . ' ('
. $html->link('#' . $entry['CreditLedger']['Account']['id'] . $html->link('#' . $debit_ledger['Account']['id']
. '-' . $entry['CreditLedger']['sequence'], . '-' . $debit_ledger['sequence'],
array('controller' => 'ledgers', array('controller' => 'ledgers',
'action' => 'view', 'action' => 'view',
$entry['CreditLedger']['id'])) $debit_ledger['id']))
. ')')), . ')')),
array('Comment', $entry['LedgerEntry']['comment'])); array('Credit', ($html->link($credit_ledger['Account']['name'],
array('controller' => 'accounts',
'action' => 'view',
$credit_ledger['Account']['id']))
. ' ('
. $html->link('#' . $credit_ledger['Account']['id']
. '-' . $credit_ledger['sequence'],
array('controller' => 'ledgers',
'action' => 'view',
$credit_ledger['id']))
. ')')),
array('Comment', $entry['comment']));
echo $this->element('table', echo $this->element('table',
array('class' => 'item ledger-entry detail', array('class' => 'item ledger-entry detail',