From: Ivan Kohler Date: Wed, 4 Sep 2013 05:51:41 +0000 (-0700) Subject: rounding X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=81ffe1d0f3f0201c9392bb5555134d65b0ce33c6;p=freeside.git rounding --- diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm index de9cf124a..9d72c39e4 100644 --- a/FS/FS/cdr.pm +++ b/FS/FS/cdr.pm @@ -955,9 +955,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,