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 ) {
17 <& /elements/tr-select-agent.html,
18 'curr_value' => scalar( $cgi->param('agentnum') ),
20 'onchange' => 'agent_changed(this)',
23 <& /elements/tr-select-cust_main-status.html,
24 'label' => 'Customer status',
25 'field' => 'cust_status',
28 <SCRIPT TYPE="text/javascript">
30 function agent_changed(what) {
31 % # update sales dropdowns
32 salesnum_agentnum_changed(what);
33 cust_main_salesnum_agentnum_changed(what);
36 <&| /elements/onload.js &>
37 agent_changed(document.getElementById('agentnum'))
42 <& /elements/tr-select-sales.html,
43 'label' => 'Customer sales person',
44 'element_name' => 'cust_main_salesnum',
45 'id' => 'cust_main_salesnum',
46 'curr_value' => scalar($cgi->param('cust_main_salesnum')),
47 'pre_options' => [ '' => 'all',
54 <& /elements/tr-select-sales.html,
55 'label' => 'Package sales person',
56 'curr_value' => scalar($cgi->param('salesnum')),
57 'pre_options' => [ '' => 'all',
62 <% include( '/elements/tr-select-cust_pkg-status.html',
63 'label' => 'Package status',
64 '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 %>_beginning_text.style.backgroundColor = '#dddddd';
82 what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
84 what.form.<% $field %>_beginning_button.style.display = 'none';
85 what.form.<% $field %>_ending_button.style.display = 'none';
86 what.form.<% $field %>_beginning_disabled.style.display = '';
87 what.form.<% $field %>_ending_disabled.style.display = '';
91 what.form.<% $field %>_beginning_text.disabled = false;
92 what.form.<% $field %>_ending_text.disabled = false;
93 what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
94 what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
96 what.form.<% $field %>_beginning_button.style.display = '';
97 what.form.<% $field %>_ending_button.style.display = '';
98 what.form.<% $field %>_beginning_disabled.style.display = 'none';
99 what.form.<% $field %>_ending_disabled.style.display = 'none';
112 <% include( '/elements/tr-select-pkg_class.html',
113 'pre_options' => [ '0' => 'all' ],
114 'empty_label' => '(empty class)',
118 % if ( scalar( qsearch( 'part_pkg_report_option', { 'disabled' => '' } ) ) ) {
120 <% include( '/elements/tr-select-table.html',
121 'label' => 'Report classes',
122 'table' => 'part_pkg_report_option',
123 'name_col' => 'name',
124 'hashref' => { 'disabled' => '' },
125 'element_name' => 'report_option',
126 '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 <% include( '/elements/tr-checkbox.html',
182 'label' => 'Custom packages',
185 'onchange' => 'custom_changed(this);',
189 <% include( '/elements/tr-selectmultiple-part_pkg.html' ) %>
192 <TH CLASS="background" COLSPAN=2> </TH>
196 <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Display options</FONT></TH>
198 <% include( '/elements/tr-select-cust-fields.html' ) %>
203 <INPUT TYPE="submit" VALUE="Get Report">
207 <% include('/elements/footer.html') %>
211 unless $FS::CurrentUser::CurrentUser->access_right('List packages');
213 my $title = 'Package Report';
214 #false laziness w/report_cust_bill.html
218 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
220 my $cust_main = qsearchs({
221 'table' => 'cust_main',
222 'hashref' => { 'custnum' => $custnum },
223 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
224 }) or die "unknown custnum $custnum";
226 push @title_arg, $cust_main->name;
232 tie my %label, 'Tie::IxHash',
234 'last_bill' => 'Last bill',
235 'bill' => 'Next bill',
236 'adjourn' => 'Adjourns',
237 'susp' => 'Suspended',
238 'dundate' => 'Suspension delayed until',
239 'expire' => 'Expires',
240 'contract_end' => 'Contract ends',
241 'change_date' => 'Changed from other package',
242 'cancel' => 'Cancelled',
244 my @date_fields = keys %label;
246 #false laziness w/cust_pkg.cgi
249 'not yet billed' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, },
250 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'contract_end'=>1, 'dundate'=>1, },
251 'active' => { 'susp'=>1, 'cancel'=>1 },
252 'suspended' => { 'cancel'=>1, 'dundate'=>1, },