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@93 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-10 21:14:26 +00:00
parent 8ab8d087e6
commit 99263920a3

View File

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