Files
pmgr/site/views/double_entries/view.ctp
abijah a3b376544c Replaced the hardcoded 'level' checks, and incorporated (as a first pass) the new permission mechanism
git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@802 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-08-28 07:11:14 +00:00

99 lines
3.6 KiB
PHP

<?php /* -*- mode:PHP -*- */
echo '<div class="double-entry view">' . "\n";
// The two entries, debit and credit, are actually individual
// entries in separate accounts (each make up one of the two
// entries required for "double entry").
/**********************************************************************
**********************************************************************
**********************************************************************
**********************************************************************
* DoubleEntry Detail Main Section
*/
$transaction = $entry['Transaction'];
$ledgers = array('debit' => $entry['DebitLedger'],
'credit' => $entry['CreditLedger']);
$entries = array('debit' => $entry['DebitEntry'],
'credit' => $entry['CreditEntry']);
$entry = $entry['DoubleEntry'];
$rows = array();
$rows[] = array('Transaction', $html->link('#'.$transaction['id'],
array('controller' => 'transactions',
'action' => 'view',
$transaction['id'])));
$rows[] = array('Timestamp', FormatHelper::datetime($transaction['stamp']));
$rows[] = array('Comment', $entry['comment']);
echo $this->element('table',
array('class' => 'item double-entry detail',
'caption' => 'Double Ledger Entry',
'rows' => $rows,
'column_class' => array('field', 'value')));
/**********************************************************************
* Debit/Credit Entries
*/
echo ('<DIV CLASS="ledger-double-entry">' . "\n");
foreach ($ledgers AS $type => $ledger) {
$rows = array();
// REVISIT <AP>: 20090816
// Due to low priority, the ledger_entry/double_entry stuff
// is a bit piecemeal at the moment (trying to reuse old
// code as much as possible). So, LedgerEntry view is just
// redirecting here. Of course, presenting a link for the
// LedgerEntry then is, well, quite pointless.
$rows[] = array('ID', '#' . $entries[$type]['id']);
/* $rows[] = array('ID', $html->link('#' . $entries[$type]['id'], */
/* array('controller' => 'entries', */
/* 'action' => 'view', */
/* $entries[$type]['id']))); */
$rows[] = array('Account', ($ledger['link']
? $html->link($ledger['Account']['name'],
array('controller' => 'accounts',
'action' => 'view',
$ledger['Account']['id']))
: $ledger['Account']['name']));
$rows[] = array('Ledger', ($ledger['link']
? $html->link('#' . $ledger['sequence'],
array('controller' => 'ledgers',
'action' => 'view',
$ledger['id']))
: '#' . $ledger['sequence']));
$rows[] = array('Amount', FormatHelper::currency($entries[$type]['amount']));
//$rows[] = array('Effect', $ledger['Account']['ftype'] == $type ? 'INCREASE' : 'DECREASE');
echo $this->element('table',
array('class' => array('item', $type, 'detail'),
'caption' => ucfirst($type) . ' Entry',
'rows' => $rows,
'column_class' => array('field', 'value')));
}
echo ('</DIV>' . "\n");
/**********************************************************************
**********************************************************************
**********************************************************************
**********************************************************************
* Supporting Elements Section
*/
echo '<div CLASS="detail supporting">' . "\n";
/* End "detail supporting" div */
echo '</div>' . "\n";
/* End page div */
echo '</div>' . "\n";