X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2F477partV.html;h=1d21649f56e9f0eee723e52bea3fa333e8e77cb3;hb=8dba5cb96454bf8ec81333ebac381180731396f1;hp=e0f5e043aa770a1087422a613200ea707621d271;hpb=1d15c6930650f2cceb13f7ae9da4acea5213643f;p=freeside.git diff --git a/httemplate/search/477partV.html b/httemplate/search/477partV.html index e0f5e043a..1d21649f5 100755 --- a/httemplate/search/477partV.html +++ b/httemplate/search/477partV.html @@ -30,24 +30,26 @@ for ( qw(agentnum magic) ) { $search_hash{$_} = $cgi->param($_) if $cgi->param($_); } $search_hash{'classnum'} = [ $cgi->param('classnum') ]; +$search_hash{report_option} = $cgi->param('partv_report_option') + if $cgi->param('partv_report_option'); my $sql_query = FS::cust_pkg->search( { %search_hash, 'fcc_line' > 1 }); -$sql_query->{select} = 'DISTINCT zip'; +$sql_query->{select} = 'DISTINCT substr(zip,1,5) as zip'; $sql_query->{extra_sql} =~ s/ORDER BY [.\w]+//; push @sql_query, $sql_query; push @count_query, delete($sql_query->{'count_query'}); -$count_query[0] =~ s/count\(\*\)/count(DISTINCT zip)/; +$count_query[0] =~ s/COUNT\(\*\)/count(DISTINCT substr(zip,1,5))/; $count_query[0] =~ s/ORDER BY [.\w]+//; -$search_hash{classnum} = $cgi->param('part2a_classnum') - if $cgi->param('part2a_classnum'); +$search_hash{report_option} = $cgi->param('partv_report_option') + if $cgi->param('partv_report_option'); $sql_query = FS::cust_pkg->search( { %search_hash } ); -$sql_query->{select} = 'DISTINCT zip'; +$sql_query->{select} = 'DISTINCT substr(zip,1,5) as zip'; $sql_query->{extra_sql} =~ s/ORDER BY [.\w]+//; push @sql_query, $sql_query; push @count_query, delete($sql_query->{'count_query'}); -$count_query[1] =~ s/count\(\*\)/count(DISTINCT zip)/; +$count_query[1] =~ s/COUNT\(\*\)/count(DISTINCT substr(zip,1,5))/; $count_query[1] =~ s/ORDER BY [.\w]+//; my $count_query = join(' UNION ', @count_query);