4 #doesn't yet deal with daily/weekly packages
6 #needs to be re-written in sql for efficiency
13 grep { $_->cust_pkg && $_->cust_pkg->part_pkg->freq !~ /^([01]|\d+[dw])$/ }
14 qsearch( 'cust_bill_pkg', {
15 'recur' => { op=>'!=', value=>0 },
16 'edate' => { op=>'>', value=>$now },
19 foreach my $cust_bill_pkg ( @cust_bill_pkg ) {
21 #conceptual false laziness w/texas tax exempt_amount stuff in
24 my $freq = $cust_bill_pkg->cust_pkg->part_pkg->freq;
25 my $per_month = sprintf("%.2f", $cust_bill_pkg->recur / $freq);
27 my($mon, $year) = (localtime($cust_bill_pkg->sdate) )[4,5];
30 foreach my $which_month ( 2 .. $freq ) {
31 until ( $mon < 13 ) { $mon -= 12; $year++; }
32 $prepaid{"$year-$mon"} += $per_month;
39 <%= header('Prepaid Income Report', menubar( 'Main Menu'=>$p, ) ) %>
45 my ($now_mon, $now_year) = (localtime($now))[4,5];
46 $now_mon+=2; $now_year+=1900;
47 until ( $now_mon < 13 ) { $now_mon -= 12; $now_year++; }
50 for my $year ( $now_year .. 2037 ) {
51 for my $mon ( ( $subseq++ ? 1 : $now_mon ) .. 12 ) {
52 if ( $prepaid{"$year-$mon"} ) {
53 $total += $prepaid{"$year-$mon"};
54 %> <TR><TD><%= "$year-$mon" %></TD>
55 <TD><%= sprintf("%.2f", $prepaid{"$year-$mon"} ) %></TD>
64 <TR><TH>Total</TH><TD><%= sprintf("%.2f", $total) %></TD></TR>