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/site@77 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-08 03:32:07 +00:00
parent e740cc859b
commit f08884f326
16 changed files with 178 additions and 349 deletions

View File

@@ -5,36 +5,6 @@
<?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;
}
/**********************************************************************
**********************************************************************
**********************************************************************
@@ -48,7 +18,7 @@ $rows = array(array('ID', $ledger['Ledger']['id']),
array('controller' => 'accounts',
'action' => 'view',
$ledger['Account']['id']))),
array('Closed', $ledger['Ledger']['closed']),
array('Status', $ledger['Ledger']['closed'] ? 'Closed' : 'Open'),
array('Comment', $ledger['Ledger']['comment']));
echo $this->element('table',
@@ -66,7 +36,7 @@ echo $this->element('table',
<DIV CLASS="infobox">
<DIV CLASS="summary balance">
Ledger Balance: <?php echo currency($balance); ?>
Ledger Balance: <?php echo FormatHelper::currency($balance); ?>
</DIV>
</DIV>