combine ticket notification scrips, #15353
[freeside.git] / httemplate / search / report_receivables.cgi
1 <& elements/cust_main_dayranges.html,
2                  'title'       => emt('Accounts Receivable Aging Summary'),
3                  'range_sub'   => \&balance,
4                  'payment_links' => 1,
5 &>
6 <%init>
7
8 die "access denied"
9   unless $FS::CurrentUser::CurrentUser->access_right('Receivables report')
10       or $FS::CurrentUser::CurrentUser->access_right('Financial reports');
11
12 </%init>
13 <%once>
14
15 #Example:
16 #
17 # my $balance = balance(
18 #   $start, $end, $offset,
19 #   'no_as'  => 1, #set to true when using in a WHERE clause (supress AS clause)
20 #                 #or 0 / omit when using in a SELECT clause as a column
21 #                 #  ("AS balance_$start_$end")
22 #   'sum'    => 1, #set to true to get a SUM() of the values, for totals
23 #
24 #   #obsolete? options for totals (passed to cust_main::balance_date_sql)
25 #   'total'  => 1, #set to true to remove all customer comparison clauses
26 #   'join'   => $join,   #JOIN clause
27 #   'where'  => \@where, #WHERE clause hashref (elements "AND"ed together)
28 # )
29
30 sub balance {
31   my($start, $end, $cutoff) = @_; #, %opt ?
32
33   FS::cust_main->balance_date_sql( $start, $end, 
34         'cutoff' => $cutoff,
35         'unapplied_date'=>1,
36   );
37 }
38
39 </%once>