-$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 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 substr(zip,1,5))/;
-$count_query[0] =~ s/ORDER BY [.\w]+//;
-
-$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 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 substr(zip,1,5))/;
-$count_query[1] =~ s/ORDER BY [.\w]+//;
-my $count_query = join(' UNION ', @count_query);
+$search_hash{report_option} = $cgi->param('part5_report_option')
+ if $cgi->param('part5_report_option');
+
+my $sql_query = FS::cust_pkg->search( { %search_hash,
+ 'fcc_line' => 1,
+ 'select_zip5' => 1,
+ }
+ );
+my $count_query = delete($sql_query->{'count_query'});
+$count_query =~ s/COUNT\(\*\)/count(DISTINCT substr(zip,1,5))/;
+$count_query =~ s/ORDER BY [.\w]+//;