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 <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
12 <TH CLASS="background" COLSPAN=2 ALIGN="left">
13 <FONT SIZE="+1">Customer search options</FONT>
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',
57 <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
60 <TH CLASS="background" COLSPAN=2 ALIGN="left">
61 <FONT SIZE="+1">Package search options</FONT>
65 <& /elements/tr-select-sales.html,
66 'label' => 'Package sales person',
67 'curr_value' => scalar($cgi->param('salesnum')),
68 'pre_options' => [ '' => 'all',
73 <% include( '/elements/tr-select-cust_pkg-status.html',
74 'label' => 'Package status',
75 'onchange' => 'status_changed(this);',
79 <SCRIPT TYPE="text/javascript">
81 function status_changed(what) {
83 % foreach my $status ( '', FS::cust_pkg->statuses() ) {
85 if ( what.options[what.selectedIndex].value == '<% $status %>' ) {
87 % foreach my $field (@date_fields) {
88 % if ( $disable{$status}->{$field} ) {
90 what.form.<% $field %>_beginning_text.disabled = true;
91 what.form.<% $field %>_ending_text.disabled = true;
92 what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
93 what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
95 what.form.<% $field %>_beginning_button.style.display = 'none';
96 what.form.<% $field %>_ending_button.style.display = 'none';
97 what.form.<% $field %>_beginning_disabled.style.display = '';
98 what.form.<% $field %>_ending_disabled.style.display = '';
102 what.form.<% $field %>_beginning_text.disabled = false;
103 what.form.<% $field %>_ending_text.disabled = false;
104 what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
105 what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
107 what.form.<% $field %>_beginning_button.style.display = '';
108 what.form.<% $field %>_ending_button.style.display = '';
109 what.form.<% $field %>_beginning_disabled.style.display = 'none';
110 what.form.<% $field %>_ending_disabled.style.display = 'none';
123 <% include( '/elements/tr-select-pkg_class.html',
124 'pre_options' => [ '0' => 'all' ],
125 'empty_label' => '(empty class)',
129 % if ( scalar( qsearch( 'part_pkg_report_option', { 'disabled' => '' } ) ) ) {
131 <% include( '/elements/tr-select-table.html',
132 'label' => 'Report classes',
133 'table' => 'part_pkg_report_option',
134 'name_col' => 'name',
135 'hashref' => { 'disabled' => '' },
136 'element_name' => 'report_option',
137 'multiple' => 'multiple',
147 <TD>From date <i>(m/d/y)</i></TD>
148 <TD>To date <i>(m/d/y)</i></TD>
151 % foreach my $field (@date_fields) {
154 <TD ALIGN="right" VALIGN="center"><% $label{$field} %></TD>
155 % foreach (qw(beginning ending)) {
157 <& /elements/input-date-field.html, {
158 'name' => $field.'_'.$_,
161 'format' => '%m/%d/%Y',
172 <SCRIPT TYPE="text/javascript">
174 function custom_changed(what) {
176 if ( what.checked ) {
178 what.form.pkgpart.disabled = true;
179 what.form.pkgpart.style.backgroundColor = '#dddddd';
183 what.form.pkgpart.disabled = false;
184 what.form.pkgpart.style.backgroundColor = '#ffffff';
192 <% include( '/elements/tr-checkbox.html',
193 'label' => 'Custom packages',
196 'onchange' => 'custom_changed(this);',
200 <% include( '/elements/tr-selectmultiple-part_pkg.html' ) %>
203 <TH CLASS="background" COLSPAN=2> </TH>
207 <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Display options</FONT></TH>
209 <% include( '/elements/tr-select-cust-fields.html' ) %>
214 <INPUT TYPE="submit" VALUE="Get Report">
218 <% include('/elements/footer.html') %>
222 unless $FS::CurrentUser::CurrentUser->access_right('List packages');
224 my $title = 'Package Report';
225 #false laziness w/report_cust_bill.html
229 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
231 my $cust_main = qsearchs({
232 'table' => 'cust_main',
233 'hashref' => { 'custnum' => $custnum },
234 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
235 }) or die "unknown custnum $custnum";
237 push @title_arg, $cust_main->name;
243 tie my %label, 'Tie::IxHash',
245 'last_bill' => 'Last bill',
246 'bill' => 'Next bill',
247 'adjourn' => 'Adjourns',
248 'susp' => 'Suspended',
249 'dundate' => 'Suspension delayed until',
250 'expire' => 'Expires',
251 'contract_end' => 'Contract ends',
252 'change_date' => 'Changed from other package',
253 'cancel' => 'Cancelled',
255 my @date_fields = keys %label;
257 #false laziness w/cust_pkg.cgi
260 'not yet billed' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, },
261 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'contract_end'=>1, 'dundate'=>1, },
262 'active' => { 'susp'=>1, 'cancel'=>1 },
263 'suspended' => { 'cancel'=>1, 'dundate'=>1, },