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 %>_beginning_text.style.backgroundColor = '#dddddd';
84 what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
86 what.form.<% $field %>_beginning_button.style.display = 'none';
87 what.form.<% $field %>_ending_button.style.display = 'none';
88 what.form.<% $field %>_beginning_disabled.style.display = '';
89 what.form.<% $field %>_ending_disabled.style.display = '';
93 what.form.<% $field %>_beginning_text.disabled = false;
94 what.form.<% $field %>_ending_text.disabled = false;
95 what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
96 what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
98 what.form.<% $field %>_beginning_button.style.display = '';
99 what.form.<% $field %>_ending_button.style.display = '';
100 what.form.<% $field %>_beginning_disabled.style.display = 'none';
101 what.form.<% $field %>_ending_disabled.style.display = 'none';
114 <& /elements/tr-select-pkg_class.html,
115 'pre_options' => [ '0' => 'all' ],
116 'empty_label' => '(empty class)',
119 % if ( scalar( qsearch( 'part_pkg_report_option', { 'disabled' => '' } ) ) ) {
121 <& /elements/tr-select-table.html,
122 'label' => 'Report classes',
123 'table' => 'part_pkg_report_option',
124 'name_col' => 'name',
125 'hashref' => { 'disabled' => '' },
126 'element_name' => 'report_option',
127 'multiple' => 'multiple',
136 <TD>From date <i>(m/d/y)</i></TD>
137 <TD>To date <i>(m/d/y)</i></TD>
140 % foreach my $field (@date_fields) {
143 <TD ALIGN="right" VALIGN="center"><% $label{$field} %></TD>
144 % foreach (qw(beginning ending)) {
146 <& /elements/input-date-field.html, {
147 'name' => $field.'_'.$_,
150 'format' => '%m/%d/%Y',
161 <SCRIPT TYPE="text/javascript">
163 function custom_changed(what) {
165 if ( what.checked ) {
167 what.form.pkgpart.disabled = true;
168 what.form.pkgpart.style.backgroundColor = '#dddddd';
172 what.form.pkgpart.disabled = false;
173 what.form.pkgpart.style.backgroundColor = '#ffffff';
181 <& /elements/tr-checkbox.html,
182 'label' => 'Custom packages',
185 'onchange' => 'custom_changed(this);',
188 <& /elements/tr-selectmultiple-part_pkg.html &>
190 <& /elements/tr-title.html, value => mt('Location search options') &>
192 % my @location_options = qw(cust nocust census nocensus);
193 % if ( $conf->exists('enable_taxproducts') ) {
194 % push @location_options, 'geocode', 'nogeocode';
196 <& /elements/tr-checkbox-multiple.html,
197 'label' => 'Where package location:',
199 'options' => \@location_options,
200 'labels' => { 'cust' => "is the customer's default location",
201 'nocust' => "is not the customer's default location",
202 'census' => "has a census tract",
203 'nocensus' => "does not have a census tract",
204 'nogeocode'=> 'has an implicit tax location',
205 'geocode' => 'has a hardcoded tax location',
207 'value' => { map { $_ => 0 } @location_options },
210 <& /elements/tr-title.html, value => mt('Display options') &>
212 <& /elements/tr-select-cust-fields.html &>
217 <INPUT TYPE="submit" VALUE="Get Report">
221 <% include('/elements/footer.html') %>
225 unless $FS::CurrentUser::CurrentUser->access_right('List packages');
227 my $title = 'Package Report';
228 #false laziness w/report_cust_bill.html
232 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
234 my $cust_main = qsearchs({
235 'table' => 'cust_main',
236 'hashref' => { 'custnum' => $custnum },
237 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
238 }) or die "unknown custnum $custnum";
240 push @title_arg, $cust_main->name;
246 tie my %label, 'Tie::IxHash',
248 'last_bill' => 'Last bill',
249 'bill' => 'Next bill',
250 'adjourn' => 'Adjourns',
251 'susp' => 'Suspended',
252 'dundate' => 'Suspension delayed until',
253 'expire' => 'Expires',
254 'contract_end' => 'Contract ends',
255 'change_date' => 'Changed from other package',
256 'cancel' => 'Cancelled',
258 my @date_fields = keys %label;
260 #false laziness w/cust_pkg.cgi
263 'on hold' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'expire'=>1, 'cancel'=>1, 'dundate'=> 1, },
264 'not yet billed' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'dundate'=>1, },
265 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'contract_end'=>1, 'dundate'=>1, },
266 'active' => { 'susp'=>1, 'cancel'=>1 },
267 'suspended' => { 'cancel'=>1, 'dundate'=>1, },
283 my $conf = FS::Conf->new;