a2316e257d7894c50432fe4a02ef501a0bc19b12
[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 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
35                 what.form.<% $field %>_beginning_button.style.display = 'none';
36                 what.form.<% $field %>_ending_button.style.display = 'none';
37                 what.form.<% $field %>_beginning_disabled.style.display = '';
38                 what.form.<% $field %>_ending_disabled.style.display = '';
39
40 %             } else {
41
42                 what.form.<% $field %>_beginning_text.disabled = false;
43                 what.form.<% $field %>_ending_text.disabled = false;
44
45                 what.form.<% $field %>_beginning_button.style.display = '';
46                 what.form.<% $field %>_ending_button.style.display = '';
47                 what.form.<% $field %>_beginning_disabled.style.display = 'none';
48                 what.form.<% $field %>_ending_disabled.style.display = 'none';
49
50 %             }
51 %           }
52
53           }
54
55 %       }
56
57       }
58
59     </SCRIPT>
60
61     <% include( '/elements/tr-select-pkg_class.html', '',
62                    'pre_options' => [ '0' => 'all' ],
63                    'empty_label' => '(empty class)',
64                )
65     %>
66
67 %   foreach my $field (qw( setup last_bill bill susp expire cancel )) {
68
69       <TR>
70         <TD ALIGN="right" VALIGN="center"><% $label{$field} %></TD>
71         <TD>
72           <TABLE>
73             <% include( '/elements/tr-input-beginning_ending.html',
74                           prefix   => $field,
75                           layout   => 'horiz',
76                       )
77             %>
78           </TABLE>
79         </TD>
80       </TR>
81
82 %   }
83     
84     <% include( '/elements/tr-selectmultiple-part_pkg.html' ) %> 
85
86     <TR>
87       <TH BGCOLOR="#e8e8e8" COLSPAN=2>&nbsp;</TH>
88     </TR>
89
90     <TR>
91       <TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Display options</FONT></TH>
92     </TR>
93     <% include( '/elements/tr-select-cust-fields.html' ) %>
94     
95   </TABLE>
96
97 <BR>
98 <INPUT TYPE="submit" VALUE="Get Report">
99
100 </FORM>
101
102 <% include('/elements/footer.html') %>
103 <%init>
104
105 die "access denied"
106   unless $FS::CurrentUser::CurrentUser->access_right('List packages');
107
108 </%init>
109 <%once>
110
111 my %label = (
112   'setup'     => 'Setup',
113   'last_bill' => 'Last bill',
114   'bill'      => 'Next bill',
115   'susp'      => 'Suspended',
116   'expire'    => 'Expires',
117   'cancel'    => 'Cancelled',
118 );
119
120 #false laziness w/cust_pkg.cgi
121 my %disable = (
122   'all'             => {},
123   'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, },
124   'active'          => { 'susp'=>1, 'cancel'=>1 },
125   'suspended'       => { 'cancel' => 1 },
126   'cancelled'       => {},
127   ''                => {},
128 );
129
130 #hmm?
131 my %checkbox = (
132   'setup'     => 0,
133   'last_bill' => 0,
134   'bill'      => 0,
135   'susp'      => 1,
136   'expire'    => 1,
137   'cancel'    => 1,
138 );
139
140 </%once>