git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@71 97e9348a-65ac-dc4b-aefc-98561f571b83
99 lines
2.6 KiB
PHP
99 lines
2.6 KiB
PHP
<?php /* -*- mode:PHP -*- */ ?>
|
|
|
|
<div class="ledger view">
|
|
|
|
<?php
|
|
; // Editor alignment
|
|
|
|
function currency($number) {
|
|
if (!isset($number))
|
|
return null;
|
|
|
|
if ($number < 0)
|
|
return "($ " . number_format(-1*$number, 2) . ")";
|
|
else
|
|
return "$ " . number_format($number, 2);
|
|
}
|
|
|
|
function datefmt($date) {
|
|
$date_fmt = 'm/d/Y';
|
|
return ($date
|
|
? date_format(date_create($date), $date_fmt)
|
|
: null);
|
|
}
|
|
|
|
function comment($comment) {
|
|
if (isset($comment) && is_array($comment)) {
|
|
foreach (array_keys($comment) AS $k) {
|
|
if (!$comment[$k])
|
|
unset($comment[$k]);
|
|
}
|
|
return implode('; ', $comment);
|
|
}
|
|
|
|
return $comment;
|
|
}
|
|
|
|
|
|
/**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
* Ledger Detail Main Section
|
|
*/
|
|
|
|
$rows = array(array('ID', $ledger['Ledger']['id']),
|
|
array('Name', $ledger['Ledger']['name']),
|
|
array('Account', $html->link($ledger['Account']['name'],
|
|
array('controller' => 'accounts',
|
|
'action' => 'view',
|
|
$ledger['Account']['id']))),
|
|
array('Closed', $ledger['Ledger']['closed']),
|
|
array('Comment', $ledger['Ledger']['comment']));
|
|
|
|
echo $this->element('table',
|
|
array('class' => 'item ledger detail',
|
|
'caption' => 'Ledger Detail',
|
|
'rows' => $rows,
|
|
'column_class' => array('field', 'value')));
|
|
|
|
|
|
/**********************************************************************
|
|
* Ledger Info Box
|
|
*/
|
|
|
|
?>
|
|
|
|
<DIV CLASS="infobox">
|
|
<DIV CLASS="summary balance">
|
|
Ledger Balance: <?php echo currency($balance); ?>
|
|
</DIV>
|
|
</DIV>
|
|
|
|
<DIV CLASS="detail supporting">
|
|
<?php
|
|
; // Editor alignment
|
|
|
|
/**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
**********************************************************************
|
|
* Supporting Elements Section
|
|
*/
|
|
|
|
|
|
/**********************************************************************
|
|
* Ledger
|
|
*/
|
|
|
|
echo $this->element('ledger',
|
|
array('caption' => $ledger['Ledger']['name'],
|
|
'ledger' => array('id' => $ledger['Ledger']['id'],
|
|
'type' => $ledger['Account']['type']),
|
|
'entries' => $ledger['LedgerEntry']));
|
|
|
|
/* End "detail supporting" DIV */ ?>
|
|
</DIV>
|
|
|
|
</div>
|