summaryrefslogtreecommitdiff
path: root/FS/FS/Misc.pm
diff options
context:
space:
mode:
Diffstat (limited to 'FS/FS/Misc.pm')
-rw-r--r--FS/FS/Misc.pm19
1 files changed, 18 insertions, 1 deletions
diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm
index 9aeff93..e1f654c 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