agent-ize invoice_default_terms, RT#32513
[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('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('Address') |h %></TD>
44       <TD><INPUT TYPE="text" NAME="address" SIZE=54></TD>
45     </TR>
46
47     <TR>
48       <TD ALIGN="right" VALIGN="center"><% mt('County') |h %></TD>
49       <TD>
50         <& /elements/select-county.html,
51              disable_empty => 0,
52              empty_label   => '(all)',
53         &>
54       </TD>
55     </TR>
56     
57
58     <TR>
59       <TD ALIGN="right" VALIGN="center"><% mt('State') |h %></TD>
60       <TD>
61         <& /elements/select-state.html,
62              disable_empty => 0,
63              empty_label   => '(all)',
64         &>
65       </TD>
66     </TR>
67     
68     <TR>
69       <TD ALIGN="right" VALIGN="center"><% mt('Zip') |h %></TD>
70       <TD><INPUT TYPE="text" NAME="zip" SIZE=12></TD>
71     </TR>
72
73     <TR>
74       <TD ALIGN="right" VALIGN="center"><% mt('Country') |h %></TD>
75       <TD>
76         <& /elements/select-country.html,
77              disable_empty       => 0,
78              state_disable_empty => 0,
79              state_empty_label   => '(all)',
80         &>
81       </TD>
82     </TR>
83
84     <TR>
85         <TD ALIGN="right" VALIGN="center"><% mt('Signup date') |h %></TD>
86         <TD>
87         <TABLE>
88             <& /elements/tr-input-beginning_ending.html,
89                       prefix   => 'signupdate',
90                       layout   => 'horiz',
91             &>
92         </TABLE>
93         </TD>
94     </TR>
95
96 %    if ( $conf->exists('cust_main-enable_birthdate') ) {
97       <TR>
98           <TD ALIGN="right" VALIGN="center"><% mt('Date of Birth') |h %></TD>
99           <TD>
100           <TABLE>
101               <& /elements/tr-input-beginning_ending.html,
102                         prefix   => 'birthdate',
103                         layout   => 'horiz',
104               &>
105           </TABLE>
106           </TD>
107       </TR>
108 %   }
109
110 %    if ( $conf->exists('cust_main-enable_spouse_birthdate') ) {
111       <TR>
112           <TD ALIGN="right" VALIGN="center"><% mt('Spouse Date of Birth') |h %></TD>
113           <TD>
114           <TABLE>
115               <& /elements/tr-input-beginning_ending.html,
116                         prefix   => 'spouse_birthdate',
117                         layout   => 'horiz',
118               &>
119           </TABLE>
120           </TD>
121       </TR>
122 %   }
123
124 %    if ( $conf->exists('cust_main-enable_anniversary_date') ) {
125       <TR>
126           <TD ALIGN="right" VALIGN="center"><% mt('Anniversary Date') |h %></TD>
127           <TD>
128           <TABLE>
129               <& /elements/tr-input-beginning_ending.html,
130                         prefix   => 'anniversary_date',
131                         layout   => 'horiz',
132               &>
133           </TABLE>
134           </TD>
135       </TR>
136 %   }
137
138       <TR>
139         <TD ALIGN="right">Tags</TD>
140         <TD>
141             <& /elements/select-cust_tag.html,
142                           'cgi'         => $cgi,
143                           'is_report'   => 1,
144                           'multiple'    => 1,
145             &>
146           <DIV STYLE="display:inline-block; vertical-align:baseline">
147             <INPUT TYPE="radio" NAME="all_tags" VALUE="0" CHECKED> Any of these
148             <BR>
149             <INPUT TYPE="radio" NAME="all_tags" VALUE="1"> All of these
150           </DIV>
151         </TD>
152       </TR>
153
154       <TR>
155         <TD ALIGN="right">With package of class</TD>
156         <TD>
157             <& /elements/select-pkg_class.html,
158                           'field'       => 'pkg_classnum',
159                           'multiple'    => 1,
160             &>
161           <DIV STYLE="display:inline-block; vertical-align:baseline">
162             <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="0" CHECKED>
163               Any of these
164             <BR>
165             <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="1">
166               All of these
167           </DIV>
168         </TD>
169       </TR>
170
171     <& /elements/tr-select-payby.html,
172                   'payby_type'   => 'cust',
173                   'multiple'     => 1,
174                   'all_selected' => 1,
175     &>
176
177     <TR>
178       <TD ALIGN="right"><% mt('Payment expiration before') |h %></TD>
179       <TD>
180         <SELECT NAME="paydate_month" DISABLED>
181 %         foreach my $month ( 1 .. 12 ) {
182             <OPTION VALUE="<% $month %>"><% $month %></OPTION>
183 %         }
184         </SELECT>
185         /
186         <SELECT NAME="paydate_year" onChange="paydate_year_changed(this);">
187           <OPTION VALUE=""></OPTION>
188 %         my $lastyear = (localtime(time))[5] + 1899;
189 %         foreach my $year ( $lastyear .. $lastyear+12 ) {
190             <OPTION VALUE="<% $year %>"><% $year %></OPTION>
191 %         }
192         </SELECT>
193       </TD>
194     </TR>
195
196     <SCRIPT TYPE="text/javascript">
197       function paydate_year_changed(what) {
198         var value = what.options[what.selectedIndex].value;
199         var month_select = what.form.paydate_month;
200         if ( value == '' ) {
201           month_select.disabled = true;
202         } else {
203           month_select.disabled = false;
204         }
205       }
206     </SCRIPT>
207
208 % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
209 % unless ( @exempt_groups ) { 
210
211 %   #falze laziness with With/Without postal mail invoices
212      <TR>
213       <TD ALIGN="right" VALIGN="center"><% mt('Tax exempt') |h %></TD>
214         <TD><INPUT TYPE="checkbox" NAME="tax" ID="tax" onClick="tax_changed();"></TD>
215     </TR>
216
217     <TR>
218       <TD ALIGN="right" VALIGN="center"><% mt('Not tax exempt') |h %></TD>
219         <TD><INPUT TYPE="checkbox" NAME="no_tax" ID="no_tax" onClick="no_tax_changed();"></TD>
220     </TR>
221
222     <SCRIPT TYPE="text/javascript">
223       function  tax_changed() {
224         if ( document.getElementById('tax').checked == true ) {
225           document.getElementById('no_tax').checked = false;
226         }
227       }
228       function no_tax_changed() {
229         if ( document.getElementById('no_tax').checked == true ) {
230           document.getElementById('tax').checked = false;
231         }
232       }
233     </SCRIPT>
234 % }
235
236     <TR>
237       <TD ALIGN="right"><% mt('Invoice terms') |h %></TD>
238       <TD>
239 %       my @agentnums = $FS::CurrentUser::CurrentUser->agentnums;
240 %       my $agentnum = scalar(@agentnums) == 1 ? $agentnums[0] : '';
241         <& /elements/select-terms.html,
242              'pre_options' => [ '' => emt('all') ],
243              'empty_value' => 'NULL',
244              'agentnum'    => $agentnum,
245         &>
246       </TD>
247     </TR>
248     
249     <& /elements/tr-input-lessthan_greaterthan.html,
250                   label   => emt('Current balance'),
251                   field   => 'current_balance',
252     &>
253
254     <TR>
255       <TD ALIGN="right" VALIGN="center"><% mt('With email address(es)') |h %></TD>
256         <TD><INPUT TYPE="checkbox" NAME="with_email"></TD>
257     </TR>
258
259     <TR>
260       <TD ALIGN="right" VALIGN="center"><% mt('With postal mail invoices') |h %></TD>
261         <TD><INPUT TYPE="checkbox" NAME="POST" ID="POST" onClick="POST_changed();"></TD>
262     </TR>
263
264     <TR>
265       <TD ALIGN="right" VALIGN="center"><% mt('Without postal mail invoices') |h %></TD>
266         <TD><INPUT TYPE="checkbox" NAME="no_POST" ID="no_POST" onClick="no_POST_changed();"></TD>
267     </TR>
268
269     <SCRIPT TYPE="text/javascript">
270       function POST_changed() {
271         if ( document.getElementById('POST').checked == true ) {
272           document.getElementById('no_POST').checked = false;
273         }
274       }
275       function no_POST_changed() {
276         if ( document.getElementById('no_POST').checked == true ) {
277           document.getElementById('POST').checked = false;
278         }
279       }
280     </SCRIPT>
281
282     <TR>
283       <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
284     </TR>
285
286     <TR>
287       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Display options') |h %></FONT></TH>
288     </TR>
289     <& /elements/tr-select-cust-fields.html &>
290
291     <TR>
292       <TD ALIGN="right" VALIGN="center"><% mt('Add package columns') |h %></TD>
293         <TD><INPUT TYPE="checkbox" NAME="flattened_pkgs"></TD>
294     </TR>
295
296     <TR>
297       <TD ALIGN="right" VALIGN="center"><% mt('Include cancelled packages') |h %></TD>
298         <TD><INPUT TYPE="checkbox" NAME="cancelled_pkgs"></TD>
299     </TR>
300
301   </TABLE>
302
303 <BR>
304 <INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
305
306 </FORM>
307
308 <& /elements/footer.html &>
309 <%init>
310
311 die "access denied"
312   unless $FS::CurrentUser::CurrentUser->access_right('Advanced customer search');
313
314 my $conf = new FS::Conf;
315
316 </%init>