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