suspend later just like expire (#1487)
[freeside.git] / httemplate / search / report_cust_pkg.html
1 <% include('/elements/header.html', 'Package Report' ) %>
2
3 <FORM ACTION="cust_pkg.cgi" METHOD="GET">
4 <INPUT TYPE="hidden" NAME="magic" VALUE="bill">
5
6   <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
7
8     <TR>
9       <TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Search options</FONT></TH>
10     </TR>
11     <% include( '/elements/tr-select-agent.html',
12                    ($cgi->param('agentnum') || ''),
13                )
14     %>
15
16     <% include( '/elements/tr-select-cust_pkg-status.html', '',
17                   'onchange' => 'status_changed(this);',
18               )
19     %>
20
21     <SCRIPT TYPE="text/javascript">
22   
23       function status_changed(what) {
24
25 %       foreach my $status ( '', FS::cust_pkg->statuses() ) {
26
27           if ( what.options[what.selectedIndex].value == '<% $status %>' ) {
28
29 %           foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) {
30 %             if ( $disable{$status}->{$field} ) {
31
32                 what.form.<% $field %>_beginning_text.disabled = true;
33                 what.form.<% $field %>_ending_text.disabled = true;
34                 what.form.<% $field %>_beginning_text.style.backgroundColor = '#dddddd';
35                 what.form.<% $field %>_ending_text.style.backgroundColor = '#dddddd';
36
37                 what.form.<% $field %>_beginning_button.style.display = 'none';
38                 what.form.<% $field %>_ending_button.style.display = 'none';
39                 what.form.<% $field %>_beginning_disabled.style.display = '';
40                 what.form.<% $field %>_ending_disabled.style.display = '';
41
42 %             } else {
43
44                 what.form.<% $field %>_beginning_text.disabled = false;
45                 what.form.<% $field %>_ending_text.disabled = false;
46                 what.form.<% $field %>_beginning_text.style.backgroundColor = '#ffffff';
47                 what.form.<% $field %>_ending_text.style.backgroundColor = '#ffffff';
48
49                 what.form.<% $field %>_beginning_button.style.display = '';
50                 what.form.<% $field %>_ending_button.style.display = '';
51                 what.form.<% $field %>_beginning_disabled.style.display = 'none';
52                 what.form.<% $field %>_ending_disabled.style.display = 'none';
53
54 %             }
55 %           }
56
57           }
58
59 %       }
60
61       }
62
63     </SCRIPT>
64
65     <% include( '/elements/tr-select-pkg_class.html', '',
66                    'pre_options' => [ '0' => 'all' ],
67                    'empty_label' => '(empty class)',
68                )
69     %>
70
71 %   foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) {
72
73       <TR>
74         <TD ALIGN="right" VALIGN="center"><% $label{$field} %></TD>
75         <TD>
76           <TABLE>
77             <% include( '/elements/tr-input-beginning_ending.html',
78                           prefix   => $field,
79                           layout   => 'horiz',
80                       )
81             %>
82           </TABLE>
83         </TD>
84       </TR>
85
86 %   }
87     
88     <% include( '/elements/tr-selectmultiple-part_pkg.html' ) %> 
89
90     <TR>
91       <TH BGCOLOR="#e8e8e8" COLSPAN=2>&nbsp;</TH>
92     </TR>
93
94     <TR>
95       <TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Display options</FONT></TH>
96     </TR>
97     <% include( '/elements/tr-select-cust-fields.html' ) %>
98     
99   </TABLE>
100
101 <BR>
102 <INPUT TYPE="submit" VALUE="Get Report">
103
104 </FORM>
105
106 <% include('/elements/footer.html') %>
107 <%init>
108
109 die "access denied"
110   unless $FS::CurrentUser::CurrentUser->access_right('List packages');
111
112 </%init>
113 <%once>
114
115 my %label = (
116   'setup'     => 'Setup',
117   'last_bill' => 'Last bill',
118   'bill'      => 'Next bill',
119   'adjourn'   => 'Adjourns',
120   'susp'      => 'Suspended',
121   'expire'    => 'Expires',
122   'cancel'    => 'Cancelled',
123 );
124
125 #false laziness w/cust_pkg.cgi
126 my %disable = (
127   'all'             => {},
128   'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, },
129   'active'          => { 'susp'=>1, 'cancel'=>1 },
130   'suspended'       => { 'cancel' => 1 },
131   'cancelled'       => {},
132   ''                => {},
133 );
134
135 #hmm?
136 my %checkbox = (
137   'setup'     => 0,
138   'last_bill' => 0,
139   'bill'      => 0,
140   'susp'      => 1,
141   'expire'    => 1,
142   'cancel'    => 1,
143 );
144
145 </%once>