summaryrefslogtreecommitdiff
path: root/FS/FS
diff options
context:
space:
mode:
authormark <mark>2010-09-29 23:41:34 +0000
committermark <mark>2010-09-29 23:41:34 +0000
commit86119e342d95f16b799043e9cf66230d015c37de (patch)
tree960e73ef2865273fdce098e488632c2e39d805e5 /FS/FS
parentbc4176f12dd581e910124153a77e51a4c7f0d9a3 (diff)
option to charge the next full period when prorating, RT#9874
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/part_pkg/agent.pm6
-rw-r--r--FS/FS/part_pkg/cdr_termination.pm5
-rw-r--r--FS/FS/part_pkg/prorate.pm8
-rw-r--r--FS/FS/part_pkg/prorate_Mixin.pm11
-rw-r--r--FS/FS/part_pkg/sql_external.pm6
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm6
-rw-r--r--FS/FS/part_pkg/voip_inbound.pm6
7 files changed, 41 insertions, 7 deletions
diff --git a/FS/FS/part_pkg/agent.pm b/FS/FS/part_pkg/agent.pm
index e5bd163..69ecf77 100644
--- a/FS/FS/part_pkg/agent.pm
+++ b/FS/FS/part_pkg/agent.pm
@@ -38,6 +38,10 @@ $me = '[FS::part_pkg::agent]';
'cutoff_day' => { 'name' => 'Billing Day (1 - 28)',
'default' => '1',
},
+ 'add_full_period'=> { 'name' => 'When prorating first month, also bill '.
+ 'for one full period after that',
+ 'type' => 'checkbox',
+ },
'no_pkg_prorate' => { 'name' => 'Disable prorating bulk packages (charge full price for packages active only a portion of the month)',
'type' => 'checkbox',
@@ -46,7 +50,7 @@ $me = '[FS::part_pkg::agent]';
},
#'fieldorder' => [qw( setup_fee recur_fee recur_method cutoff_day ) ],
- 'fieldorder' => [qw( setup_fee recur_fee cutoff_day no_pkg_prorate ) ],
+ 'fieldorder' => [qw( setup_fee recur_fee cutoff_day add_full_period no_pkg_prorate ) ],
'weight' => 51,
diff --git a/FS/FS/part_pkg/cdr_termination.pm b/FS/FS/part_pkg/cdr_termination.pm
index cfd6b4e..0666d79 100644
--- a/FS/FS/part_pkg/cdr_termination.pm
+++ b/FS/FS/part_pkg/cdr_termination.pm
@@ -58,6 +58,10 @@ tie my %temporalities, 'Tie::IxHash',
'subscription',
'default' => '1',
},
+ 'add_full_period'=> { 'name' => 'When prorating first month, also bill '.
+ 'for one full period after that',
+ 'type' => 'checkbox',
+ },
'recur_method' => { 'name' => 'Recurring fee method',
#'type' => 'radio',
@@ -90,6 +94,7 @@ tie my %temporalities, 'Tie::IxHash',
'fieldorder' => [qw(
setup_fee recur_fee
recur_temporality unused_credit recur_method cutoff_day
+ add_full_period
output_format usage_section summarize_usage usage_mandate
)
],
diff --git a/FS/FS/part_pkg/prorate.pm b/FS/FS/part_pkg/prorate.pm
index 918b910..22bb809 100644
--- a/FS/FS/part_pkg/prorate.pm
+++ b/FS/FS/part_pkg/prorate.pm
@@ -79,6 +79,11 @@ use FS::part_pkg::flat;
'package recharge',
'type' => 'checkbox',
},
+ 'add_full_period'=> { 'name' => 'When prorating first month, also bill '.
+ 'for one full period after that',
+ 'type' => 'checkbox',
+ },
+
#it would be better if this had to be turned on, its confusing
'externalid' => { 'name' => 'Optional External ID',
@@ -89,7 +94,8 @@ use FS::part_pkg::flat;
'seconds', 'upbytes', 'downbytes', 'totalbytes',
'recharge_amount', 'recharge_seconds', 'recharge_upbytes',
'recharge_downbytes', 'recharge_totalbytes',
- 'usage_rollover', 'recharge_reset', 'externalid', ],
+ 'usage_rollover', 'recharge_reset', 'add_full_period',
+ 'externalid', ],
'freq' => 'm',
'weight' => 20,
);
diff --git a/FS/FS/part_pkg/prorate_Mixin.pm b/FS/FS/part_pkg/prorate_Mixin.pm
index 2adf2f1..ed532ee 100644
--- a/FS/FS/part_pkg/prorate_Mixin.pm
+++ b/FS/FS/part_pkg/prorate_Mixin.pm
@@ -80,12 +80,19 @@ sub calc_prorate {
$mstart =
timelocal(0,0,0,$cutoff_day,$mon == 0 ? 11 : $mon - 1,$year-($mon==11));
}
-
+
+ # next bill date will be figured as $$sdate + one period
$$sdate = $mstart;
my $permonth = $self->option('recur_fee', 1) / $self->freq;
my $months = ( ( $self->freq - 1 ) + ($mend-$mnow) / ($mend-$mstart) );
-
+
+ if ( $self->option('add_full_period',1) ) {
+ # charge a full period in addition to the partial month
+ $months += $self->freq;
+ $$sdate = $self->add_freq($mstart);
+ }
+
$param->{'months'} = $months;
$charge = sprintf('%.2f', $permonth * $months);
}
diff --git a/FS/FS/part_pkg/sql_external.pm b/FS/FS/part_pkg/sql_external.pm
index 3cf2064..8e803f9 100644
--- a/FS/FS/part_pkg/sql_external.pm
+++ b/FS/FS/part_pkg/sql_external.pm
@@ -24,6 +24,10 @@ use DBI;
'subscription',
'default' => '1',
},
+ 'add_full_period'=> { 'name' => 'When prorating first month, also bill '.
+ 'for one full period after that',
+ 'type' => 'checkbox',
+ },
'recur_method' => { 'name' => 'Recurring fee method',
#'type' => 'radio',
@@ -45,7 +49,7 @@ use DBI;
},
},
'fieldorder' => [qw( setup_fee recur_fee unused_credit recur_method cutoff_day
- datasrc db_username db_password query
+ add_full_period datasrc db_username db_password query
)],
'weight' => '58',
);
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index 005009a..5b83cc7 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -70,7 +70,10 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
'subscription',
'default' => '1',
},
-
+ 'add_full_period'=> { 'name' => 'When prorating first month, also bill '.
+ 'for one full period after that',
+ 'type' => 'checkbox',
+ },
'recur_method' => { 'name' => 'Recurring fee method',
#'type' => 'radio',
#'options' => \%recur_method,
@@ -253,6 +256,7 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
'fieldorder' => [qw(
setup_fee recur_fee recur_temporality unused_credit
recur_method cutoff_day
+ add_full_period
cdr_svc_method
rating_method ratenum min_charge sec_granularity
ignore_unrateable
diff --git a/FS/FS/part_pkg/voip_inbound.pm b/FS/FS/part_pkg/voip_inbound.pm
index 4937bb8..8b1844a 100644
--- a/FS/FS/part_pkg/voip_inbound.pm
+++ b/FS/FS/part_pkg/voip_inbound.pm
@@ -47,6 +47,10 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
'subscription',
'default' => '1',
},
+ 'add_full_period'=> { 'name' => 'When prorating first month, also bill '.
+ 'for one full period after that',
+ 'type' => 'checkbox',
+ },
'recur_method' => { 'name' => 'Recurring fee method',
'type' => 'select',
@@ -152,7 +156,7 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
},
'fieldorder' => [qw(
setup_fee recur_fee recur_temporality unused_credit
- recur_method cutoff_day
+ recur_method cutoff_day add_full_period
min_charge sec_granularity
default_prefix
disable_tollfree