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