Files
pmgr/site/views/transactions/view.ctp
abijah 374843aeee Finally added a format helper, which has been long intended. There may be still be conversion issues, it hasn't been tested much.
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605@77 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-06-08 03:32:07 +00:00

89 lines
2.6 KiB
PHP

<?php /* -*- mode:PHP -*- */ ?>
<div class="transaction view">
<?php
; // Editor alignment
/**********************************************************************
**********************************************************************
**********************************************************************
**********************************************************************
* Transaction Detail Main Section
*/
$rows = array(array('ID', $transaction['Transaction']['id']),
array('Timestamp', datefmt($transaction['Transaction']['stamp'])),
array('Comment', $transaction['Transaction']['comment']));
echo $this->element('table',
array('class' => 'item transaction detail',
'caption' => 'Transaction Info',
'rows' => $rows,
'column_class' => array('field', 'value')));
/**********************************************************************
* Transaction Info Box
*/
?>
<DIV CLASS="infobox">
<DIV CLASS="summary grand debit">
Debits: <?php echo FormatHelper::currency($debitAmount); ?>
</DIV>
<DIV CLASS="summary grand credit">
Credits: <?php echo FormatHelper::currency($creditAmount); ?>
</DIV>
</DIV>
<DIV CLASS="detail supporting">
<?php
; // Editor alignment
/**********************************************************************
**********************************************************************
**********************************************************************
**********************************************************************
* Supporting Elements Section
*/
/**********************************************************************
* Entries
*/
$headers = array('Name', 'Debit', 'Credit', 'Comment', 'Amount', 'Total');
$rows = array();
$running_total = 0;
foreach($transaction['LedgerEntry'] AS $entry) {
$amount = $entry['amount'];
$running_total += $amount;
$rows[] = array($entry['name'],
$html->link($entry['DebitLedger']['name'],
array('controller' => 'ledgers',
'action' => 'view',
$entry['DebitLedger']['id'])),
$html->link($entry['CreditLedger']['name'],
array('controller' => 'ledgers',
'action' => 'view',
$entry['CreditLedger']['id'])),
$entry['comment'],
FormatHelper::currency($entry['amount']),
FormatHelper::currency($running_total)
);
}
echo $this->element('table',
array('class' => 'item entry list',
'caption' => 'Entries in Transaction',
'headers' => $headers,
'rows' => $rows,
'column_class' => $headers));
/* End "detail supporting" DIV */ ?>
</DIV>
</div>