RT# 77532 - Updated advanced customer report to search contacts
[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="1"> All of these
106           </DIV>
107         </TD>
108       </TR>
109
110   </TABLE>
111   <BR>
112
113   <FONT CLASS="fsinnerbox-title"><% emt('Referral search options') %></FONT>
114   <TABLE CLASS="fsinnerbox">
115
116       <& /elements/tr-input-text.html,
117            label     => emt('At least this many'),
118            field     => 'with_referrals',
119            size      => 4,
120            maxlength => 4,
121       &>
122
123       <& /elements/tr-select-cust_main-status.html,
124            label => emt('Referral status'),
125            field => 'referral_status',
126       &>
127
128   </TABLE>
129   <BR>
130
131   <FONT CLASS="fsinnerbox-title"><% emt('Package search options') %></FONT>
132   <TABLE CLASS="fsinnerbox">
133
134       <TR>
135
136         <TH ALIGN="right">With</TH>
137         <TD><SELECT NAME="any_pkg_status">
138               <OPTION VALUE="0">active packages
139               <OPTION VALUE="1">any status packages
140             </SELECT>
141         </TD>
142      </TR>
143
144         <TH ALIGN="right">of class</TH>
145         <TD>
146             <& /elements/select-pkg_class.html,
147                           'field'       => 'pkg_classnum',
148                           'multiple'    => 1,
149             &>
150           <DIV STYLE="display:inline-block; vertical-align:baseline">
151             <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="0" CHECKED>
152               Any of these
153             <BR>
154             <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="1">
155               All of these
156           </DIV>
157         </TD>
158       </TR>
159
160   </TABLE>
161   <BR>
162
163   <FONT CLASS="fsinnerbox-title"><% emt('Location search options') %></FONT>
164   <TABLE CLASS="fsinnerbox">
165     <& elements/options_cust_location.html &>
166   </TABLE>
167   <BR>
168
169   <FONT CLASS="fsinnerbox-title"><% emt('Contacts search options') %></FONT>
170   <TABLE CLASS="fsinnerbox">
171     <& elements/options_cust_contacts.html,
172         'pre_fix'   => 'contacts_',
173     &>
174   </TABLE>
175   <BR>
176
177   <FONT CLASS="fsinnerbox-title"><% emt('Billing search options') %></FONT>
178   <TABLE CLASS="fsinnerbox">
179
180 % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
181 % unless ( @exempt_groups ) { 
182
183 %   #falze laziness with With/Without postal mail invoices
184      <TR>
185       <TH ALIGN="right" VALIGN="center"><% mt('Tax exempt') |h %></TH>
186         <TD><INPUT TYPE="checkbox" NAME="tax" ID="tax" onClick="tax_changed();"></TD>
187     </TR>
188
189     <TR>
190       <TH ALIGN="right" VALIGN="center"><% mt('Not tax exempt') |h %></TH>
191         <TD><INPUT TYPE="checkbox" NAME="no_tax" ID="no_tax" onClick="no_tax_changed();"></TD>
192     </TR>
193
194     <SCRIPT TYPE="text/javascript">
195       function  tax_changed() {
196         if ( document.getElementById('tax').checked == true ) {
197           document.getElementById('no_tax').checked = false;
198         }
199       }
200       function no_tax_changed() {
201         if ( document.getElementById('no_tax').checked == true ) {
202           document.getElementById('tax').checked = false;
203         }
204       }
205     </SCRIPT>
206 % }
207
208     <TR>
209       <TH ALIGN="right"><% mt('Invoice terms') |h %></TH>
210       <TD>
211 %       my @agentnums = $FS::CurrentUser::CurrentUser->agentnums;
212 %       my $agentnum = scalar(@agentnums) == 1 ? $agentnums[0] : '';
213         <& /elements/select-terms.html,
214              'pre_options' => [ '' => emt('all') ],
215              'empty_value' => 'NULL',
216              'agentnum'    => $agentnum,
217         &>
218       </TD>
219     </TR>
220     
221     <& /elements/tr-input-lessthan_greaterthan.html,
222                   label   => emt('Current balance'),
223                   field   => 'current_balance',
224     &>
225
226     <TR>
227       <TH ALIGN="right" VALIGN="center"><% mt('With invoicing email address(es)') |h %></TH>
228         <TD><INPUT TYPE="checkbox" NAME="with_email"></TD>
229     </TR>
230
231     <TR>
232       <TH ALIGN="right" VALIGN="center"><% mt('With postal mail invoices') |h %></TH>
233         <TD><INPUT TYPE="checkbox" NAME="POST" ID="POST" onClick="POST_changed();"></TD>
234     </TR>
235
236     <TR>
237       <TH ALIGN="right" VALIGN="center"><% mt('Without postal mail invoices') |h %></TH>
238         <TD><INPUT TYPE="checkbox" NAME="no_POST" ID="no_POST" onClick="no_POST_changed();"></TD>
239     </TR>
240
241     <SCRIPT TYPE="text/javascript">
242       function POST_changed() {
243         if ( document.getElementById('POST').checked == true ) {
244           document.getElementById('no_POST').checked = false;
245         }
246       }
247       function no_POST_changed() {
248         if ( document.getElementById('no_POST').checked == true ) {
249           document.getElementById('POST').checked = false;
250         }
251       }
252     </SCRIPT>
253
254   </TABLE>
255   <BR>
256
257   <FONT CLASS="fsinnerbox-title"><% emt('Display options') %></FONT>
258   <TABLE CLASS="fsinnerbox">
259
260     <& /elements/tr-select-cust-fields.html &>
261
262     <TR>
263       <TH ALIGN="right" VALIGN="center"><% mt('Add package columns') |h %></TH>
264         <TD><INPUT TYPE="checkbox" NAME="flattened_pkgs"></TD>
265     </TR>
266
267     <TR>
268       <TH ALIGN="right" VALIGN="center"><% mt('Include cancelled packages') |h %></TH>
269         <TD><INPUT TYPE="checkbox" NAME="cancelled_pkgs"></TD>
270     </TR>
271
272   </TABLE>
273
274 <BR>
275 <INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
276
277 </FORM>
278
279 <& /elements/footer.html &>
280 <%init>
281
282 die "access denied"
283   unless $FS::CurrentUser::CurrentUser->access_right('Advanced customer search');
284
285 my $conf = new FS::Conf;
286
287 </%init>