summaryrefslogtreecommitdiff
path: root/httemplate/search/477partIA_detail.html
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/search/477partIA_detail.html')
-rwxr-xr-xhttemplate/search/477partIA_detail.html65
1 files changed, 33 insertions, 32 deletions
diff --git a/httemplate/search/477partIA_detail.html b/httemplate/search/477partIA_detail.html
index 546d56c7f..6fea39109 100755
--- a/httemplate/search/477partIA_detail.html
+++ b/httemplate/search/477partIA_detail.html
@@ -9,6 +9,7 @@
'disable_total' => 1,
'header' => [ '', @column_option_name ],
'xml_elements' => [ @xml_elements ],
+ 'xml_omit_empty' => 1,
'fields' => [ @fields ],
)
%>
@@ -60,9 +61,19 @@ my $technology = $FS::Report::FCC_477::technology[$tech_code] || 'unknown';
my $html_init = "<H2>Part IA $technology breakdown by speeds</H2>";
my $xml_prefix = 'PartIA_'. chr(65 + $tech_code);
+if ($cgi->param('_type') eq 'xml') {
+ #rotate data pi/2
+ my @temp = @column_option;
+ @column_option = @row_option;
+ @row_option = @temp;
+}
+
my $query = 'SELECT '. join(' UNION ALL SELECT ',@row_option);
my $count_query = 'SELECT '. scalar(@row_option);
+my $xml_element = 'OOPS, I was never set';
+my $rowchar = 101; # 'e' -- rows are columns! (pi/2)
+
my $value = sub {
my ($rowref, $column) = (shift, shift);
my $row = $rowref->[0];
@@ -71,7 +82,7 @@ my $value = sub {
return $row_option_name{$row} || 'no such report option';
} elsif ( $column =~ /^(\d+)$/ ) {
my @report_option = ( $row || '',
- $column_option[$1 - 2] || '',
+ $column_option[$column] || '',
$technology_option[$tech_code] || '',
);
@@ -81,45 +92,35 @@ my $value = sub {
my $percentage = sprintf('%.2f', $count ? 100 * $residential / $count : 0);
my $return = $count;
- $return .= "<BR>$percentage% residential"
- unless $cgi->param('_type') eq 'xml';
+
+ if ($cgi->param('_type') eq 'xml') {
+ $rowchar++ if $column == 0;
+ $xml_element = $xml_prefix. chr($rowchar). ($column+1);
+ $return = '' if $count == 0 and $cgi->param('_type') eq 'xml';
+ } else {
+ $return .= "<BR>$percentage% residential";
+ }
+
return $return;
} else {
return '<FONT SIZE="+1" COLOR="#ff0000">Bad call to column_value</FONT>';
}
};
-my @fields = (
- sub { &{$value}(shift, 'name');},
- sub { &{$value}(shift, 2);},
- sub { &{$value}(shift, 3);},
- sub { &{$value}(shift, 4);},
- sub { &{$value}(shift, 5);},
- sub { &{$value}(shift, 6);},
- sub { &{$value}(shift, 7);},
- sub { &{$value}(shift, 8);},
- sub { &{$value}(shift, 9);},
- );
+my @fields = map { my $ci = $_; sub { &{$value}(shift, $ci); } }
+ ( 'name', (0 .. $#column_option) );
shift @fields if $cgi->param('_type') eq 'xml';
-my $xml_element = sub {
- my ($rowref, $column) = (shift, shift);
- my $row = $rowref->[0];
-
- $row++;
- $xml_prefix. $column. $row;
-
-};
-
-my @xml_elements = (
- sub { &{$xml_element}(shift, 'f') },
- sub { &{$xml_element}(shift, 'g') },
- sub { &{$xml_element}(shift, 'h') },
- sub { &{$xml_element}(shift, 'i') },
- sub { &{$xml_element}(shift, 'j') },
- sub { &{$xml_element}(shift, 'k') },
- sub { &{$xml_element}(shift, 'l') },
- sub { &{$xml_element}(shift, 'm') },
+my @xml_elements = ( # -- columns are rows! (pi/2)
+ sub { return $xml_element; },
+ sub { return $xml_element; },
+ sub { return $xml_element; },
+ sub { return $xml_element; },
+ sub { return $xml_element; },
+ sub { return $xml_element; },
+ sub { return $xml_element; },
+ sub { return $xml_element; },
+ sub { return $xml_element; },
);
</%init>