default to a session cookie instead of setting an explicit timeout, weird timezone...
[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   <FONT CLASS="fsinnerbox-title"><% emt('Basic search options') %></FONT>
7   <TABLE CLASS="fsinnerbox">
8
9     <& /elements/tr-select-agent.html,
10                   'curr_value'    => scalar($cgi->param('agentnum')),
11                   'disable_empty' => 0,
12     &>
13
14     <& /elements/tr-select-sales.html,
15                   'curr_value'    => scalar($cgi->param('salesnum')),
16                   'pre_options'   => [ '' => 'all',
17                                        0  => '(none)', ],
18                   'disable_empty' => 1,
19                   'th' => 1,
20     &>
21
22     <& /elements/tr-select-cust_main-status.html,
23                   'label' => emt('Status'),
24     &>
25
26     <& /elements/tr-select-cust_class.html,
27                   'label'        => emt('Class'),
28                   'multiple'     => 1,
29                   'pre_options'  => [ '' => emt('(none)') ],
30                   'all_selected' => 1,
31     &>
32
33     <& /elements/tr-select-part_referral.html,
34                   'label'        => emt('Advertising Source'),
35                   'multiple'     => 1,
36                   #no, causes customers with disabled ones to disappear
37                   #'all_selected' => 1,
38     &>
39
40     <TR>
41         <TH ALIGN="right" VALIGN="center"><% mt('Signup date') |h %></TH>
42         <TD>
43         <TABLE>
44             <& /elements/tr-input-beginning_ending.html,
45                       prefix   => 'signupdate',
46                       layout   => 'horiz',
47             &>
48         </TABLE>
49         </TD>
50     </TR>
51
52 %    if ( $conf->exists('cust_main-enable_birthdate') ) {
53       <TR>
54           <TH ALIGN="right" VALIGN="center"><% mt('Date of Birth') |h %></TH>
55           <TD>
56           <TABLE>
57               <& /elements/tr-input-beginning_ending.html,
58                         prefix   => 'birthdate',
59                         layout   => 'horiz',
60               &>
61           </TABLE>
62           </TD>
63       </TR>
64 %   }
65
66 %    if ( $conf->exists('cust_main-enable_spouse_birthdate') ) {
67       <TR>
68           <TH ALIGN="right" VALIGN="center"><% mt('Spouse Date of Birth') |h %></TH>
69           <TD>
70           <TABLE>
71               <& /elements/tr-input-beginning_ending.html,
72                         prefix   => 'spouse_birthdate',
73                         layout   => 'horiz',
74               &>
75           </TABLE>
76           </TD>
77       </TR>
78 %   }
79
80 %    if ( $conf->exists('cust_main-enable_anniversary_date') ) {
81       <TR>
82           <TH ALIGN="right" VALIGN="center"><% mt('Anniversary Date') |h %></TH>
83           <TD>
84           <TABLE>
85               <& /elements/tr-input-beginning_ending.html,
86                         prefix   => 'anniversary_date',
87                         layout   => 'horiz',
88               &>
89           </TABLE>
90           </TD>
91       </TR>
92 %   }
93
94       <TR>
95         <TH ALIGN="right">Tags</TH>
96         <TD>
97             <& /elements/select-cust_tag.html,
98                           'cgi'         => $cgi,
99                           'is_report'   => 1,
100                           'multiple'    => 1,
101             &>
102           <DIV STYLE="display:inline-block; vertical-align:baseline">
103             <INPUT TYPE="radio" NAME="all_tags" VALUE="0" CHECKED> Any of these
104             <BR>
105             <INPUT TYPE="radio" NAME="all_tags" VALUE="all"> All of these
106             <BR>
107             <INPUT TYPE="radio" NAME="all_tags" VALUE="none"> None of these
108           </DIV>
109         </TD>
110       </TR>
111
112   </TABLE>
113   <BR>
114
115   <FONT CLASS="fsinnerbox-title"><% emt('Referral search options') %></FONT>
116   <TABLE CLASS="fsinnerbox">
117
118       <& /elements/tr-input-text.html,
119            label     => emt('At least this many'),
120            field     => 'with_referrals',
121            size      => 4,
122            maxlength => 4,
123       &>
124
125       <& /elements/tr-select-cust_main-status.html,
126            label => emt('Referral status'),
127            field => 'referral_status',
128       &>
129
130   </TABLE>
131   <BR>
132
133   <FONT CLASS="fsinnerbox-title"><% emt('Package search options') %></FONT>
134   <TABLE CLASS="fsinnerbox">
135
136       <TR>
137
138         <TH ALIGN="right">With</TH>
139         <TD><SELECT NAME="any_pkg_status">
140               <OPTION VALUE="0">active packages
141               <OPTION VALUE="1">any status packages
142             </SELECT>
143         </TD>
144      </TR>
145
146         <TH ALIGN="right">of class</TH>
147         <TD>
148             <& /elements/select-pkg_class.html,
149                           'field'       => 'pkg_classnum',
150                           'multiple'    => 1,
151             &>
152           <DIV STYLE="display:inline-block; vertical-align:baseline">
153             <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="0" CHECKED>
154               Any of these
155             <BR>
156             <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="1">
157               All of these
158           </DIV>
159         </TD>
160       </TR>
161
162   </TABLE>
163   <BR>
164
165   <FONT CLASS="fsinnerbox-title"><% emt('Location search options') %></FONT>
166   <TABLE CLASS="fsinnerbox">
167     <& elements/options_cust_location.html &>
168     <& elements/cust_main_phones.html &>
169   </TABLE>
170   <BR>
171
172   <FONT CLASS="fsinnerbox-title"><% emt('Contacts search options') %></FONT>
173   <TABLE CLASS="fsinnerbox">
174     <& elements/options_cust_contacts.html,
175         'pre_fix'   => 'contacts_',
176     &>
177   </TABLE>
178   <BR>
179
180   <FONT CLASS="fsinnerbox-title"><% emt('Billing search options') %></FONT>
181   <TABLE CLASS="fsinnerbox">
182
183 % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
184 % unless ( @exempt_groups ) { 
185
186 %   #falze laziness with With/Without postal mail invoices
187      <TR>
188       <TH ALIGN="right" VALIGN="center"><% mt('Tax exempt') |h %></TH>
189         <TD><INPUT TYPE="checkbox" NAME="tax" ID="tax" onClick="tax_changed();"></TD>
190     </TR>
191
192     <TR>
193       <TH ALIGN="right" VALIGN="center"><% mt('Not tax exempt') |h %></TH>
194         <TD><INPUT TYPE="checkbox" NAME="no_tax" ID="no_tax" onClick="no_tax_changed();"></TD>
195     </TR>
196
197     <SCRIPT TYPE="text/javascript">
198       function  tax_changed() {
199         if ( document.getElementById('tax').checked == true ) {
200           document.getElementById('no_tax').checked = false;
201         }
202       }
203       function no_tax_changed() {
204         if ( document.getElementById('no_tax').checked == true ) {
205           document.getElementById('tax').checked = false;
206         }
207       }
208     </SCRIPT>
209 % }
210
211     <TR>
212       <TH ALIGN="right"><% mt('Invoice terms') |h %></TH>
213       <TD>
214 %       my @agentnums = $FS::CurrentUser::CurrentUser->agentnums;
215 %       my $agentnum = scalar(@agentnums) == 1 ? $agentnums[0] : '';
216         <& /elements/select-terms.html,
217              'pre_options' => [ '' => emt('all') ],
218              'empty_value' => 'NULL',
219              'agentnum'    => $agentnum,
220         &>
221       </TD>
222     </TR>
223     
224     <& /elements/tr-input-lessthan_greaterthan.html,
225                   label   => emt('Current balance'),
226                   field   => 'current_balance',
227     &>
228
229     <TR>
230       <TH ALIGN="right" VALIGN="center"><% mt('With invoicing email address(es)') |h %></TH>
231         <TD><INPUT TYPE="checkbox" NAME="with_email"></TD>
232     </TR>
233
234     <TR>
235       <TH ALIGN="right" VALIGN="center"><% mt('With postal mail invoices') |h %></TH>
236         <TD><INPUT TYPE="checkbox" NAME="POST" ID="POST" onClick="POST_changed();"></TD>
237     </TR>
238
239     <TR>
240       <TH ALIGN="right" VALIGN="center"><% mt('Without postal mail invoices') |h %></TH>
241         <TD><INPUT TYPE="checkbox" NAME="no_POST" ID="no_POST" onClick="no_POST_changed();"></TD>
242     </TR>
243
244     <SCRIPT TYPE="text/javascript">
245       function POST_changed() {
246         if ( document.getElementById('POST').checked == true ) {
247           document.getElementById('no_POST').checked = false;
248         }
249       }
250       function no_POST_changed() {
251         if ( document.getElementById('no_POST').checked == true ) {
252           document.getElementById('POST').checked = false;
253         }
254       }
255     </SCRIPT>
256
257   </TABLE>
258   <BR>
259
260   <FONT CLASS="fsinnerbox-title"><% emt('Display options') %></FONT>
261   <TABLE CLASS="fsinnerbox">
262
263     <& /elements/tr-select-cust-fields.html &>
264
265     <TR>
266       <TH ALIGN="right" VALIGN="center"><% mt('Add package columns') |h %></TH>
267         <TD><INPUT TYPE="checkbox" NAME="flattened_pkgs"></TD>
268     </TR>
269
270     <TR>
271       <TH ALIGN="right" VALIGN="center"><% mt('Include cancelled packages') |h %></TH>
272         <TD><INPUT TYPE="checkbox" NAME="cancelled_pkgs"></TD>
273     </TR>
274
275   </TABLE>
276
277 <BR>
278 <INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
279
280 </FORM>
281
282 <& /elements/footer.html &>
283 <%init>
284
285 die "access denied"
286   unless $FS::CurrentUser::CurrentUser->access_right('Advanced customer search');
287
288 my $conf = new FS::Conf;
289
290 </%init>