diff options
author | jeff <jeff> | 2010-06-28 20:48:04 +0000 |
---|---|---|
committer | jeff <jeff> | 2010-06-28 20:48:04 +0000 |
commit | 6136d37b990f0f2a0e1a57248e42ccf21ebb85c3 (patch) | |
tree | 9d480cbbf7b6d5c29349413e059c9c6367d59ecd | |
parent | 577d448ee46f5d3819f2488069f6a48b9d1b451a (diff) |
correct connection charge calculation
-rw-r--r-- | FS/FS/part_pkg/voip_cdr.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm index 62214df89..09dffc5f5 100644 --- a/FS/FS/part_pkg/voip_cdr.pm +++ b/FS/FS/part_pkg/voip_cdr.pm @@ -452,6 +452,7 @@ sub calc_usage { # } else { #pass upstream price through # # $charge = sprintf('%.2f', $cdr->upstream_price); +# warn "Incrementing \$charges by $charge. Now $charges\n" if $DEBUG; # $charges += $charge; # # @call_details = ( @@ -470,6 +471,7 @@ sub calc_usage { #XXX $charge = sprintf('%.2f', $cdr->upstream_price); $charge = sprintf('%.3f', $cdr->upstream_price); $charges += $charge; + warn "Incrementing \$charges by $charge. Now $charges\n" if $DEBUG; @call_details = ($cdr->downstream_csv( 'format' => $output_format, 'charge' => $charge, @@ -500,6 +502,7 @@ sub calc_usage { $charge = sprintf('%.4f', ( $self->option('min_charge') * $minutes ) + 0.0000000001 ); #so 1.00005 rounds to 1.0001 + warn "Incrementing \$charges by $charge. Now $charges\n" if $DEBUG; $charges += $charge; @call_details = ($cdr->downstream_csv( 'format' => $output_format, @@ -553,13 +556,14 @@ sub calc_usage { $charge = sprintf('%.2f', $rate_detail->conn_charge); - if ( $included_min{$regionnum} < 0 ) { + if ( $included_min{$regionnum} <= 0 ) { 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) + 0.00000001 ); #so 1.005 rounds to 1.01 $charge = sprintf('%.2f', $charge); + warn "Incrementing \$charges by $charge. Now $charges\n" if $DEBUG; $charges += $charge; } |