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 <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
11 <& /elements/tr-title.html, value => mt('Customer search options') &>
13 <& /elements/tr-select-agent.html,
14 'curr_value' => scalar( $cgi->param('agentnum') ),
16 'onchange' => 'agent_changed(this)',
19 <& /elements/tr-select-cust_main-status.html,
20 'label' => 'Customer status',
21 'field' => 'cust_status',
24 <SCRIPT TYPE="text/javascript">
26 function agent_changed(what) {
27 % # update sales dropdowns
28 salesnum_agentnum_changed(what);
29 cust_main_salesnum_agentnum_changed(what);
32 <&| /elements/onload.js &>
33 agent_changed(document.getElementById('agentnum'))
38 <& /elements/tr-select-sales.html,
39 'label' => 'Customer sales person',
40 'element_name' => 'cust_main_salesnum',
41 'id' => 'cust_main_salesnum',
42 'curr_value' => scalar($cgi->param('cust_main_salesnum')),
43 'pre_options' => [ '' => 'all',
53 <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
55 <& /elements/tr-title.html, value => mt('Package search options') &>
57 <& /elements/tr-select-sales.html,
58 'label' => 'Package sales person',
59 'curr_value' => scalar($cgi->param('salesnum')),
60 'pre_options' => [ '' => 'all',
65 <& /elements/tr-select-cust_pkg-status.html,
66 'label' => 'Package status',
67 'onchange' => 'status_changed(this);',
70 <& /elements/tr-select-reason.html,
71 'field' => 'reasonnum',
72 'reason_class' => 'S',
73 'label' => 'Suspended Reason',
74 'label_id' => 'reasonnum_label',
78 'control_button' => 'confirm_suspend_cust_button',
79 'pre_options' => [ 0 => 'all' ],
82 <SCRIPT TYPE="text/javascript">
84 function status_changed(what) {
86 if (what.options[what.selectedIndex].value == 'suspended') {
87 document.getElementById('reasonnum_row').style.visibility = 'visible';
90 document.getElementById('reasonnum_row').style.visibility = 'collapse';
93 % foreach my $status ( '', FS::cust_pkg->statuses() ) {
95 if ( what.options[what.selectedIndex].value == '<% $status %>' ) {
97 % foreach my $field (@date_fields) {
98 % if ( $disable{$status}->{$field} ) {
100 what.form.<% $field %>_beginning_text.disabled = true;
101 what.form.<% $field %>_ending_text.disabled = true;
102 what.form.<% $field %>_null.disabled = true;
103 what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
104 what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
106 what.form.<% $field %>_beginning_button.style.display = 'none';
107 what.form.<% $field %>_ending_button.style.display = 'none';
108 what.form.<% $field %>_beginning_disabled.style.display = '';
109 what.form.<% $field %>_ending_disabled.style.display = '';
113 what.form.<% $field %>_null.disabled = false;
115 if ( ! what.form.<% $field %>_null.checked ) {
117 what.form.<% $field %>_beginning_text.disabled = false;
118 what.form.<% $field %>_ending_text.disabled = false;
119 what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
120 what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
122 what.form.<% $field %>_beginning_button.style.display = '';
123 what.form.<% $field %>_ending_button.style.display = '';
124 what.form.<% $field %>_beginning_disabled.style.display = 'none';
125 what.form.<% $field %>_ending_disabled.style.display = 'none';
138 % foreach my $field (@date_fields) {
140 function <% $field %>_null_changed(what) {
142 if ( what.checked ) {
143 what.form.<% $field %>_beginning_text.disabled = true;
144 what.form.<% $field %>_ending_text.disabled = true;
145 what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
146 what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
147 what.form.<% $field %>_beginning_button.style.display = 'none';
148 what.form.<% $field %>_ending_button.style.display = 'none';
149 what.form.<% $field %>_beginning_disabled.style.display = '';
150 what.form.<% $field %>_ending_disabled.style.display = '';
153 what.form.<% $field %>_beginning_text.disabled = false;
154 what.form.<% $field %>_ending_text.disabled = false;
155 what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
156 what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
158 what.form.<% $field %>_beginning_button.style.display = '';
159 what.form.<% $field %>_ending_button.style.display = '';
160 what.form.<% $field %>_beginning_disabled.style.display = 'none';
161 what.form.<% $field %>_ending_disabled.style.display = 'none';
171 <& /elements/tr-select-pkg_class.html,
172 'pre_options' => [ '0' => 'all' ],
173 'empty_label' => '(empty class)',
176 % if ( scalar( qsearch( 'part_pkg_report_option', { 'disabled' => '' } ) ) ) {
178 <& /elements/tr-select-table.html,
179 'label' => 'Report classes',
180 'table' => 'part_pkg_report_option',
181 'name_col' => 'name',
182 'hashref' => { 'disabled' => '' },
183 'element_name' => 'report_option',
184 'multiple' => 'multiple',
193 <TD>From date <i>(m/d/y)</i></TD>
194 <TD>To date <i>(m/d/y)</i></TD>
198 % foreach my $field (@date_fields) {
201 <TD ALIGN="right" VALIGN="center"><% $label{$field} %></TD>
202 % foreach (qw(beginning ending)) {
204 <& /elements/input-date-field.html, {
205 'name' => $field.'_'.$_,
208 'format' => '%m/%d/%Y',
214 <& /elements/checkbox.html,
215 'field' => $field.'_null',
217 'onchange' => $field.'_null_changed',
226 <SCRIPT TYPE="text/javascript">
228 function custom_changed(what) {
230 if ( what.checked ) {
232 what.form.pkgpart.disabled = true;
233 what.form.pkgpart.style.backgroundColor = '#dddddd';
237 what.form.pkgpart.disabled = false;
238 what.form.pkgpart.style.backgroundColor = '#ffffff';
246 <& /elements/tr-checkbox.html,
247 'label' => 'Custom packages',
250 'onchange' => 'custom_changed(this);',
253 <& /elements/tr-selectmultiple-part_pkg.html &>
255 <& /elements/tr-title.html, value => mt('Location search options') &>
257 % my @location_options = qw(cust nocust census nocensus);
258 % if ( $conf->exists('enable_taxproducts') ) {
259 % push @location_options, 'geocode', 'nogeocode';
261 <& /elements/tr-checkbox-multiple.html,
262 'label' => 'Where package location:',
264 'options' => \@location_options,
265 'labels' => { 'cust' => "is the customer's default location",
266 'nocust' => "is not the customer's default location",
267 'census' => "has a census tract",
268 'nocensus' => "does not have a census tract",
269 'nogeocode'=> 'has an implicit tax location',
270 'geocode' => 'has a hardcoded tax location',
272 'value' => { map { $_ => 0 } @location_options },
275 <& /elements/tr-title.html, value => mt('Display options') &>
277 <& /elements/tr-select-cust-fields.html &>
282 <INPUT TYPE="submit" VALUE="Get Report">
286 <% include('/elements/footer.html') %>
290 unless $FS::CurrentUser::CurrentUser->access_right('List packages');
292 my $title = 'Package Report';
293 #false laziness w/report_cust_bill.html
297 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
299 my $cust_main = qsearchs({
300 'table' => 'cust_main',
301 'hashref' => { 'custnum' => $custnum },
302 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
303 }) or die "unknown custnum $custnum";
305 push @title_arg, $cust_main->name;
311 tie my %label, 'Tie::IxHash',
313 'last_bill' => 'Last bill',
314 'bill' => 'Next bill',
315 'adjourn' => 'Adjourns',
316 'susp' => 'Suspended',
317 'dundate' => 'Suspension delayed until',
318 'expire' => 'Expires',
319 'contract_end' => 'Contract ends',
320 'change_date' => 'Changed from other package',
321 'cancel' => 'Cancelled',
323 my @date_fields = keys %label;
325 #false laziness w/cust_pkg.cgi
328 'on hold' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'expire'=>1, 'cancel'=>1, 'dundate'=> 1, },
329 'not yet billed' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'dundate'=>1, },
330 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'contract_end'=>1, 'dundate'=>1, },
331 'active' => { 'susp'=>1, 'cancel'=>1 },
332 'suspended' => { 'cancel'=>1, 'dundate'=>1, },
348 my $conf = FS::Conf->new;