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 <SCRIPT TYPE="text/javascript">
72 function status_changed(what) {
74 % foreach my $status ( '', FS::cust_pkg->statuses() ) {
76 if ( what.options[what.selectedIndex].value == '<% $status %>' ) {
78 % foreach my $field (@date_fields) {
79 % if ( $disable{$status}->{$field} ) {
81 what.form.<% $field %>_beginning_text.disabled = true;
82 what.form.<% $field %>_ending_text.disabled = true;
83 what.form.<% $field %>_null.disabled = true;
84 what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
85 what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
87 what.form.<% $field %>_beginning_button.style.display = 'none';
88 what.form.<% $field %>_ending_button.style.display = 'none';
89 what.form.<% $field %>_beginning_disabled.style.display = '';
90 what.form.<% $field %>_ending_disabled.style.display = '';
94 what.form.<% $field %>_null.disabled = false;
96 if ( ! what.form.<% $field %>_null.checked ) {
98 what.form.<% $field %>_beginning_text.disabled = false;
99 what.form.<% $field %>_ending_text.disabled = false;
100 what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
101 what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
103 what.form.<% $field %>_beginning_button.style.display = '';
104 what.form.<% $field %>_ending_button.style.display = '';
105 what.form.<% $field %>_beginning_disabled.style.display = 'none';
106 what.form.<% $field %>_ending_disabled.style.display = 'none';
119 % foreach my $field (@date_fields) {
121 function <% $field %>_null_changed(what) {
123 if ( what.checked ) {
124 what.form.<% $field %>_beginning_text.disabled = true;
125 what.form.<% $field %>_ending_text.disabled = true;
126 what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
127 what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
128 what.form.<% $field %>_beginning_button.style.display = 'none';
129 what.form.<% $field %>_ending_button.style.display = 'none';
130 what.form.<% $field %>_beginning_disabled.style.display = '';
131 what.form.<% $field %>_ending_disabled.style.display = '';
134 what.form.<% $field %>_beginning_text.disabled = false;
135 what.form.<% $field %>_ending_text.disabled = false;
136 what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
137 what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
139 what.form.<% $field %>_beginning_button.style.display = '';
140 what.form.<% $field %>_ending_button.style.display = '';
141 what.form.<% $field %>_beginning_disabled.style.display = 'none';
142 what.form.<% $field %>_ending_disabled.style.display = 'none';
152 <& /elements/tr-select-pkg_class.html,
153 'pre_options' => [ '0' => 'all' ],
154 'empty_label' => '(empty class)',
157 % if ( scalar( qsearch( 'part_pkg_report_option', { 'disabled' => '' } ) ) ) {
159 <& /elements/tr-select-table.html,
160 'label' => 'Report classes',
161 'table' => 'part_pkg_report_option',
162 'name_col' => 'name',
163 'hashref' => { 'disabled' => '' },
164 'element_name' => 'report_option',
165 'multiple' => 'multiple',
174 <TD>From date <i>(m/d/y)</i></TD>
175 <TD>To date <i>(m/d/y)</i></TD>
179 % foreach my $field (@date_fields) {
182 <TD ALIGN="right" VALIGN="center"><% $label{$field} %></TD>
183 % foreach (qw(beginning ending)) {
185 <& /elements/input-date-field.html, {
186 'name' => $field.'_'.$_,
189 'format' => '%m/%d/%Y',
195 <& /elements/checkbox.html,
196 'field' => $field.'_null',
198 'onchange' => $field.'_null_changed',
207 <SCRIPT TYPE="text/javascript">
209 function custom_changed(what) {
211 if ( what.checked ) {
213 what.form.pkgpart.disabled = true;
214 what.form.pkgpart.style.backgroundColor = '#dddddd';
218 what.form.pkgpart.disabled = false;
219 what.form.pkgpart.style.backgroundColor = '#ffffff';
227 <& /elements/tr-checkbox.html,
228 'label' => 'Custom packages',
231 'onchange' => 'custom_changed(this);',
234 <& /elements/tr-selectmultiple-part_pkg.html &>
236 <& /elements/tr-title.html, value => mt('Location search options') &>
238 % my @location_options = qw(cust nocust census nocensus);
239 % if ( $conf->exists('enable_taxproducts') ) {
240 % push @location_options, 'geocode', 'nogeocode';
242 <& /elements/tr-checkbox-multiple.html,
243 'label' => 'Where package location:',
245 'options' => \@location_options,
246 'labels' => { 'cust' => "is the customer's default location",
247 'nocust' => "is not the customer's default location",
248 'census' => "has a census tract",
249 'nocensus' => "does not have a census tract",
250 'nogeocode'=> 'has an implicit tax location',
251 'geocode' => 'has a hardcoded tax location',
253 'value' => { map { $_ => 0 } @location_options },
256 <& /elements/tr-title.html, value => mt('Display options') &>
258 <& /elements/tr-select-cust-fields.html &>
263 <INPUT TYPE="submit" VALUE="Get Report">
267 <% include('/elements/footer.html') %>
271 unless $FS::CurrentUser::CurrentUser->access_right('List packages');
273 my $title = 'Package Report';
274 #false laziness w/report_cust_bill.html
278 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
280 my $cust_main = qsearchs({
281 'table' => 'cust_main',
282 'hashref' => { 'custnum' => $custnum },
283 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
284 }) or die "unknown custnum $custnum";
286 push @title_arg, $cust_main->name;
292 tie my %label, 'Tie::IxHash',
294 'last_bill' => 'Last bill',
295 'bill' => 'Next bill',
296 'adjourn' => 'Adjourns',
297 'susp' => 'Suspended',
298 'dundate' => 'Suspension delayed until',
299 'expire' => 'Expires',
300 'contract_end' => 'Contract ends',
301 'change_date' => 'Changed from other package',
302 'cancel' => 'Cancelled',
304 my @date_fields = keys %label;
306 #false laziness w/cust_pkg.cgi
309 'on hold' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'expire'=>1, 'cancel'=>1, 'dundate'=> 1, },
310 'not yet billed' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'dundate'=>1, },
311 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'contract_end'=>1, 'dundate'=>1, },
312 'active' => { 'susp'=>1, 'cancel'=>1 },
313 'suspended' => { 'cancel'=>1, 'dundate'=>1, },
329 my $conf = FS::Conf->new;