'single_price' => 'A single price per minute for all calls.',
;
+tie my %rounding, 'Tie::IxHash',
+ '2' => 'Two decimal places (cent)',
+ '4' => 'Four decimal places (100th of a cent)',
+;
+
#tie my %cdr_location, 'Tie::IxHash',
# 'internal' => 'Internal: CDR records imported into the internal CDR table',
# 'external' => 'External: CDR records queried directly from an external '.
FS::cdr::invoice_formats()
;
+tie my %accountcode_tollfree_field, 'Tie::IxHash',
+ 'dst' => 'Destination (dst)',
+ 'src' => 'Source (src)',
+;
+
%info = (
'name' => 'VoIP rating by plan of CDR records in an internal (or external) SQL table',
'shortname' => 'VoIP/telco CDR rating (standard)',
'options' => \%rating_method,
},
+ 'rounding' => { 'name' => 'Rounding for destination prefix rating',
+ 'type' => 'select',
+ 'select_options' => \%rounding,
+ },
+
'ratenum' => { 'name' => 'Rate plan',
'type' => 'select',
'select_table' => 'rate',
'empty_label' => '',
},
+ 'accountcode_tollfree_field' => {
+ 'name' => 'When using an alternate rate plan for toll-free accountcodes, the CDR field to use in rating calculations',
+ 'type' => 'select',
+ 'select_options' => \%accountcode_tollfree_field,
+ },
+
'skip_dst_length_less' => { 'name' => 'Do not charge for CDRs where the destination is less than this many digits:',
},
'type' => 'checkbox',
},
- 'usage_mandate' => { 'name' => 'Always put usage details in separate section',
+ 'usage_mandate' => { 'name' => 'Always put usage details in separate section. The section is defined in the next option.',
'type' => 'checkbox',
},
#eofalse
FS::part_pkg::prorate_Mixin::fieldorder,
qw(
cdr_svc_method
- rating_method ratenum intrastate_ratenum
+ rating_method rounding ratenum intrastate_ratenum
calls_included
min_charge min_included sec_granularity
ignore_unrateable
skip_dcontext skip_dst_prefix
skip_dstchannel_prefix skip_src_length_more
noskip_src_length_accountcode_tollfree
- accountcode_tollfree_ratenum
+ accountcode_tollfree_ratenum accountcode_tollfree_field
skip_dst_length_less
noskip_dst_length_accountcode_tollfree
skip_lastapp
411_rewrite
output_format
selfservice_format selfservice_inbound_format
- usage_mandate summarize_usage usage_section
- bill_every_call bill_inactive_svcs
+ usage_mandate usage_section summarize_usage
+ usage_nozero bill_every_call bill_inactive_svcs
count_available_phones suspend_bill
)
],
- 'weight' => 40,
+ 'weight' => 41,
);
sub price_info {
my $charges = 0;
$charges += $self->calc_usage(@_);
- $charges += $self->calc_recur_Common(@_);
+ $charges += ($cust_pkg->quantity || 1) * $self->calc_recur_Common(@_);
$charges;
$svc_x = $cust_svc->svc_x;
}
+ unless ( $svc_x ) {
+ my $h = $self->option('bill_inactive_svcs',1) ? 'h_' : '';
+ warn "WARNING: no $h$svc_table for svcnum ". $cust_svc->svcnum. "\n";
+ }
+
my %options = (
'disable_src' => $self->option('disable_src'),
'default_prefix' => $self->option('default_prefix'),
my($self, $cust_pkg ) = @_;
my $count = 0;
if ( $self->option('count_available_phones', 1)) {
- map { $count += ( $_->quantity || 0 ) }
- grep { $_->part_svc->svcdb eq 'svc_phone' }
- $cust_pkg->part_pkg->pkg_svc;
+ foreach my $pkg_svc ($cust_pkg->part_pkg->pkg_svc) {
+ if ($pkg_svc->part_svc->svcdb eq 'svc_phone') { # svc_pbx?
+ $count += $pkg_svc->quantity || 0;
+ }
+ }
+ $count *= $cust_pkg->quantity;
} else {
$count =
scalar(grep { $_->part_svc->svcdb eq 'svc_phone' } $cust_pkg->cust_svc);