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