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 <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
10 <TH CLASS="background" COLSPAN=2 ALIGN="left">
11 <FONT SIZE="+1">Search options</FONT>
15 % unless ( $custnum ) {
16 <% include( '/elements/tr-select-agent.html',
17 'curr_value' => scalar( $cgi->param('agentnum') ),
22 <& /elements/tr-select-sales.html,
23 'label' => 'Customer sales person',
24 'element_name' => 'cust_main_salesnum',
25 'id' => 'cust_main_salesnum',
26 'curr_value' => scalar($cgi->param('cust_main_salesnum')),
27 'pre_options' => [ '' => 'all',
34 <& /elements/tr-select-sales.html,
35 'label' => 'Package sales person',
36 'curr_value' => scalar($cgi->param('salesnum')),
37 'pre_options' => [ '' => 'all',
42 <% include( '/elements/tr-select-cust_pkg-status.html',
43 'onchange' => 'status_changed(this);',
47 <SCRIPT TYPE="text/javascript">
49 function status_changed(what) {
51 % foreach my $status ( '', FS::cust_pkg->statuses() ) {
53 if ( what.options[what.selectedIndex].value == '<% $status %>' ) {
55 % foreach my $field (@date_fields) {
56 % if ( $disable{$status}->{$field} ) {
58 what.form.<% $field %>_beginning_text.disabled = true;
59 what.form.<% $field %>_ending_text.disabled = true;
60 what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
61 what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
63 what.form.<% $field %>_beginning_button.style.display = 'none';
64 what.form.<% $field %>_ending_button.style.display = 'none';
65 what.form.<% $field %>_beginning_disabled.style.display = '';
66 what.form.<% $field %>_ending_disabled.style.display = '';
70 what.form.<% $field %>_beginning_text.disabled = false;
71 what.form.<% $field %>_ending_text.disabled = false;
72 what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
73 what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
75 what.form.<% $field %>_beginning_button.style.display = '';
76 what.form.<% $field %>_ending_button.style.display = '';
77 what.form.<% $field %>_beginning_disabled.style.display = 'none';
78 what.form.<% $field %>_ending_disabled.style.display = 'none';
91 <% include( '/elements/tr-select-pkg_class.html',
92 'pre_options' => [ '0' => 'all' ],
93 'empty_label' => '(empty class)',
97 % if ( scalar( qsearch( 'part_pkg_report_option', { 'disabled' => '' } ) ) ) {
99 <% include( '/elements/tr-select-table.html',
100 'label' => 'Report classes',
101 'table' => 'part_pkg_report_option',
102 'name_col' => 'name',
103 'hashref' => { 'disabled' => '' },
104 'element_name' => 'report_option',
105 'multiple' => 'multiple',
115 <TD>From date <i>(m/d/y)</i></TD>
116 <TD>To date <i>(m/d/y)</i></TD>
119 % foreach my $field (@date_fields) {
122 <TD ALIGN="right" VALIGN="center"><% $label{$field} %></TD>
123 % foreach (qw(beginning ending)) {
125 <& /elements/input-date-field.html, {
126 'name' => $field.'_'.$_,
129 'format' => '%m/%d/%Y',
140 <SCRIPT TYPE="text/javascript">
142 function custom_changed(what) {
144 if ( what.checked ) {
146 what.form.pkgpart.disabled = true;
147 what.form.pkgpart.style.backgroundColor = '#dddddd';
151 what.form.pkgpart.disabled = false;
152 what.form.pkgpart.style.backgroundColor = '#ffffff';
160 <% include( '/elements/tr-checkbox.html',
161 'label' => 'Custom packages',
164 'onchange' => 'custom_changed(this);',
168 <% include( '/elements/tr-selectmultiple-part_pkg.html' ) %>
171 <TH CLASS="background" COLSPAN=2> </TH>
175 <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Display options</FONT></TH>
177 <% include( '/elements/tr-select-cust-fields.html' ) %>
182 <INPUT TYPE="submit" VALUE="Get Report">
186 <% include('/elements/footer.html') %>
190 unless $FS::CurrentUser::CurrentUser->access_right('List packages');
192 my $title = 'Package Report';
193 #false laziness w/report_cust_bill.html
197 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
199 my $cust_main = qsearchs({
200 'table' => 'cust_main',
201 'hashref' => { 'custnum' => $custnum },
202 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
203 }) or die "unknown custnum $custnum";
205 push @title_arg, $cust_main->name;
211 tie my %label, 'Tie::IxHash',
213 'last_bill' => 'Last bill',
214 'bill' => 'Next bill',
215 'adjourn' => 'Adjourns',
216 'susp' => 'Suspended',
217 'dundate' => 'Suspension delayed until',
218 'expire' => 'Expires',
219 'contract_end' => 'Contract ends',
220 'change_date' => 'Changed from other package',
221 'cancel' => 'Cancelled',
223 my @date_fields = keys %label;
225 #false laziness w/cust_pkg.cgi
228 'not yet billed' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, },
229 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'contract_end'=>1, 'dundate'=>1, },
230 'active' => { 'susp'=>1, 'cancel'=>1 },
231 'suspended' => { 'cancel'=>1, 'dundate'=>1, },