-<% include( 'elements/search.html',
+<& elements/search.html,
'html_init' => '<H2>Part VI</H2>',
'html_foot' => $html_foot,
'name' => 'regions',
'links' => \@links,
'url' => $opt{url} || '',
'xml_row_element' => 'Datarow',
- )
-%>
+ 'really_disable_download' => 1,
+
+&>
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
$state_pkgcount{$state} += $row->quantity;
$row->quantity;
},
- sub { my $row = shift; sprintf "%.2f", $row->residential },
+ sub { my $row = shift; sprintf "%.3f", $row->residential },
;
-push @links, ( [ $link, $link_suffix ] x 8 );
my %search_hash = ();
my @sql_query = ();
-for ( qw(agentnum magic) ) {
+for ( qw(agentnum state) ) {
$search_hash{$_} = $cgi->param($_) if $cgi->param($_);
}
+
+$search_hash{'active'} = [ $opt{date}, $opt{date} ];
+$search_hash{'country'} = 'US';
$search_hash{'classnum'} = [ $cgi->param('classnum') ]
if grep { $_ eq 'classnum' } $cgi->param;
($report_option ? ( 'report_option' => $report_option ) : () ),
}
);
+warn Dumper($sql_query) if $rowcount==1 and $columncount==3;
my $extracolumns = "$rowcount AS upload, $columncount AS download, $tech_code as technology_code";
my $percent = "CASE WHEN count(*) > 0 THEN 100-100*cast(count(cust_main.company) as numeric)/cast(count(*) as numeric) ELSE cast(0 as numeric) END AS residential";
- $sql_query->{select} = "count(*) AS quantity, $extracolumns, censustract, $percent";
- $sql_query->{order_by} =~ /^(.*)(ORDER BY pkgnum)(.*)$/s
- or die "couldn't parse order_by";
- $sql_query->{order_by} = "$1 GROUP BY censustract $3";
+ $sql_query->{select} = "count(*) AS quantity, $extracolumns, cust_location.censustract, $percent";
+ $sql_query->{order_by} = " GROUP BY cust_location.censustract ";
push @sql_query, $sql_query;
}
$columncount++;
map { my $addl_from = $_->{addl_from};
my $extra_sql = $_->{extra_sql};
my $order_by = $_->{order_by};
- "SELECT censustract from cust_pkg $addl_from $extra_sql $order_by";
+ "SELECT cust_location.censustract from cust_pkg $addl_from
+ $extra_sql $order_by";
}
@sql_query
). ') ) AS foo';
+
my $link = 'cust_pkg.cgi?'. join(';',
map { my $key = $_;
my @values = ref($search_hash{$_})
$result;
};
+for (1..8) { push @links, [ $link, $link_suffix ]; }
+
+
my $html_foot = sub {
if (scalar(keys %state_hash) > 1) {