Files
pmgr/views/transactions/view.ctp
abijah 970b2ad202 Added lease and ledger_entry controllers/views. Minor bugfixes as well.
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@85 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-06-10 08:53:22 +00:00

116 lines
3.7 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', FormatHelper::datetime($transaction['Transaction']['stamp'])),
array('Through', FormatHelper::date($transaction['Transaction']['through_date'])),
array('Due', FormatHelper::date($transaction['Transaction']['due_date'])),
array('Comment', $transaction['Transaction']['comment']));
echo $this->element('table',
array('class' => 'item transaction detail',
'caption' => 'Transaction Detail',
'rows' => $rows,
'column_class' => array('field', 'value')));
/**********************************************************************
* Transaction Info Box
*/
?>
<DIV CLASS="infobox">
<DIV CLASS="summary grand total">
Total: <?php echo FormatHelper::currency($total); ?>
</DIV>
</DIV>
<DIV CLASS="detail supporting">
<?php
; // Editor alignment
/**********************************************************************
**********************************************************************
**********************************************************************
**********************************************************************
* Supporting Elements Section
*/
/**********************************************************************
* 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));
/* End "detail supporting" DIV */ ?>
</DIV>
</div>