Fixed negative numbers

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@564 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-15 01:22:16 +00:00
parent d40f43c617
commit e9d92494c6

View File

@@ -31,12 +31,15 @@ class FormatHelper extends AppHelper {
// where this result is placed into a form for input. 50 cents
// will end up as 50 dollars upon submission :-(
$currency = self::$number->format
($amount,
(abs($amount),
array('places' => 2,
'before' => $spans ? '' : (isset($dollar_sign) ? $dollar_sign : '$'),
'after' => $spans ? '' : null,
));
if ($amount < 0)
$currency = '(' . $currency . ')';
if ($spans)
return ('<SPAN CLASS="dollar-sign">$</SPAN>' .
'<SPAN CLASS="dollar-amount">' . $currency . '</SPAN>');