1 package FS::part_pkg::prorate_delayed;
4 use vars qw(@ISA %info);
5 #use FS::Record qw(qsearch qsearchs);
8 @ISA = qw(FS::part_pkg::prorate);
11 'name' => 'Free (or setup fee) for X days, then prorate, then flat-rate ' .
12 '(1st of month billing)',
13 'shortname' => 'Prorate (Nth of month billing), with intro period', #??
14 'inherit_fields' => [ 'global_Mixin' ],
16 'free_days' => { 'name' => 'Initial free days',
19 'recur_notify' => { 'name' => 'Number of days before recurring billing'.
20 ' commences to notify customer. (0 means'.
25 'fieldorder' => [ 'free_days', 'recur_notify' ],
26 #'setup' => '\'my $d = $cust_pkg->bill || $time; $d += 86400 * \' + what.free_days.value + \'; $cust_pkg->bill($d); $cust_pkg_mod_flag=1; \' + what.setup_fee.value',
27 #'recur' => 'what.recur_fee.value',
32 my($self, $cust_pkg, $time ) = @_;
34 my $d = $cust_pkg->bill || $time;
35 $d += 86400 * $self->option('free_days');
38 $self->option('setup_fee');
42 my ($self, $cust_pkg, %options) = @_;
43 my $last_bill = $cust_pkg->last_bill || 0;
44 my $next_bill = $cust_pkg->getfield('bill') || 0;
45 my $free_days = $self->option('free_days');
47 return 0 if $last_bill + (86400 * $free_days) == $next_bill
48 && $last_bill == $cust_pkg->setup;
50 return $self->SUPER::calc_remain($cust_pkg, %options);