1 package FS::part_pkg::prorate;
4 use vars qw(@ISA %info);
5 use Time::Local qw(timelocal);
6 #use FS::Record qw(qsearch qsearchs);
7 use FS::part_pkg::flat;
9 @ISA = qw(FS::part_pkg::flat);
12 'name' => 'First partial month pro-rated, then flat-rate (selectable billing day)',
13 'shortname' => 'Prorate (Nth of month billing)',
15 'setup_fee' => { 'name' => 'Setup fee for this package',
18 'recur_fee' => { 'name' => 'Recurring fee for this package',
21 'unused_credit' => { 'name' => 'Credit the customer for the unused portion'.
22 ' of service at cancellation',
25 'cutoff_day' => { 'name' => 'Billing Day (1 - 28)',
28 'seconds' => { 'name' => 'Time limit for this package',
30 'check' => sub { shift =~ /^\d*$/ },
32 'upbytes' => { 'name' => 'Upload limit for this package',
34 'check' => sub { shift =~ /^\d*$/ },
35 'format' => \&FS::UI::bytecount::display_bytecount,
36 'parse' => \&FS::UI::bytecount::parse_bytecount,
38 'downbytes' => { 'name' => 'Download limit for this package',
40 'check' => sub { shift =~ /^\d*$/ },
41 'format' => \&FS::UI::bytecount::display_bytecount,
42 'parse' => \&FS::UI::bytecount::parse_bytecount,
44 'totalbytes' => { 'name' => 'Transfer limit for this package',
46 'check' => sub { shift =~ /^\d*$/ },
47 'format' => \&FS::UI::bytecount::display_bytecount,
48 'parse' => \&FS::UI::bytecount::parse_bytecount,
50 'recharge_amount' => { 'name' => 'Cost of recharge for this package',
52 'check' => sub { shift =~ /^\d*(\.\d{2})?$/ },
54 'recharge_seconds' => { 'name' => 'Recharge time for this package',
56 'check' => sub { shift =~ /^\d*$/ },
58 'recharge_upbytes' => { 'name' => 'Recharge upload for this package',
60 'check' => sub { shift =~ /^\d*$/ },
61 'format' => \&FS::UI::bytecount::display_bytecount,
62 'parse' => \&FS::UI::bytecount::parse_bytecount,
64 'recharge_downbytes' => { 'name' => 'Recharge download for this package', 'default' => '',
65 'check' => sub { shift =~ /^\d*$/ },
66 'format' => \&FS::UI::bytecount::display_bytecount,
67 'parse' => \&FS::UI::bytecount::parse_bytecount,
69 'recharge_totalbytes' => { 'name' => 'Recharge transfer for this package', 'default' => '',
70 'check' => sub { shift =~ /^\d*$/ },
71 'format' => \&FS::UI::bytecount::display_bytecount,
72 'parse' => \&FS::UI::bytecount::parse_bytecount,
74 'usage_rollover' => { 'name' => 'Allow usage from previous period to roll '.
75 'over into current period',
78 'recharge_reset' => { 'name' => 'Reset usage to these values on manual '.
82 'add_full_period'=> { 'name' => 'When prorating first month, also bill '.
83 'for one full period after that',
88 #it would be better if this had to be turned on, its confusing
89 'externalid' => { 'name' => 'Optional External ID',
93 'fieldorder' => [ 'setup_fee', 'recur_fee', 'unused_credit', 'cutoff_day',
94 'seconds', 'upbytes', 'downbytes', 'totalbytes',
95 'recharge_amount', 'recharge_seconds', 'recharge_upbytes',
96 'recharge_downbytes', 'recharge_totalbytes',
97 'usage_rollover', 'recharge_reset', 'add_full_period',
105 $self->calc_prorate(@_);