modular price plans!
[freeside.git] / FS / FS / part_pkg / subscription.pm
1 package FS::part_pkg::subscription;
2
3 use strict;
4 use vars qw(@ISA %info);
5 use Time::Local qw(timelocal);
6 #use FS::Record qw(qsearch qsearchs);
7 use FS::part_pkg;
8
9 @ISA = qw(FS::part_pkg);
10
11 %info = (
12     'name' => 'First partial month full charge, then flat-rate (1st of month billing)',
13     'fields' => {
14       'setup_fee' => { 'name' => 'Setup fee for this package',
15                        'default' => 0,
16                      },
17       'recur_fee' => { 'name' => 'Recurring fee for this package',
18                        'default' => 0,
19                       },
20     },
21     'fieldorder' => [ 'setup_fee', 'recur_fee' ],
22     #'setup' => 'what.setup_fee.value',
23     #'recur' => '\'my $mnow = $sdate; my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($sdate) )[0,1,2,3,4,5]; $sdate = timelocal(0,0,0,1,$mon,$year); \' + what.recur_fee.value',
24     'freq' => 'm',
25     'weight' => 30,
26 );
27
28 sub calc_setup {
29   my($self, $cust_pkg ) = @_;
30   $self->option('setup_fee');
31 }
32
33 sub calc_recur {
34   my($self, $cust_pkg, $sdate ) = @_;
35
36   my $mnow = $$sdate;
37   my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($mnow) )[0,1,2,3,4,5];
38   $$sdate = timelocal(0,0,0,1,$mon,$year);
39
40   $self->option('recur_fee');
41 }
42
43 1;