X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FMisc.pm;h=e1f654c346712aa30b24666701c81ed0220c4a1e;hb=292ef074d01bb925e9a466ed771bf2ac418bb44f;hp=9aeff93a683d66173d841057ccc16881ad9a51f7;hpb=1c9056a27c303170060004c1be93787c6a32dcb6;p=freeside.git diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm index 9aeff93a6..e1f654c34 100644 --- a/FS/FS/Misc.pm +++ b/FS/FS/Misc.pm @@ -23,6 +23,7 @@ use Encode; csv_from_fixed ocr_image bytes_substr + money_pretty ); $DEBUG = 0; @@ -828,7 +829,7 @@ sub _pslatex { } return if -e "$file.dvi" && -s "$file.dvi"; - die "pslatex $file.tex failed; see $file.log for details?\n"; + die "pslatex $file.tex failed, see $file.log for details?\n"; } @@ -982,6 +983,22 @@ sub bytes_substr { return Encode::decode('utf8', $bytes, $chk); } +=item money_pretty + +Accepts a postive or negative numerical value. +Returns amount formatted for display, +including money character. + +=cut + +sub money_pretty { + my $amount = shift; + my $money_char = $conf->{'money_char'} || '$'; + $amount = sprintf("%0.2f",$amount); + $amount =~ s/^(-?)/$1$money_char/; + return $amount; +} + =back =head1 BUGS