1 <& /elements/header.html, mt($title, @title_arg) &>
3 <FORM ACTION="cust_pkg.cgi" METHOD="GET">
4 <INPUT TYPE="hidden" NAME="magic" VALUE="bill">
5 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
7 % unless ( $custnum ) {
9 <FONT CLASS="fsinnerbox-title"><% emt('Customer search options') %></FONT>
10 <TABLE CLASS="fsinnerbox">
12 <& /elements/tr-select-agent.html,
13 'curr_value' => scalar( $cgi->param('agentnum') ),
15 'onchange' => 'agent_changed(this)',
18 <& /elements/tr-select-cust_main-status.html,
19 'label' => 'Customer status',
20 'field' => 'cust_status',
23 <SCRIPT TYPE="text/javascript">
25 function agent_changed(what) {
26 % # update sales dropdowns
27 salesnum_agentnum_changed(what);
28 cust_main_salesnum_agentnum_changed(what);
31 <&| /elements/onload.js &>
32 agent_changed(document.getElementById('agentnum'))
37 <& /elements/tr-select-sales.html,
38 'label' => 'Customer sales person',
39 'element_name' => 'cust_main_salesnum',
40 'id' => 'cust_main_salesnum',
41 'curr_value' => scalar($cgi->param('cust_main_salesnum')),
42 'pre_options' => [ '' => 'all',
52 <FONT CLASS="fsinnerbox-title"><% emt('Package search options') %></FONT>
53 <TABLE CLASS="fsinnerbox">
55 <& /elements/tr-select-sales.html,
56 'label' => 'Package sales person',
57 'curr_value' => scalar($cgi->param('salesnum')),
58 'pre_options' => [ '' => 'all',
63 <& /elements/tr-select-cust_pkg-status.html,
64 'label' => 'Package status',
65 'onchange' => 'status_changed(this);',
68 <& /elements/tr-select-reason.html,
69 'field' => 'reasonnum',
70 'reason_class' => 'S',
71 'label' => 'Suspended Reason',
72 'label_id' => 'reasonnum_label',
76 'control_button' => 'confirm_suspend_cust_button',
77 'pre_options' => [ 0 => 'all' ],
80 <SCRIPT TYPE="text/javascript">
82 function status_changed(what) {
84 if (what.options[what.selectedIndex].value == 'suspended') {
85 document.getElementById('reasonnum_row').style.visibility = 'visible';
88 document.getElementById('reasonnum_row').style.visibility = 'collapse';
91 % foreach my $status ( '', FS::cust_pkg->statuses() ) {
93 if ( what.options[what.selectedIndex].value == '<% $status %>' ) {
95 % foreach my $field (@date_fields) {
96 % if ( $disable{$status}->{$field} ) {
98 what.form.<% $field %>_beginning_text.disabled = true;
99 what.form.<% $field %>_ending_text.disabled = true;
100 what.form.<% $field %>_null.disabled = true;
101 what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
102 what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
104 what.form.<% $field %>_beginning_button.style.display = 'none';
105 what.form.<% $field %>_ending_button.style.display = 'none';
106 what.form.<% $field %>_beginning_disabled.style.display = '';
107 what.form.<% $field %>_ending_disabled.style.display = '';
111 what.form.<% $field %>_null.disabled = false;
113 if ( ! what.form.<% $field %>_null.checked ) {
115 what.form.<% $field %>_beginning_text.disabled = false;
116 what.form.<% $field %>_ending_text.disabled = false;
117 what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
118 what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
120 what.form.<% $field %>_beginning_button.style.display = '';
121 what.form.<% $field %>_ending_button.style.display = '';
122 what.form.<% $field %>_beginning_disabled.style.display = 'none';
123 what.form.<% $field %>_ending_disabled.style.display = 'none';
136 % foreach my $field (@date_fields) {
138 function <% $field %>_null_changed(what) {
140 if ( what.checked ) {
141 what.form.<% $field %>_beginning_text.disabled = true;
142 what.form.<% $field %>_ending_text.disabled = true;
143 what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
144 what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
145 what.form.<% $field %>_beginning_button.style.display = 'none';
146 what.form.<% $field %>_ending_button.style.display = 'none';
147 what.form.<% $field %>_beginning_disabled.style.display = '';
148 what.form.<% $field %>_ending_disabled.style.display = '';
151 what.form.<% $field %>_beginning_text.disabled = false;
152 what.form.<% $field %>_ending_text.disabled = false;
153 what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
154 what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
156 what.form.<% $field %>_beginning_button.style.display = '';
157 what.form.<% $field %>_ending_button.style.display = '';
158 what.form.<% $field %>_beginning_disabled.style.display = 'none';
159 what.form.<% $field %>_ending_disabled.style.display = 'none';
169 <& /elements/tr-select-pkg_class.html,
170 'pre_options' => [ '0' => 'all' ],
171 'empty_label' => '(empty class)',
174 % if ( scalar( qsearch( 'part_pkg_report_option', { 'disabled' => '' } ) ) ) {
176 <& /elements/tr-select-table.html,
177 'label' => 'Report classes',
178 'table' => 'part_pkg_report_option',
179 'name_col' => 'name',
180 'hashref' => { 'disabled' => '' },
181 'element_name' => 'report_option',
182 'multiple' => 'multiple',
191 <TD>From date <i>(m/d/y)</i></TD>
192 <TD>To date <i>(m/d/y)</i></TD>
196 % foreach my $field (@date_fields) {
199 <TD ALIGN="right" VALIGN="center"><% $label{$field} %></TD>
200 % foreach (qw(beginning ending)) {
202 <& /elements/input-date-field.html, {
203 'name' => $field.'_'.$_,
206 'format' => '%m/%d/%Y',
212 <& /elements/checkbox.html,
213 'field' => $field.'_null',
215 'onchange' => $field.'_null_changed',
224 <SCRIPT TYPE="text/javascript">
226 function custom_changed(what) {
228 if ( what.checked ) {
230 what.form.pkgpart.disabled = true;
231 what.form.pkgpart.style.backgroundColor = '#dddddd';
235 what.form.pkgpart.disabled = false;
236 what.form.pkgpart.style.backgroundColor = '#ffffff';
244 <& /elements/tr-checkbox.html,
245 'label' => 'Custom packages',
248 'onchange' => 'custom_changed(this);',
251 <& /elements/tr-selectmultiple-part_pkg.html &>
256 <FONT CLASS="fsinnerbox-title"><% emt('Location search options') %></FONT>
257 <TABLE CLASS="fsinnerbox">
259 % my @location_options = qw(cust nocust census nocensus);
260 % if ( $conf->config('tax_data_vendor') eq 'cch' ) {
261 % push @location_options, 'geocode', 'nogeocode';
263 <& /elements/tr-checkbox-multiple.html,
264 'label' => 'Where package location:',
266 'options' => \@location_options,
267 'labels' => { 'cust' => "is the customer's default location",
268 'nocust' => "is not the customer's default location",
269 'census' => "has a census tract",
270 'nocensus' => "does not have a census tract",
271 'nogeocode'=> 'has an implicit tax location',
272 'geocode' => 'has a hardcoded tax location',
274 'value' => { map { $_ => 0 } @location_options },
280 <FONT CLASS="fsinnerbox-title"><% emt('Display options') %></FONT>
281 <TABLE CLASS="fsinnerbox">
283 <& /elements/tr-select-cust-fields.html &>
288 <INPUT TYPE="submit" VALUE="Get Report">
292 <% include('/elements/footer.html') %>
296 unless $FS::CurrentUser::CurrentUser->access_right('List packages');
298 my $title = 'Package Report';
299 #false laziness w/report_cust_bill.html
303 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
305 my $cust_main = qsearchs({
306 'table' => 'cust_main',
307 'hashref' => { 'custnum' => $custnum },
308 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
309 }) or die "unknown custnum $custnum";
311 push @title_arg, $cust_main->name;
317 tie my %label, 'Tie::IxHash',
319 'last_bill' => 'Last bill',
320 'bill' => 'Next bill',
321 'adjourn' => 'Adjourns',
322 'susp' => 'Suspended',
323 'dundate' => 'Suspension delayed until',
324 'expire' => 'Expires',
325 'contract_end' => 'Contract ends',
326 'change_date' => 'Changed from other package',
327 'cancel' => 'Cancelled',
329 my @date_fields = keys %label;
331 #false laziness w/cust_pkg.cgi
334 'on hold' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'expire'=>1, 'cancel'=>1, 'dundate'=> 1, },
335 'not yet billed' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'dundate'=>1, },
336 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'contract_end'=>1, 'dundate'=>1, },
337 'active' => { 'susp'=>1, 'cancel'=>1 },
338 'suspended' => { 'cancel'=>1, 'dundate'=>1, },
354 my $conf = FS::Conf->new;