projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
discounts, RT#6679
[freeside.git]
/
FS
/
FS
/
part_pkg
/
flat.pm
diff --git
a/FS/FS/part_pkg/flat.pm
b/FS/FS/part_pkg/flat.pm
index
402730d
..
e5fc089
100644
(file)
--- a/
FS/FS/part_pkg/flat.pm
+++ b/
FS/FS/part_pkg/flat.pm
@@
-188,15
+188,17
@@
sub calc_discount {
die "error discounting: $error" if $error;
$amount *= $months;
die "error discounting: $error" if $error;
$amount *= $months;
+ $amount = sprintf('%.2f', $amount);
#add details on discount to invoice
my $conf = new FS::Conf;
my $money_char = $conf->config('money_char') || '$';
#add details on discount to invoice
my $conf = new FS::Conf;
my $money_char = $conf->config('money_char') || '$';
+ $months = sprintf('%.2f', $months) if $months =~ /\./;
my $d = 'Includes ';
$d .= $discount->name. ' ' if $discount->name;
$d .= 'discount of '. $discount->description_short;
my $d = 'Includes ';
$d .= $discount->name. ' ' if $discount->name;
$d .= 'discount of '. $discount->description_short;
- $d .= " for $months month". ( $months
>
1 ? 's' : '' );
+ $d .= " for $months month". ( $months
!=
1 ? 's' : '' );
$d .= ": $money_char$amount" if $months != 1 || $discount->percent;
push @$details, $d;
$d .= ": $money_char$amount" if $months != 1 || $discount->percent;
push @$details, $d;