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

@@ -3,21 +3,7 @@
<div class="transaction view">
<?php
function currency($number) {
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);
}
; // Editor alignment
/**********************************************************************
**********************************************************************
@@ -44,10 +30,10 @@ echo $this->element('table',
?>
<DIV CLASS="infobox">
<DIV CLASS="summary grand debit">
Debits: <?php echo currency($debitAmount); ?>
Debits: <?php echo FormatHelper::currency($debitAmount); ?>
</DIV>
<DIV CLASS="summary grand credit">
Credits: <?php echo currency($creditAmount); ?>
Credits: <?php echo FormatHelper::currency($creditAmount); ?>
</DIV>
</DIV>
@@ -83,8 +69,8 @@ foreach($transaction['LedgerEntry'] AS $entry) {
'action' => 'view',
$entry['CreditLedger']['id'])),
$entry['comment'],
currency($entry['amount']),
currency($running_total)
FormatHelper::currency($entry['amount']),
FormatHelper::currency($running_total)
);
}