@ISA = qw(FS::part_pkg::recur_Common);
-$DEBUG = 0;
+$DEBUG = 1;
tie my %rating_method, 'Tie::IxHash',
'prefix' => 'Rate calls by using destination prefix to look up a region and rate according to the internal prefix and rate tables',
warn "rating call $to_or_from +$countrycode $number\n" if $DEBUG;
$pretty_destnum = "+$countrycode $number";
+ #asterisks here causes inserting the detail to barf, so:
+ $pretty_destnum =~ s/\*//g;
my $rate = qsearchs('rate', { 'ratenum' => $ratenum })
or die "ratenum $ratenum not found!";
# } 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 = (
#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,
$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,
$charge += sprintf('%.2f', ($rate_detail->min_charge * $charge_min)
+ 0.00000001 ); #so 1.005 rounds to 1.01
$charge = sprintf('%.2f', $charge);
- $charges += $charge;
}
+ warn "Incrementing \$charges by $charge. Now $charges\n" if $DEBUG;
+ $charges += $charge;
# this is why we need regionnum/rate_region....
warn " (rate region $rate_region)\n" if $DEBUG;