Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / search / report_477.html
1 <% include('/elements/header.html', 'FCC Form 477 Report' ) %>
2
3 <FORM ACTION="477.html" METHOD="GET">
4 <INPUT TYPE="hidden" NAME="magic" VALUE="active">
5
6   <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
7
8     <TR>
9       <TH CLASS="background" 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 %   # not tr-select-state, we only want to choose from among those that 
21 %   # have customers
22     <& /elements/tr-select-table.html,
23         'label'         => 'State',
24         'field'         => 'state',
25         'table'         => 'cust_location',
26         'name_col'      => 'state',
27         'value_col'     => 'state',
28         'disable_empty' => 1,
29         'records'       => \@states,
30     &>
31
32     <% include( '/elements/tr-select-pkg_class.html',
33                    'multiple'       => 1,
34                    'empty_label' => '(empty class)',
35                )
36     %>
37
38     <SCRIPT type="text/javascript">
39       function partchange(what) {
40         var id = 'part' + what.value;
41         var element = document.getElementById(id);
42         if (what.checked) {
43           element.style.display = '';
44         } else {
45           element.style.display = 'none';
46         }
47       }
48       function toggleV() {
49         document.getElementById('enableV').disabled =
50           ! (document.getElementById('enableIIA').checked ||
51              document.getElementById('enableIIB').checked);
52       }
53       function toggleVI() {
54         document.getElementById('enableVI').disabled =
55           ! document.getElementById('enableIA').checked;
56       }
57     </SCRIPT>
58
59     <% include( '/elements/tr-checkbox.html',
60                    'label' => 'Enable part IA?',
61                    'field' => 'part',
62                    'id'    => 'enableIA',
63                    'value' => 'IA',
64                    'onchange' => 'partchange(this); toggleVI();',
65                )
66     %>
67
68     <TR id='partIA' style="display:none"><TD>Part IA</TD><TD><TABLE>
69       <TR><TD>Download speeds</TD><TD>
70         <TABLE>
71 %       my $i = 0;
72 %       foreach my $speed ( @FS::Report::FCC_477::download ) {
73           <TR>
74             <TH><% $speed %></TH>
75             <TD>
76             <% include( '/elements/select-table.html',
77                            'table'        => 'part_pkg_report_option',
78                            'name_col'     => 'name',
79                            'hashref'      => { 'disabled' => '' },
80                            'element_name' => 'part1_column_option',
81                            'disable_empty' => 1,
82                            'curr_value'   =>
83                                 FS::Report::FCC_477::restore_fcc477map("part1_column_option_$i"),
84                        )
85             %>
86             </TD>
87           </TR>
88 %       $i++
89 %       }
90         </TABLE></TD>
91       <TD>Upload speeds</TD><TD>
92         <TABLE>
93 %       $i = 0;
94 %       foreach my $speed ( @FS::Report::FCC_477::upload ) {
95           <TR>
96             <TH><% $speed %></TH>
97             <TD>
98             <% include( '/elements/select-table.html',
99                            'table'        => 'part_pkg_report_option',
100                            'name_col'     => 'name',
101                            'hashref'      => { 'disabled' => '' },
102                            'element_name' => 'part1_row_option',
103                            'disable_empty' => 1,
104                            'curr_value'   =>
105                                 FS::Report::FCC_477::restore_fcc477map("part1_row_option_$i"),
106                        )
107             %>
108             </TD>
109           </TR>
110 %       $i++
111 %       }
112         </TABLE></TD></TR>
113       <TR><TD>Technologies</TD><TD>
114         <TABLE>
115 %       $i = 0;
116 %       foreach my $tech ( @FS::Report::FCC_477::technology ) {
117           <TR>
118             <TH><% $tech %></TH>
119             <TD>
120             <% include( '/elements/select-table.html',
121                            'table'        => 'part_pkg_report_option',
122                            'name_col'     => 'name',
123                            'hashref'      => { 'disabled' => '' },
124                            'element_name' => "part1_technology_option_$i",
125                            'empty_label'  => '(omit)',
126                            'curr_value'   =>
127                                 FS::Report::FCC_477::restore_fcc477map("part1_technology_option_$i"),
128                        )
129             %>
130             </TD>
131           </TR>
132 %       $i++
133 %       }
134         </TABLE></TD></TR>
135     </TABLE></TD></TR>
136
137     <% include( '/elements/tr-checkbox.html',
138                    'label' => 'Enable part IIA?',
139                    'field' => 'part',
140                    'id'    => 'enableIIA',
141                    'value' => 'IIA',
142                    'onchange' => 'partchange(this); toggleV();',
143                )
144     %>
145
146     <TR id='partIIA' style="display:none"><TD>Part IIA</TD><TD><TABLE>
147 %   $i = 0;
148 %   foreach my $option ( @FS::Report::FCC_477::part2aoption ) {
149     <TR>
150       <TH><% $option %></TH>
151       <TD>
152       <% include( '/elements/select-table.html',
153                      'table'        => 'part_pkg_report_option',
154                      'name_col'     => 'name',
155                      'hashref'      => { 'disabled' => '' },
156                      'element_name' => 'part2a_row_option',
157                      'curr_value'   =>
158                            FS::Report::FCC_477::restore_fcc477map("part2a_row_option_$i"),
159                  )
160       %>
161       </TD>
162     </TR>
163 %    $i++
164 %   }
165   </TABLE></TD></TR>
166
167     <% include( '/elements/tr-checkbox.html',
168                    'label' => 'Enable part IIB?',
169                    'field' => 'part',
170                    'id'    => 'enableIIB',
171                    'value' => 'IIB',
172                    'onchange' => 'partchange(this); toggleV();',
173                )
174     %>
175
176     <TR id='partIIB' style="display:none"><TD>Part IIB</TD><TD><TABLE>
177 %   $i = 0;
178 %   foreach my $option ( @FS::Report::FCC_477::part2boption ) {
179     <TR>
180       <TH><% $option %></TH>
181       <TD>
182       <% include( '/elements/select-table.html',
183                      'table'        => 'part_pkg_report_option',
184                      'name_col'     => 'name',
185                      'hashref'      => { 'disabled' => '' },
186                      'element_name' => 'part2b_row_option',
187                       'curr_value'   =>
188                             FS::Report::FCC_477::restore_fcc477map("part2b_row_option_$i"),
189                  )
190       %>
191       </TD>
192     </TR>
193 %    $i++
194 %   }
195   </TABLE></TD></TR>
196
197     <% include( '/elements/tr-checkbox.html',
198                    'label' => 'Enable part IV?',
199                    'field' => 'part',
200                    'id'    => 'enableIV', #unused
201                    'value' => 'IV',
202                    'onchange' => 'partchange(this)',
203                )
204     %>
205
206     <TR id='partIV' style="display:none"><TD>Part IV</TD><TD><TABLE>
207     <% include( '/elements/tr-textarea.html',
208                    'label'        => 'Explanatory notes',
209                    'id'           => 'partIV',
210                    'field'         => 'notes',
211                    'rows'         => 15,
212                    'cols'         => 80,
213                )
214     %>
215   </TABLE></TD></TR>
216
217     <% include( '/elements/tr-checkbox.html',
218                    'label' => 'Enable part V?',
219                    'field' => 'part',
220                    'value' => 'V',
221                    'id'    => 'enableV',
222                    'onchange' => 'partchange(this)',
223                    'postfix'  => 
224                     '&nbsp;<FONT SIZE="-1">(requires Part IIA or IIB)</FONT>',
225                )
226     %>
227     <TR id='partV' style="display:none">
228         <TD>Part V</TD>
229         <TD>
230             <% include( '/elements/select-table.html',
231                      'table'        => 'part_pkg_report_option',
232                      'name_col'     => 'name',
233                      'hashref'      => { 'disabled' => '' },
234                      'element_name' => 'part5_report_option',
235                      'curr_value'   =>
236                             FS::Report::FCC_477::restore_fcc477map("part5_report_option"),
237                  )
238             %>
239         </TD>
240     </TR>
241
242
243     <% include( '/elements/tr-checkbox.html',
244                    'label' => 'Enable part VI?',
245                    'field' => 'part',
246                    'id'    => 'enableVI',
247                    'value' => 'VI_census',
248                    'postfix'  =>
249                     '&nbsp;<FONT SIZE="-1">(requires part IA)</FONT>',
250                )
251     %>
252   <SCRIPT TYPE="text/javascript">
253   toggleV();
254   toggleVI();
255   </SCRIPT>
256   </TABLE>
257
258 <BR>
259 <INPUT TYPE="submit" VALUE="Get Report">
260
261 </FORM>
262
263 <% include('/elements/footer.html') %>
264 <%init>
265
266 die "access denied"
267   unless $FS::CurrentUser::CurrentUser->access_right('List packages');
268
269 my @states = qsearch({
270   'table'   => 'cust_location',
271   'select'  => 'DISTINCT(state)',
272   'hashref' => { 'country' => 'US' }, # 477 report isn't relevant elsewhere
273 });
274
275 </%init>