[freeside-commits] freeside/FS/FS/part_pkg voip_cdr.pm,1.59,1.60
Ivan,,,
ivan at wavetail.420.am
Wed Apr 1 19:36:43 PDT 2009
Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail.420.am:/tmp/cvs-serv8877
Modified Files:
voip_cdr.pm
Log Message:
more than you ever wanted to know about rounding. http://en.wikipedia.org/wiki/Rounding RT#4666
Index: voip_cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/voip_cdr.pm,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- voip_cdr.pm 1 Apr 2009 03:51:19 -0000 1.59
+++ voip_cdr.pm 2 Apr 2009 02:36:41 -0000 1.60
@@ -457,9 +457,11 @@
$included_min{$regionnum} -= $minutes;
if ( $included_min{$regionnum} < 0 ) {
- my $charge_min = 0 - $included_min{$regionnum};
+ my $charge_min = 0 - $included_min{$regionnum}; #XXX should preserve
+ #(display?) this
$included_min{$regionnum} = 0;
- $charge = sprintf('%.2f', $rate_detail->min_charge * $charge_min );
+ $charge = sprintf('%.2f', ( $rate_detail->min_charge * $charge_min )
+ + 0.00000001 ); #so 1.005 rounds to 1.01
$charges += $charge;
}
More information about the freeside-commits
mailing list