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