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