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