From 30f755cf4277e505988f655fbfb79e61dcc0032f Mon Sep 17 00:00:00 2001 From: abijah Date: Sat, 15 Aug 2009 01:22:16 +0000 Subject: [PATCH] Fixed negative numbers git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@564 97e9348a-65ac-dc4b-aefc-98561f571b83 --- site/views/helpers/format.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/site/views/helpers/format.php b/site/views/helpers/format.php index 4c84ce3..daa16cb 100644 --- a/site/views/helpers/format.php +++ b/site/views/helpers/format.php @@ -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 ('$' . '' . $currency . '');