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') ),
19 'onchange' => 'agent_changed(this)',
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',
49 <& /elements/tr-select-sales.html,
50 'label' => 'Package sales person',
51 'curr_value' => scalar($cgi->param('salesnum')),
52 'pre_options' => [ '' => 'all',
57 <% include( '/elements/tr-select-cust_pkg-status.html',
58 'onchange' => 'status_changed(this);',
62 <SCRIPT TYPE="text/javascript">
64 function status_changed(what) {
66 % foreach my $status ( '', FS::cust_pkg->statuses() ) {
68 if ( what.options[what.selectedIndex].value == '<% $status %>' ) {
70 % foreach my $field (@date_fields) {
71 % if ( $disable{$status}->{$field} ) {
73 what.form.<% $field %>_beginning_text.disabled = true;
74 what.form.<% $field %>_ending_text.disabled = true;
75 what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
76 what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
78 what.form.<% $field %>_beginning_button.style.display = 'none';
79 what.form.<% $field %>_ending_button.style.display = 'none';
80 what.form.<% $field %>_beginning_disabled.style.display = '';
81 what.form.<% $field %>_ending_disabled.style.display = '';
85 what.form.<% $field %>_beginning_text.disabled = false;
86 what.form.<% $field %>_ending_text.disabled = false;
87 what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
88 what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
90 what.form.<% $field %>_beginning_button.style.display = '';
91 what.form.<% $field %>_ending_button.style.display = '';
92 what.form.<% $field %>_beginning_disabled.style.display = 'none';
93 what.form.<% $field %>_ending_disabled.style.display = 'none';
106 <% include( '/elements/tr-select-pkg_class.html',
107 'pre_options' => [ '0' => 'all' ],
108 'empty_label' => '(empty class)',
112 % if ( scalar( qsearch( 'part_pkg_report_option', { 'disabled' => '' } ) ) ) {
114 <% include( '/elements/tr-select-table.html',
115 'label' => 'Report classes',
116 'table' => 'part_pkg_report_option',
117 'name_col' => 'name',
118 'hashref' => { 'disabled' => '' },
119 'element_name' => 'report_option',
120 'multiple' => 'multiple',
130 <TD>From date <i>(m/d/y)</i></TD>
131 <TD>To date <i>(m/d/y)</i></TD>
134 % foreach my $field (@date_fields) {
137 <TD ALIGN="right" VALIGN="center"><% $label{$field} %></TD>
138 % foreach (qw(beginning ending)) {
140 <& /elements/input-date-field.html, {
141 'name' => $field.'_'.$_,
144 'format' => '%m/%d/%Y',
155 <SCRIPT TYPE="text/javascript">
157 function custom_changed(what) {
159 if ( what.checked ) {
161 what.form.pkgpart.disabled = true;
162 what.form.pkgpart.style.backgroundColor = '#dddddd';
166 what.form.pkgpart.disabled = false;
167 what.form.pkgpart.style.backgroundColor = '#ffffff';
175 <% include( '/elements/tr-checkbox.html',
176 'label' => 'Custom packages',
179 'onchange' => 'custom_changed(this);',
183 <% include( '/elements/tr-selectmultiple-part_pkg.html' ) %>
186 <TH CLASS="background" COLSPAN=2> </TH>
190 <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Display options</FONT></TH>
192 <% include( '/elements/tr-select-cust-fields.html' ) %>
197 <INPUT TYPE="submit" VALUE="Get Report">
201 <% include('/elements/footer.html') %>
205 unless $FS::CurrentUser::CurrentUser->access_right('List packages');
207 my $title = 'Package Report';
208 #false laziness w/report_cust_bill.html
212 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
214 my $cust_main = qsearchs({
215 'table' => 'cust_main',
216 'hashref' => { 'custnum' => $custnum },
217 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
218 }) or die "unknown custnum $custnum";
220 push @title_arg, $cust_main->name;
226 tie my %label, 'Tie::IxHash',
228 'last_bill' => 'Last bill',
229 'bill' => 'Next bill',
230 'adjourn' => 'Adjourns',
231 'susp' => 'Suspended',
232 'dundate' => 'Suspension delayed until',
233 'expire' => 'Expires',
234 'contract_end' => 'Contract ends',
235 'change_date' => 'Changed from other package',
236 'cancel' => 'Cancelled',
238 my @date_fields = keys %label;
240 #false laziness w/cust_pkg.cgi
243 'not yet billed' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, },
244 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'contract_end'=>1, 'dundate'=>1, },
245 'active' => { 'susp'=>1, 'cancel'=>1 },
246 'suspended' => { 'cancel'=>1, 'dundate'=>1, },