summaryrefslogtreecommitdiff
path: root/FS/FS/cdr.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-09-03 22:52:05 -0700
committerIvan Kohler <ivan@freeside.biz>2013-09-03 22:52:05 -0700
commit6de95595e5e7eb53fd70fe6c30d96fb946091e93 (patch)
tree261714bf4a535be2549606e64c0bdbabdfa2990e /FS/FS/cdr.pm
parent034089cb2e60fc44ca895984a3a20c66ff50ce77 (diff)
rounding
Diffstat (limited to 'FS/FS/cdr.pm')
-rw-r--r--FS/FS/cdr.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm
index 3ebe6c4..e127e8b 100644
--- a/FS/FS/cdr.pm
+++ b/FS/FS/cdr.pm
@@ -951,9 +951,15 @@ sub rate_prefix {
# this is why we need regionnum/rate_region....
warn " (rate region $rate_region)\n" if $DEBUG;
+ # NOW round it.
+ my $rounding = $part_pkg->option_cacheable('rounding') || 2;
+ my $sprintformat = '%.'. $rounding. 'f';
+ my $roundup = 10**(-3-$rounding);
+ my $price = sprintf($sprintformat, $charge + $roundup);
+
$self->set_status_and_rated_price(
'rated',
- sprintf('%.2f', $charge + 0.000001), # NOW round it.
+ $price,
$opt{'svcnum'},
'rated_pretty_dst' => $pretty_dst,
'rated_regionname' => $rate_region->regionname,