add option to customer search to search on non-active packages too, RT#73062
[freeside.git] / httemplate / search / report_cust_main.html
1 <& /elements/header.html, mt('Customer Report') &>
2
3 <FORM ACTION="cust_main.html" METHOD="GET">
4 <INPUT TYPE="hidden" NAME="magic" VALUE="bill">
5
6   <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
7
8     <TR>
9       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Basic search options') |h %></FONT></TH>
10     </TR>
11
12     <& /elements/tr-select-agent.html,
13                   'curr_value'    => scalar($cgi->param('agentnum')),
14                   'disable_empty' => 0,
15     &>
16
17     <& /elements/tr-select-sales.html,
18                   'curr_value'    => scalar($cgi->param('salesnum')),
19                   'pre_options'   => [ '' => 'all',
20                                        0  => '(none)', ],
21                   'disable_empty' => 1,
22     &>
23
24     <& /elements/tr-select-cust_main-status.html,
25                   'label' => emt('Status'),
26     &>
27
28     <& /elements/tr-select-cust_class.html,
29                   'label'        => emt('Class'),
30                   'multiple'     => 1,
31                   'pre_options'  => [ '' => emt('(none)') ],
32                   'all_selected' => 1,
33     &>
34
35     <& /elements/tr-select-part_referral.html,
36                   'label'        => emt('Advertising Source'),
37                   'multiple'     => 1,
38                   #no, causes customers with disabled ones to disappear
39                   #'all_selected' => 1,
40     &>
41
42     <TR>
43         <TD ALIGN="right" VALIGN="center"><% mt('Signup date') |h %></TD>
44         <TD>
45         <TABLE>
46             <& /elements/tr-input-beginning_ending.html,
47                       prefix   => 'signupdate',
48                       layout   => 'horiz',
49             &>
50         </TABLE>
51         </TD>
52     </TR>
53
54 %    if ( $conf->exists('cust_main-enable_birthdate') ) {
55       <TR>
56           <TD ALIGN="right" VALIGN="center"><% mt('Date of Birth') |h %></TD>
57           <TD>
58           <TABLE>
59               <& /elements/tr-input-beginning_ending.html,
60                         prefix   => 'birthdate',
61                         layout   => 'horiz',
62               &>
63           </TABLE>
64           </TD>
65       </TR>
66 %   }
67
68 %    if ( $conf->exists('cust_main-enable_spouse_birthdate') ) {
69       <TR>
70           <TD ALIGN="right" VALIGN="center"><% mt('Spouse Date of Birth') |h %></TD>
71           <TD>
72           <TABLE>
73               <& /elements/tr-input-beginning_ending.html,
74                         prefix   => 'spouse_birthdate',
75                         layout   => 'horiz',
76               &>
77           </TABLE>
78           </TD>
79       </TR>
80 %   }
81
82 %    if ( $conf->exists('cust_main-enable_anniversary_date') ) {
83       <TR>
84           <TD ALIGN="right" VALIGN="center"><% mt('Anniversary Date') |h %></TD>
85           <TD>
86           <TABLE>
87               <& /elements/tr-input-beginning_ending.html,
88                         prefix   => 'anniversary_date',
89                         layout   => 'horiz',
90               &>
91           </TABLE>
92           </TD>
93       </TR>
94 %   }
95
96       <TR>
97         <TD ALIGN="right">Tags</TD>
98         <TD>
99             <& /elements/select-cust_tag.html,
100                           'cgi'         => $cgi,
101                           'is_report'   => 1,
102                           'multiple'    => 1,
103             &>
104           <DIV STYLE="display:inline-block; vertical-align:baseline">
105             <INPUT TYPE="radio" NAME="all_tags" VALUE="0" CHECKED> Any of these
106             <BR>
107             <INPUT TYPE="radio" NAME="all_tags" VALUE="1"> All of these
108           </DIV>
109         </TD>
110       </TR>
111
112     <TR>
113       <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
114     </TR>
115     <TR>
116       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Package search options') |h %></FONT></TH>
117     </TR>
118
119       <TR>
120         <TD ALIGN="right">With</TD>
121         <TD><SELECT NAME="any_pkg_status">
122               <OPTION VALUE="0">active packages
123               <OPTION VALUE="1">any status packages
124             </SELECT>
125         </TD>
126       </TR>
127
128       <TR>
129         <TD ALIGN="right">of class</TD>
130         <TD>
131             <& /elements/select-pkg_class.html,
132                           'field'       => 'pkg_classnum',
133                           'multiple'    => 1,
134             &>
135           <DIV STYLE="display:inline-block; vertical-align:baseline">
136             <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="0" CHECKED>
137               Any of these
138             <BR>
139             <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="1">
140               All of these
141           </DIV>
142         </TD>
143       </TR>
144
145     <TR>
146       <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
147     </TR>
148
149     <TR>
150       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Location search options') |h %></FONT></TH>
151     </TR>
152
153     <TR>
154       <TD ALIGN="right" VALIGN="center"><% mt('Address') |h %></TD>
155       <TD><INPUT TYPE="text" NAME="address" SIZE=54></TD>
156     </TR>
157
158     <TR>
159       <TD ALIGN="right" VALIGN="center"><% mt('City') |h %></TD>
160       <TD>
161         <& /elements/city.html,
162              disable_empty => 0,
163              empty_label   => '(all)',
164              disable_text  => 1,
165         &>
166       </TD>
167     </TR>
168
169     <TR>
170       <TD ALIGN="right" VALIGN="center"><% mt('County') |h %></TD>
171       <TD>
172         <& /elements/select-county.html,
173              disable_empty => 0,
174              empty_label   => '(all)',
175         &>
176       </TD>
177     </TR>
178     
179     <TR>
180       <TD ALIGN="right" VALIGN="center"><% mt('State') |h %></TD>
181       <TD>
182         <& /elements/select-state.html,
183              disable_empty => 0,
184              empty_label   => '(all)',
185         &>
186       </TD>
187     </TR>
188     
189     <TR>
190       <TD ALIGN="right" VALIGN="center"><% mt('Zip') |h %></TD>
191       <TD><INPUT TYPE="text" NAME="zip" SIZE=12></TD>
192     </TR>
193
194     <TR>
195       <TD ALIGN="right" VALIGN="center"><% mt('Country') |h %></TD>
196       <TD>
197         <& /elements/select-country.html,
198              disable_empty       => 0,
199              state_disable_empty => 0,
200              state_empty_label   => '(all)',
201         &>
202       </TD>
203     </TR>
204
205     <TR>
206       <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
207     </TR>
208
209     <TR>
210       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Billing search options') |h %></FONT></TH>
211     </TR>
212
213     <& /elements/tr-select-payby.html,
214                   'payby_type'   => 'cust',
215                   'multiple'     => 1,
216                   'all_selected' => 1,
217     &>
218
219     <TR>
220       <TD ALIGN="right"><% mt('Payment expiration before') |h %></TD>
221       <TD>
222         <SELECT NAME="paydate_month" DISABLED>
223 %         foreach my $month ( 1 .. 12 ) {
224             <OPTION VALUE="<% $month %>"><% $month %></OPTION>
225 %         }
226         </SELECT>
227         /
228         <SELECT NAME="paydate_year" onChange="paydate_year_changed(this);">
229           <OPTION VALUE=""></OPTION>
230 %         my $lastyear = (localtime(time))[5] + 1899;
231 %         foreach my $year ( $lastyear .. $lastyear+12 ) {
232             <OPTION VALUE="<% $year %>"><% $year %></OPTION>
233 %         }
234         </SELECT>
235       </TD>
236     </TR>
237
238     <SCRIPT TYPE="text/javascript">
239       function paydate_year_changed(what) {
240         var value = what.options[what.selectedIndex].value;
241         var month_select = what.form.paydate_month;
242         if ( value == '' ) {
243           month_select.disabled = true;
244         } else {
245           month_select.disabled = false;
246         }
247       }
248     </SCRIPT>
249
250 % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
251 % unless ( @exempt_groups ) { 
252
253 %   #falze laziness with With/Without postal mail invoices
254      <TR>
255       <TD ALIGN="right" VALIGN="center"><% mt('Tax exempt') |h %></TD>
256         <TD><INPUT TYPE="checkbox" NAME="tax" ID="tax" onClick="tax_changed();"></TD>
257     </TR>
258
259     <TR>
260       <TD ALIGN="right" VALIGN="center"><% mt('Not tax exempt') |h %></TD>
261         <TD><INPUT TYPE="checkbox" NAME="no_tax" ID="no_tax" onClick="no_tax_changed();"></TD>
262     </TR>
263
264     <SCRIPT TYPE="text/javascript">
265       function  tax_changed() {
266         if ( document.getElementById('tax').checked == true ) {
267           document.getElementById('no_tax').checked = false;
268         }
269       }
270       function no_tax_changed() {
271         if ( document.getElementById('no_tax').checked == true ) {
272           document.getElementById('tax').checked = false;
273         }
274       }
275     </SCRIPT>
276 % }
277
278     <TR>
279       <TD ALIGN="right"><% mt('Invoice terms') |h %></TD>
280       <TD>
281 %       my @agentnums = $FS::CurrentUser::CurrentUser->agentnums;
282 %       my $agentnum = scalar(@agentnums) == 1 ? $agentnums[0] : '';
283         <& /elements/select-terms.html,
284              'pre_options' => [ '' => emt('all') ],
285              'empty_value' => 'NULL',
286              'agentnum'    => $agentnum,
287         &>
288       </TD>
289     </TR>
290     
291     <& /elements/tr-input-lessthan_greaterthan.html,
292                   label   => emt('Current balance'),
293                   field   => 'current_balance',
294     &>
295
296     <TR>
297       <TD ALIGN="right" VALIGN="center"><% mt('With invoicing email address(es)') |h %></TD>
298         <TD><INPUT TYPE="checkbox" NAME="with_email"></TD>
299     </TR>
300
301     <TR>
302       <TD ALIGN="right" VALIGN="center"><% mt('With postal mail invoices') |h %></TD>
303         <TD><INPUT TYPE="checkbox" NAME="POST" ID="POST" onClick="POST_changed();"></TD>
304     </TR>
305
306     <TR>
307       <TD ALIGN="right" VALIGN="center"><% mt('Without postal mail invoices') |h %></TD>
308         <TD><INPUT TYPE="checkbox" NAME="no_POST" ID="no_POST" onClick="no_POST_changed();"></TD>
309     </TR>
310
311     <SCRIPT TYPE="text/javascript">
312       function POST_changed() {
313         if ( document.getElementById('POST').checked == true ) {
314           document.getElementById('no_POST').checked = false;
315         }
316       }
317       function no_POST_changed() {
318         if ( document.getElementById('no_POST').checked == true ) {
319           document.getElementById('POST').checked = false;
320         }
321       }
322     </SCRIPT>
323
324     <TR>
325       <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
326     </TR>
327
328     <TR>
329       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Display options') |h %></FONT></TH>
330     </TR>
331     <& /elements/tr-select-cust-fields.html &>
332
333     <TR>
334       <TD ALIGN="right" VALIGN="center"><% mt('Add package columns') |h %></TD>
335         <TD><INPUT TYPE="checkbox" NAME="flattened_pkgs"></TD>
336     </TR>
337
338     <TR>
339       <TD ALIGN="right" VALIGN="center"><% mt('Include cancelled packages') |h %></TD>
340         <TD><INPUT TYPE="checkbox" NAME="cancelled_pkgs"></TD>
341     </TR>
342
343   </TABLE>
344
345 <BR>
346 <INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
347
348 </FORM>
349
350 <& /elements/footer.html &>
351 <%init>
352
353 die "access denied"
354   unless $FS::CurrentUser::CurrentUser->access_right('Advanced customer search');
355
356 my $conf = new FS::Conf;
357
358 </%init>