RT# 77532 - can search cust main phone numbers in advanced customer search
[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="all"> All of these
108             <BR>
109             <INPUT TYPE="radio" NAME="all_tags" VALUE="none"> None of these
110           </DIV>
111         </TD>
112       </TR>
113
114     <TR>
115       <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
116     </TR>
117     <TR>
118       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Referral search options') |h %></FONT></TH>
119     </TR>
120
121       <& /elements/tr-input-text.html,
122            label     => emt('At least this many'),
123            field     => 'with_referrals',
124            size      => 4,
125            maxlength => 4,
126       &>
127
128       <& /elements/tr-select-cust_main-status.html,
129            label => emt('Referral status'),
130            field => 'referral_status',
131       &>
132
133     <TR>
134       <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
135     </TR>
136     <TR>
137       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Package search options') |h %></FONT></TH>
138     </TR>
139
140       <TR>
141         <TD ALIGN="right">With</TD>
142         <TD><SELECT NAME="any_pkg_status">
143               <OPTION VALUE="0">active packages
144               <OPTION VALUE="1">any status packages
145             </SELECT>
146         </TD>
147       </TR>
148
149       <TR>
150         <TD ALIGN="right">of class</TD>
151         <TD>
152             <& /elements/select-pkg_class.html,
153                           'field'       => 'pkg_classnum',
154                           'multiple'    => 1,
155             &>
156           <DIV STYLE="display:inline-block; vertical-align:baseline">
157             <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="0" CHECKED>
158               Any of these
159             <BR>
160             <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="1">
161               All of these
162           </DIV>
163         </TD>
164       </TR>
165
166     <TR>
167       <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
168     </TR>
169
170     <TR>
171       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Location search options') |h %></FONT></TH>
172     </TR>
173
174     <TR>
175       <TD ALIGN="right" VALIGN="center"><% mt('Address') |h %></TD>
176       <TD><INPUT TYPE="text" NAME="address" SIZE=54></TD>
177     </TR>
178
179     <TR>
180       <TD ALIGN="right" VALIGN="center"><% mt('City') |h %></TD>
181       <TD>
182         <& /elements/city.html,
183              disable_empty => 0,
184              empty_label   => '(all)',
185              disable_text  => 1,
186         &>
187       </TD>
188     </TR>
189
190     <TR>
191       <TD ALIGN="right" VALIGN="center"><% mt('County') |h %></TD>
192       <TD>
193         <& /elements/select-county.html,
194              disable_empty => 0,
195              empty_label   => '(all)',
196         &>
197       </TD>
198     </TR>
199     
200     <TR>
201       <TD ALIGN="right" VALIGN="center"><% mt('State') |h %></TD>
202       <TD>
203         <& /elements/select-state.html,
204              disable_empty => 0,
205              empty_label   => '(all)',
206         &>
207       </TD>
208     </TR>
209     
210     <TR>
211       <TD ALIGN="right" VALIGN="center"><% mt('Zip') |h %></TD>
212       <TD><INPUT TYPE="text" NAME="zip" SIZE=12></TD>
213     </TR>
214
215     <TR>
216       <TD ALIGN="right" VALIGN="center"><% mt('Country') |h %></TD>
217       <TD>
218         <& /elements/select-country.html,
219              disable_empty       => 0,
220              state_disable_empty => 0,
221              state_empty_label   => '(all)',
222         &>
223       </TD>
224     </TR>
225
226     <& elements/cust_main_phones.html &>
227
228     <TR>
229       <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
230     </TR>
231
232     <TR>
233       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% emt('Contacts search options') %></FONT></TH>
234     </TR>
235
236     <& elements/options_cust_contacts.html,
237       'pre_fix'   => 'contacts_',
238     &>
239
240     <TR>
241       <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
242     </TR>
243
244     <TR>
245       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Billing search options') |h %></FONT></TH>
246     </TR>
247
248     <& /elements/tr-select-payby.html,
249                   'payby_type'   => 'cust',
250                   'multiple'     => 1,
251                   'all_selected' => 1,
252     &>
253
254     <TR>
255       <TD ALIGN="right"><% mt('Payment expiration before') |h %></TD>
256       <TD>
257         <SELECT NAME="paydate_month" DISABLED>
258 %         foreach my $month ( 1 .. 12 ) {
259             <OPTION VALUE="<% $month %>"><% $month %></OPTION>
260 %         }
261         </SELECT>
262         /
263         <SELECT NAME="paydate_year" onChange="paydate_year_changed(this);">
264           <OPTION VALUE=""></OPTION>
265 %         my $lastyear = (localtime(time))[5] + 1899;
266 %         foreach my $year ( $lastyear .. $lastyear+12 ) {
267             <OPTION VALUE="<% $year %>"><% $year %></OPTION>
268 %         }
269         </SELECT>
270       </TD>
271     </TR>
272
273     <SCRIPT TYPE="text/javascript">
274       function paydate_year_changed(what) {
275         var value = what.options[what.selectedIndex].value;
276         var month_select = what.form.paydate_month;
277         if ( value == '' ) {
278           month_select.disabled = true;
279         } else {
280           month_select.disabled = false;
281         }
282       }
283     </SCRIPT>
284
285 % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
286 % unless ( @exempt_groups ) { 
287
288 %   #falze laziness with With/Without postal mail invoices
289      <TR>
290       <TD ALIGN="right" VALIGN="center"><% mt('Tax exempt') |h %></TD>
291         <TD><INPUT TYPE="checkbox" NAME="tax" ID="tax" onClick="tax_changed();"></TD>
292     </TR>
293
294     <TR>
295       <TD ALIGN="right" VALIGN="center"><% mt('Not tax exempt') |h %></TD>
296         <TD><INPUT TYPE="checkbox" NAME="no_tax" ID="no_tax" onClick="no_tax_changed();"></TD>
297     </TR>
298
299     <SCRIPT TYPE="text/javascript">
300       function  tax_changed() {
301         if ( document.getElementById('tax').checked == true ) {
302           document.getElementById('no_tax').checked = false;
303         }
304       }
305       function no_tax_changed() {
306         if ( document.getElementById('no_tax').checked == true ) {
307           document.getElementById('tax').checked = false;
308         }
309       }
310     </SCRIPT>
311 % }
312
313     <TR>
314       <TD ALIGN="right"><% mt('Invoice terms') |h %></TD>
315       <TD>
316 %       my @agentnums = $FS::CurrentUser::CurrentUser->agentnums;
317 %       my $agentnum = scalar(@agentnums) == 1 ? $agentnums[0] : '';
318         <& /elements/select-terms.html,
319              'pre_options' => [ '' => emt('all') ],
320              'empty_value' => 'NULL',
321              'agentnum'    => $agentnum,
322         &>
323       </TD>
324     </TR>
325     
326     <& /elements/tr-input-lessthan_greaterthan.html,
327                   label   => emt('Current balance'),
328                   field   => 'current_balance',
329     &>
330
331     <TR>
332       <TD ALIGN="right" VALIGN="center"><% mt('With invoicing email address(es)') |h %></TD>
333         <TD><INPUT TYPE="checkbox" NAME="with_email"></TD>
334     </TR>
335
336     <TR>
337       <TD ALIGN="right" VALIGN="center"><% mt('With postal mail invoices') |h %></TD>
338         <TD><INPUT TYPE="checkbox" NAME="POST" ID="POST" onClick="POST_changed();"></TD>
339     </TR>
340
341     <TR>
342       <TD ALIGN="right" VALIGN="center"><% mt('Without postal mail invoices') |h %></TD>
343         <TD><INPUT TYPE="checkbox" NAME="no_POST" ID="no_POST" onClick="no_POST_changed();"></TD>
344     </TR>
345
346     <SCRIPT TYPE="text/javascript">
347       function POST_changed() {
348         if ( document.getElementById('POST').checked == true ) {
349           document.getElementById('no_POST').checked = false;
350         }
351       }
352       function no_POST_changed() {
353         if ( document.getElementById('no_POST').checked == true ) {
354           document.getElementById('POST').checked = false;
355         }
356       }
357     </SCRIPT>
358
359     <TR>
360       <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
361     </TR>
362
363     <TR>
364       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Display options') |h %></FONT></TH>
365     </TR>
366     <& /elements/tr-select-cust-fields.html &>
367
368     <TR>
369       <TD ALIGN="right" VALIGN="center"><% mt('Add package columns') |h %></TD>
370         <TD><INPUT TYPE="checkbox" NAME="flattened_pkgs"></TD>
371     </TR>
372
373     <TR>
374       <TD ALIGN="right" VALIGN="center"><% mt('Include cancelled packages') |h %></TD>
375         <TD><INPUT TYPE="checkbox" NAME="cancelled_pkgs"></TD>
376     </TR>
377
378     <TR>
379       <TH ALIGN="right" VALIGN="center"><% mt('Search historical addresses') %></TH>
380       <TD><INPUT TYPE="checkbox" NAME="location_history" VALUE="1"></TD>
381
382   </TABLE>
383
384 <BR>
385 <INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
386
387 </FORM>
388
389 <& /elements/footer.html &>
390 <%init>
391
392 die "access denied"
393   unless $FS::CurrentUser::CurrentUser->access_right('Advanced customer search');
394
395 my $conf = new FS::Conf;
396
397 </%init>