% foreach my $region ( @regions ) {
%
% my $link = '';
-% if ( $region->{'label'} ne 'Total' ) {
-% if ( $region->{'label'} eq $out ) {
-% $link = ';out=1';
-% } else {
-% $link = ';'. $region->{'url_param'};
-% }
+% if ( $region->{'label'} eq $out ) {
+% $link = ';out=1';
+% } else {
+% $link = ';'. $region->{'url_param'}
+% if $region->{'url_param'};
% }
%
% if ( $bgcolor eq $bgcolor1 ) {
% foreach my $region ( @base_regions ) {
%
% my $link = '';
-% #if ( $region->{'label'} ne 'Total' ) {
-% if ( $region->{'label'} eq $out ) {
-% $link = ';out=1';
-% } else {
-% $link = ';'. $region->{'url_param'};
-% }
-% #}
+% if ( $region->{'label'} eq $out ) {
+% $link = ';out=1';
+% } else {
+% $link = ';'. $region->{'url_param'}
+% if $region->{'url_param'};
+% }
%
% if ( $bgcolor eq $bgcolor1 ) {
% $bgcolor = $bgcolor2;
my $out = 'Out of taxable region(s)';
my %regions = ();
+my %taxclasses = ();
foreach my $r ( qsearch({ 'table' => 'cust_main_county',
'extra_sql' => $gotcust,
$regions{$label}->{'url_param'} .= ';taxclass='. uri_escape($r->taxclass);
#no, always# if $cgi->param('show_taxclasses');
+ $taxclasses{$r->taxclass} = 1;
+
} else {
$regions{$label}->{'url_param'} .= ';taxclassNULL=1'
@regions = grep &{$group_test}($_), @regions
if $group_op;
-#now calculate totals
+#ordering
+@regions =
+ map $regions{$_},
+ sort { ( ($a eq $out) cmp ($b eq $out) ) || ($b cmp $a) }
+ @regions;
+
+my @base_regions =
+ map $base_regions{$_},
+ sort { ( ($a eq $out) cmp ($b eq $out) ) || ($b cmp $a) }
+ keys %base_regions;
+
+#totals
my( $total, $tot_taxable, $tot_owed ) = ( 0, 0, 0 );
my( $exempt_cust, $exempt_pkg, $exempt_monthly ) = ( 0, 0, 0 );
foreach (@regions) {
$exempt_monthly += $regions{$_}->{'exempt_monthly'};
}
-#ordering
-@regions =
- map $regions{$_},
- sort { ( ($a eq $out) cmp ($b eq $out) ) || ($b cmp $a) }
- @regions;
+my $total_url_param = '';
-my @base_regions =
- map $base_regions{$_},
- sort { ( ($a eq $out) cmp ($b eq $out) ) || ($b cmp $a) }
- keys %base_regions;
+if ( $group_op ) {
+ $total_url_param = 'report_group='.uri_escape("$group_op $group_value").';'.
+ join(';', 'taxclass = '.dbh->quote($_), keys %taxclasses );
+}
push @regions, {
'label' => 'Total',
- 'url_param' => '',
+ 'url_param' => $total_url_param,
'total' => $total,
'exempt_cust' => $exempt_cust,
'exempt_pkg' => $exempt_pkg,