1 <% include( 'elements/search.html',
2 'html_init' => $html_init,
5 'count_query' => 'SELECT 1',
6 'really_disable_download' => 1,
7 'disable_download' => 1,
13 '% billed to end users',
15 '% residential > 200kbps',
28 sub { $total_percentage },
29 sub { $above_200_percentage },
35 my $curuser = $FS::CurrentUser::CurrentUser;
38 unless $curuser->access_right('List packages');
43 for ( qw(agentnum magic) ) {
44 $search_hash{$_} = $cgi->param($_) if $cgi->param($_);
46 $search_hash{'classnum'} = [ $cgi->param('classnum') ];
48 my @column_option = grep { /^\d+$/ } $cgi->param('part1_column_option')
49 if $cgi->param('part1_column_option');
51 my @row_option = grep { /^\d+$/ } $cgi->param('part1_row_option')
52 if $cgi->param('part1_row_option');
54 my @technology_option = &FS::Report::FCC_477::parse_technology_option($cgi);
57 my $total_residential = 0;
59 my $tech_code = $opt{tech_code};
60 my $technology = $FS::Report::FCC_477::technology[$tech_code] || 'unknown';
61 my $html_init = "<H2>Part IA $technology totals</H2>";
62 my $xml_prefix = 'PartIA_'. chr(65 + $tech_code);
64 my $not_first_row = 0; # ugh;
65 foreach my $row ( @row_option ) {
66 foreach my $column ( @column_option ) {
68 my @report_option = ( $row || '-1', $column || '-1', $technology_option[$tech_code] );
70 my ( $count, $residential ) = FS::cust_pkg->fcc_477_count(
71 { %search_hash, 'report_option' => join(',', @report_option) }
74 $total_count += $count;
75 $total_residential += $residential;
76 $above_200 += $residential if $not_first_row;
81 my $total_percentage =
82 sprintf("%.2f", $total_count ? 100*$total_residential/$total_count : 0);
84 my $above_200_percentage =
85 sprintf("%.2f", $total_count ? 100*$above_200/$total_count : 0);