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