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') ),
23 <% include( '/elements/tr-select-cust_pkg-status.html',
24 'onchange' => 'status_changed(this);',
28 <SCRIPT TYPE="text/javascript">
30 function status_changed(what) {
32 % foreach my $status ( '', FS::cust_pkg->statuses() ) {
34 if ( what.options[what.selectedIndex].value == '<% $status %>' ) {
36 % foreach my $field (@date_fields) {
37 % if ( $disable{$status}->{$field} ) {
39 what.form.<% $field %>_beginning_text.disabled = true;
40 what.form.<% $field %>_ending_text.disabled = true;
41 what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
42 what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
44 what.form.<% $field %>_beginning_button.style.display = 'none';
45 what.form.<% $field %>_ending_button.style.display = 'none';
46 what.form.<% $field %>_beginning_disabled.style.display = '';
47 what.form.<% $field %>_ending_disabled.style.display = '';
51 what.form.<% $field %>_beginning_text.disabled = false;
52 what.form.<% $field %>_ending_text.disabled = false;
53 what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
54 what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
56 what.form.<% $field %>_beginning_button.style.display = '';
57 what.form.<% $field %>_ending_button.style.display = '';
58 what.form.<% $field %>_beginning_disabled.style.display = 'none';
59 what.form.<% $field %>_ending_disabled.style.display = 'none';
72 <% include( '/elements/tr-select-pkg_class.html',
73 'pre_options' => [ '0' => 'all' ],
74 'empty_label' => '(empty class)',
78 % if ( scalar( qsearch( 'part_pkg_report_option', { 'disabled' => '' } ) ) ) {
80 <% include( '/elements/tr-select-table.html',
81 'label' => 'Report classes',
82 'table' => 'part_pkg_report_option',
84 'hashref' => { 'disabled' => '' },
85 'element_name' => 'report_option',
86 'multiple' => 'multiple',
92 % foreach my $field (@date_fields) {
95 <TD ALIGN="right" VALIGN="center"><% $label{$field} %></TD>
98 <% include( '/elements/tr-input-beginning_ending.html',
109 <SCRIPT TYPE="text/javascript">
111 function custom_changed(what) {
113 if ( what.checked ) {
115 what.form.pkgpart.disabled = true;
116 what.form.pkgpart.style.backgroundColor = '#dddddd';
120 what.form.pkgpart.disabled = false;
121 what.form.pkgpart.style.backgroundColor = '#ffffff';
129 <% include( '/elements/tr-checkbox.html',
130 'label' => 'Custom packages',
133 'onchange' => 'custom_changed(this);',
137 <% include( '/elements/tr-selectmultiple-part_pkg.html' ) %>
140 <TH CLASS="background" COLSPAN=2> </TH>
144 <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Display options</FONT></TH>
146 <% include( '/elements/tr-select-cust-fields.html' ) %>
151 <INPUT TYPE="submit" VALUE="Get Report">
155 <% include('/elements/footer.html') %>
159 unless $FS::CurrentUser::CurrentUser->access_right('List packages');
161 my $title = 'Package Report';
162 #false laziness w/report_cust_bill.html
166 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
168 my $cust_main = qsearchs({
169 'table' => 'cust_main',
170 'hashref' => { 'custnum' => $custnum },
171 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
172 }) or die "unknown custnum $custnum";
174 push @title_arg, $cust_main->name;
180 tie my %label, 'Tie::IxHash',
182 'last_bill' => 'Last bill',
183 'bill' => 'Next bill',
184 'adjourn' => 'Adjourns',
185 'susp' => 'Suspended',
186 'dundate' => 'Suspension delayed until',
187 'expire' => 'Expires',
188 'contract_end' => 'Contract ends',
189 'cancel' => 'Cancelled',
191 my @date_fields = keys %label;
193 #false laziness w/cust_pkg.cgi
196 'not yet billed' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, },
197 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'contract_end'=>1, 'dundate'=>1, },
198 'active' => { 'susp'=>1, 'cancel'=>1 },
199 'suspended' => { 'cancel'=>1, 'dundate'=>1, },