add customer class to advanced invoice report, RT#22851
[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 % unless ( $custnum ) {
8
9   <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
10
11     <TR>
12       <TH CLASS="background" COLSPAN=2 ALIGN="left">
13         <FONT SIZE="+1">Customer search options</FONT>
14       </TH>
15     </TR>
16
17   <& /elements/tr-select-agent.html,
18                  'curr_value'    => scalar( $cgi->param('agentnum') ),
19                  'label'         => emt('Agent'),
20                  'disable_empty' => 0,
21   &>
22
23   <& /elements/tr-select-cust_class.html,
24       label         => mt('Customer Class'),
25       field         => 'cust_classnum',
26       multiple      => 1,
27      'pre_options'  => [ '' => emt('(none)') ],
28      'all_selected' => 1,
29   &>
30
31 %   if ( $cust_main ) {
32     <INPUT TYPE="hidden" NAME="payby" VALUE="<% $cust_main->payby %>">
33 %   } else {
34     <& /elements/tr-select-payby.html,
35                   label   => emt('Payment method:'),
36                   payby_type   => 'cust',
37                   multiple     => 1,
38                   all_selected => 1,
39     &>
40 % }
41
42   </TABLE>
43   <BR>
44
45 % }
46
47   <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
48
49     <TR>
50       <TH CLASS="background" COLSPAN=2 ALIGN="left">
51         <FONT SIZE="+1">Invoice search options</FONT>
52       </TH>
53     </TR>
54
55   <& /elements/tr-input-beginning_ending.html &>
56
57   <& /elements/tr-input-lessthan_greaterthan.html,
58                 label   => emt('Charged'),
59                 field   => 'charged',
60   &>
61
62   <& /elements/tr-input-lessthan_greaterthan.html,
63                 label   => emt('Owed'),
64                 field   => 'owed',
65   &>
66
67 % if ( $conf->exists('cust_bill-enable_promised_date') ) {
68   <TR>
69     
70     <TD ALIGN="right" STYLE="vertical-align:text-top">
71       <% emt('Promised payment date:') %></TD>
72     <TD>
73       <INPUT TYPE="checkbox" NAME="promised_date"   CHECKED VALUE="null">
74         <% emt('None') %> <BR>
75       <INPUT TYPE="checkbox" NAME="promised_date"   CHECKED VALUE="past">
76         <% emt('In the past') %><BR>
77       <INPUT TYPE="checkbox" NAME="promised_date"   CHECKED VALUE="future">
78         <% emt('In the future') %><BR>
79     </TD>
80   </TR>
81 % }
82
83 </TABLE>
84 <BR>
85
86 <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
87
88   <TR>
89     <TH CLASS="background" COLSPAN=2 ALIGN="left">
90       <FONT SIZE="+1">Display options</FONT>
91     </TH>
92   </TR>
93
94
95 <TR>
96     <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="open" VALUE="1" CHECKED></TD>
97     <TD><% mt('Show only open invoices') |h %></TD>
98   </TR>
99
100 % unless ( $custnum ) {
101   <TR>
102     <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="newest_percust" VALUE="1"></TD>
103     <TD><% mt('Show only the single most recent invoice per-customer') |h %></TD>
104   </TR>
105 % }
106
107 </TABLE>
108
109 <BR>
110 <INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
111
112 </FORM>
113
114 <& /elements/footer.html &>
115 <%init>
116
117 die "access denied"
118   unless $FS::CurrentUser::CurrentUser->access_right('List invoices');
119
120 my $conf = new FS::Conf;
121
122 my $title = 'Invoice Report';
123 #false laziness w/report_cust_pkg.html
124 my @title_arg = ();
125
126 my $custnum = '';
127 my $cust_main = '';
128 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
129   $custnum = $1;
130   $cust_main = qsearchs({
131     'table'     => 'cust_main', 
132     'hashref'   => { 'custnum' => $custnum },
133     'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
134   }) or die "unknown custnum $custnum";
135   $title .= ': [_1]';
136   push @title_arg, $cust_main->name;
137 }
138
139 </%init>