advanced customer report: search by package class, #25531
[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('Zip') |h %></TD>
49       <TD><INPUT TYPE="text" NAME="zip" SIZE=12></TD>
50     </TR>
51
52     <TR>
53         <TD ALIGN="right" VALIGN="center"><% mt('Signup date') |h %></TD>
54         <TD>
55         <TABLE>
56             <& /elements/tr-input-beginning_ending.html,
57                       prefix   => 'signupdate',
58                       layout   => 'horiz',
59             &>
60         </TABLE>
61         </TD>
62     </TR>
63
64 %    if ( $conf->exists('cust_main-enable_birthdate') ) {
65       <TR>
66           <TD ALIGN="right" VALIGN="center"><% mt('Date of Birth') |h %></TD>
67           <TD>
68           <TABLE>
69               <& /elements/tr-input-beginning_ending.html,
70                         prefix   => 'birthdate',
71                         layout   => 'horiz',
72               &>
73           </TABLE>
74           </TD>
75       </TR>
76 %   }
77
78 %    if ( $conf->exists('cust_main-enable_spouse_birthdate') ) {
79       <TR>
80           <TD ALIGN="right" VALIGN="center"><% mt('Spouse Date of Birth') |h %></TD>
81           <TD>
82           <TABLE>
83               <& /elements/tr-input-beginning_ending.html,
84                         prefix   => 'spouse_birthdate',
85                         layout   => 'horiz',
86               &>
87           </TABLE>
88           </TD>
89       </TR>
90 %   }
91
92 %    if ( $conf->exists('cust_main-enable_anniversary_date') ) {
93       <TR>
94           <TD ALIGN="right" VALIGN="center"><% mt('Anniversary Date') |h %></TD>
95           <TD>
96           <TABLE>
97               <& /elements/tr-input-beginning_ending.html,
98                         prefix   => 'anniversary_date',
99                         layout   => 'horiz',
100               &>
101           </TABLE>
102           </TD>
103       </TR>
104 %   }
105
106       <TR>
107         <TD ALIGN="right">Tags</TD>
108         <TD>
109             <& /elements/select-cust_tag.html,
110                           'cgi'         => $cgi,
111                           'is_report'   => 1,
112                           'multiple'    => 1,
113             &>
114           <DIV STYLE="display:inline-block; vertical-align:baseline">
115             <INPUT TYPE="radio" NAME="all_tags" VALUE="0" CHECKED> Any of these
116             <BR>
117             <INPUT TYPE="radio" NAME="all_tags" VALUE="1"> All of these
118           </DIV>
119         </TD>
120       </TR>
121
122       <TR>
123         <TD ALIGN="right">With package of class</TD>
124         <TD>
125             <& /elements/select-pkg_class.html,
126                           'field'       => 'pkg_classnum',
127                           'multiple'    => 1,
128             &>
129           <DIV STYLE="display:inline-block; vertical-align:baseline">
130             <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="0" CHECKED>
131               Any of these
132             <BR>
133             <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="1">
134               All of these
135           </DIV>
136         </TD>
137       </TR>
138
139     <& /elements/tr-select-payby.html,
140                   'payby_type'   => 'cust',
141                   'multiple'     => 1,
142                   'all_selected' => 1,
143     &>
144
145     <TR>
146       <TD ALIGN="right"><% mt('Payment expiration before') |h %></TD>
147       <TD>
148         <SELECT NAME="paydate_month" DISABLED>
149 %         foreach my $month ( 1 .. 12 ) {
150             <OPTION VALUE="<% $month %>"><% $month %></OPTION>
151 %         }
152         </SELECT>
153         /
154         <SELECT NAME="paydate_year" onChange="paydate_year_changed(this);">
155           <OPTION VALUE=""></OPTION>
156 %         my $lastyear = (localtime(time))[5] + 1899;
157 %         foreach my $year ( $lastyear .. $lastyear+12 ) {
158             <OPTION VALUE="<% $year %>"><% $year %></OPTION>
159 %         }
160         </SELECT>
161       </TD>
162     </TR>
163
164     <SCRIPT TYPE="text/javascript">
165       function paydate_year_changed(what) {
166         var value = what.options[what.selectedIndex].value;
167         var month_select = what.form.paydate_month;
168         if ( value == '' ) {
169           month_select.disabled = true;
170         } else {
171           month_select.disabled = false;
172         }
173       }
174     </SCRIPT>
175  
176     <TR>
177       <TD ALIGN="right"><% mt('Invoice terms') |h %></TD>
178       <TD>
179         <& /elements/select-terms.html,
180                       'pre_options' => [ '' => emt('all') ],
181                       'empty_value' => 'NULL',
182         &>
183       </TD>
184     </TR>
185     
186     <& /elements/tr-input-lessthan_greaterthan.html,
187                   label   => emt('Current balance'),
188                   field   => 'current_balance',
189     &>
190
191     <TR>
192       <TD ALIGN="right" VALIGN="center"><% mt('With email address(es)') |h %></TD>
193         <TD><INPUT TYPE="checkbox" NAME="with_email"></TD>
194     </TR>
195
196     <TR>
197       <TD ALIGN="right" VALIGN="center"><% mt('With postal mail invoices') |h %></TD>
198         <TD><INPUT TYPE="checkbox" NAME="POST" ID="POST" onClick="POST_changed();"></TD>
199     </TR>
200
201     <TR>
202       <TD ALIGN="right" VALIGN="center"><% mt('Without postal mail invoices') |h %></TD>
203         <TD><INPUT TYPE="checkbox" NAME="no_POST" ID="no_POST" onClick="no_POST_changed();"></TD>
204     </TR>
205
206     <SCRIPT TYPE="text/javascript">
207       function POST_changed() {
208         if ( document.getElementById('POST').checked == true ) {
209           document.getElementById('no_POST').checked = false;
210         }
211       }
212       function no_POST_changed() {
213         if ( document.getElementById('no_POST').checked == true ) {
214           document.getElementById('POST').checked = false;
215         }
216       }
217     </SCRIPT>
218
219     <TR>
220       <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
221     </TR>
222
223     <TR>
224       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Display options') |h %></FONT></TH>
225     </TR>
226     <& /elements/tr-select-cust-fields.html &>
227
228     <TR>
229       <TD ALIGN="right" VALIGN="center"><% mt('Add package columns') |h %></TD>
230         <TD><INPUT TYPE="checkbox" NAME="flattened_pkgs"></TD>
231     </TR>
232
233     <TR>
234       <TD ALIGN="right" VALIGN="center"><% mt('Include cancelled packages') |h %></TD>
235         <TD><INPUT TYPE="checkbox" NAME="cancelled_pkgs"></TD>
236     </TR>
237
238   </TABLE>
239
240 <BR>
241 <INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
242
243 </FORM>
244
245 <& /elements/footer.html &>
246 <%init>
247
248 die "access denied"
249   unless $FS::CurrentUser::CurrentUser->access_right('Advanced customer search');
250
251 my $conf = new FS::Conf;
252
253 </%init>