RT#24684: Payments for Online Bill Pay [Credit Balance Display]
[freeside.git] / FS / FS / Misc.pm
index 9aeff93..e1f654c 100644 (file)
@@ -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