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