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 <SCRIPT TYPE="text/javascript">
70 function status_changed(what) {
72 % foreach my $status ( '', FS::cust_pkg->statuses() ) {
74 if ( what.options[what.selectedIndex].value == '<% $status %>' ) {
76 % foreach my $field (@date_fields) {
77 % if ( $disable{$status}->{$field} ) {
79 what.form.<% $field %>_beginning_text.disabled = true;
80 what.form.<% $field %>_ending_text.disabled = true;
81 what.form.<% $field %>_null.disabled = true;
82 what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
83 what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
85 what.form.<% $field %>_beginning_button.style.display = 'none';
86 what.form.<% $field %>_ending_button.style.display = 'none';
87 what.form.<% $field %>_beginning_disabled.style.display = '';
88 what.form.<% $field %>_ending_disabled.style.display = '';
92 what.form.<% $field %>_null.disabled = false;
94 if ( ! what.form.<% $field %>_null.checked ) {
96 what.form.<% $field %>_beginning_text.disabled = false;
97 what.form.<% $field %>_ending_text.disabled = false;
98 what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
99 what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
101 what.form.<% $field %>_beginning_button.style.display = '';
102 what.form.<% $field %>_ending_button.style.display = '';
103 what.form.<% $field %>_beginning_disabled.style.display = 'none';
104 what.form.<% $field %>_ending_disabled.style.display = 'none';
117 % foreach my $field (@date_fields) {
119 function <% $field %>_null_changed(what) {
121 if ( what.checked ) {
122 what.form.<% $field %>_beginning_text.disabled = true;
123 what.form.<% $field %>_ending_text.disabled = true;
124 what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
125 what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
126 what.form.<% $field %>_beginning_button.style.display = 'none';
127 what.form.<% $field %>_ending_button.style.display = 'none';
128 what.form.<% $field %>_beginning_disabled.style.display = '';
129 what.form.<% $field %>_ending_disabled.style.display = '';
132 what.form.<% $field %>_beginning_text.disabled = false;
133 what.form.<% $field %>_ending_text.disabled = false;
134 what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
135 what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
137 what.form.<% $field %>_beginning_button.style.display = '';
138 what.form.<% $field %>_ending_button.style.display = '';
139 what.form.<% $field %>_beginning_disabled.style.display = 'none';
140 what.form.<% $field %>_ending_disabled.style.display = 'none';
150 <& /elements/tr-select-pkg_class.html,
151 'pre_options' => [ '0' => 'all' ],
152 'empty_label' => '(empty class)',
155 % if ( scalar( qsearch( 'part_pkg_report_option', { 'disabled' => '' } ) ) ) {
157 <& /elements/tr-select-table.html,
158 'label' => 'Report classes',
159 'table' => 'part_pkg_report_option',
160 'name_col' => 'name',
161 'hashref' => { 'disabled' => '' },
162 'element_name' => 'report_option',
163 'multiple' => 'multiple',
172 <TD>From date <i>(m/d/y)</i></TD>
173 <TD>To date <i>(m/d/y)</i></TD>
177 % foreach my $field (@date_fields) {
180 <TD ALIGN="right" VALIGN="center"><% $label{$field} %></TD>
181 % foreach (qw(beginning ending)) {
183 <& /elements/input-date-field.html, {
184 'name' => $field.'_'.$_,
187 'format' => '%m/%d/%Y',
193 <& /elements/checkbox.html,
194 'field' => $field.'_null',
196 'onchange' => $field.'_null_changed',
205 <SCRIPT TYPE="text/javascript">
207 function custom_changed(what) {
209 if ( what.checked ) {
211 what.form.pkgpart.disabled = true;
212 what.form.pkgpart.style.backgroundColor = '#dddddd';
216 what.form.pkgpart.disabled = false;
217 what.form.pkgpart.style.backgroundColor = '#ffffff';
225 <& /elements/tr-checkbox.html,
226 'label' => 'Custom packages',
229 'onchange' => 'custom_changed(this);',
232 <& /elements/tr-selectmultiple-part_pkg.html &>
237 <FONT CLASS="fsinnerbox-title"><% emt('Location search options') %></FONT>
238 <TABLE CLASS="fsinnerbox">
240 % my @location_options = qw(cust nocust census nocensus);
241 % if ( $conf->config('tax_data_vendor') eq 'cch' ) {
242 % push @location_options, 'geocode', 'nogeocode';
244 <& /elements/tr-checkbox-multiple.html,
245 'label' => 'Where package location:',
247 'options' => \@location_options,
248 'labels' => { 'cust' => "is the customer's default location",
249 'nocust' => "is not the customer's default location",
250 'census' => "has a census tract",
251 'nocensus' => "does not have a census tract",
252 'nogeocode'=> 'has an implicit tax location',
253 'geocode' => 'has a hardcoded tax location',
255 'value' => { map { $_ => 0 } @location_options },
261 <FONT CLASS="fsinnerbox-title"><% emt('Display options') %></FONT>
262 <TABLE CLASS="fsinnerbox">
264 <& /elements/tr-select-cust-fields.html &>
269 <INPUT TYPE="submit" VALUE="Get Report">
273 <% include('/elements/footer.html') %>
277 unless $FS::CurrentUser::CurrentUser->access_right('List packages');
279 my $title = 'Package Report';
280 #false laziness w/report_cust_bill.html
284 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
286 my $cust_main = qsearchs({
287 'table' => 'cust_main',
288 'hashref' => { 'custnum' => $custnum },
289 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
290 }) or die "unknown custnum $custnum";
292 push @title_arg, $cust_main->name;
298 tie my %label, 'Tie::IxHash',
300 'last_bill' => 'Last bill',
301 'bill' => 'Next bill',
302 'adjourn' => 'Adjourns',
303 'susp' => 'Suspended',
304 'dundate' => 'Suspension delayed until',
305 'expire' => 'Expires',
306 'contract_end' => 'Contract ends',
307 'change_date' => 'Changed from other package',
308 'cancel' => 'Cancelled',
310 my @date_fields = keys %label;
312 #false laziness w/cust_pkg.cgi
315 'on hold' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'expire'=>1, 'cancel'=>1, 'dundate'=> 1, },
316 'not yet billed' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'dundate'=>1, },
317 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'contract_end'=>1, 'dundate'=>1, },
318 'active' => { 'susp'=>1, 'cancel'=>1 },
319 'suspended' => { 'cancel'=>1, 'dundate'=>1, },
335 my $conf = FS::Conf->new;