1 <% include( 'elements/cust_main_dayranges.html',
2 #'title' => 'Prepaid Balance Aging Summary', #???
3 'title' => 'Unapplied Payments Aging Summary',
4 'range_sub' => \&unapplied_payments,
10 unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
15 sub unapplied_payments {
16 my($start, $end, %opt) = @_;
18 #handle start and end ranges (86400 = 24h * 60m * 60s)
19 my $str2time = str2time_sql;
20 my $closing = str2time_sql_closing;
21 $start = $start ? "( $str2time now() $closing - ".($start * 86400). ' )' : '';
22 $end = $end ? "( $str2time now() $closing - ".($end * 86400). ' )' : '';
24 FS::cust_main->unapplied_payments_date_sql( $start, $end );