Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / search / report_cust_bill.html
1 <& /elements/header.html, mt($title, @title_arg) &>
2
3 <FORM ACTION="cust_bill.html" METHOD="GET">
4 <INPUT TYPE="hidden" NAME="magic" VALUE="_date">
5 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
6
7 <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
8
9 % unless ( $custnum ) {
10   <& /elements/tr-select-agent.html,
11                  'curr_value'    => scalar( $cgi->param('agentnum') ),
12                  'label'         => emt('Invoices for agent: '),
13                  'disable_empty' => 0,
14   &>
15 % }
16
17   <& /elements/tr-input-beginning_ending.html &>
18
19   <& /elements/tr-input-lessthan_greaterthan.html,
20                 label   => emt('Charged'),
21                 field   => 'charged',
22   &>
23
24   <& /elements/tr-input-lessthan_greaterthan.html,
25                 label   => emt('Owed'),
26                 field   => 'owed',
27   &>
28
29 % if ( $cust_main ) {
30   <INPUT TYPE="hidden" NAME="payby" VALUE="<% $cust_main->payby %>">
31 % } else {
32   <& /elements/tr-select-payby.html,
33                 label   => emt('Payment method:'),
34                 payby_type   => 'cust',
35                 multiple     => 1,
36                 all_selected => 1,
37   &>
38 % }
39
40 % if ( $conf->exists('cust_bill-enable_promised_date') ) {
41   <TR>
42     
43     <TD ALIGN="right" STYLE="vertical-align:text-top">
44       <% emt('Promised payment date:') %></TD>
45     <TD>
46       <INPUT TYPE="checkbox" NAME="promised_date"   CHECKED VALUE="null">
47         <% emt('None') %> <BR>
48       <INPUT TYPE="checkbox" NAME="promised_date"   CHECKED VALUE="past">
49         <% emt('In the past') %><BR>
50       <INPUT TYPE="checkbox" NAME="promised_date"   CHECKED VALUE="future">
51         <% emt('In the future') %><BR>
52     </TD>
53   </TR>
54 % }
55
56 <TR>
57     <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="open" VALUE="1" CHECKED></TD>
58     <TD><% mt('Show only open invoices') |h %></TD>
59   </TR>
60
61 % unless ( $custnum ) {
62   <TR>
63     <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="newest_percust" VALUE="1"></TD>
64     <TD><% mt('Show only the single most recent invoice per-customer') |h %></TD>
65   </TR>
66 % }
67
68
69 </TABLE>
70
71 <BR>
72 <INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
73
74 </FORM>
75
76 <& /elements/footer.html &>
77 <%init>
78
79 die "access denied"
80   unless $FS::CurrentUser::CurrentUser->access_right('List invoices');
81
82 my $conf = new FS::Conf;
83
84 my $title = 'Invoice Report';
85 #false laziness w/report_cust_pkg.html
86 my @title_arg = ();
87
88 my $custnum = '';
89 my $cust_main = '';
90 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
91   $custnum = $1;
92   $cust_main = qsearchs({
93     'table'     => 'cust_main', 
94     'hashref'   => { 'custnum' => $custnum },
95     'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
96   }) or die "unknown custnum $custnum";
97   $title .= ': [_1]';
98   push @title_arg, $cust_main->name;
99 }
100
101 </%init>