summaryrefslogtreecommitdiff
path: root/httemplate/search/report_tax.cgi
diff options
context:
space:
mode:
authorivan <ivan>2009-05-27 17:18:36 +0000
committerivan <ivan>2009-05-27 17:18:36 +0000
commit3ceb940d13cbfc54e40e621baa9e8d883d624e6a (patch)
treec62f10464236cc34a28040fa334f22525ec092d6 /httemplate/search/report_tax.cgi
parent15e57a4859d967a13113602b112c4aa197ca6002 (diff)
fix total line links on tax report when using report_group kludge? (possibly not in all corner cases), RT#5446
Diffstat (limited to 'httemplate/search/report_tax.cgi')
-rwxr-xr-xhttemplate/search/report_tax.cgi56
1 files changed, 32 insertions, 24 deletions
diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi
index dc93d51..1d4d8d5 100755
--- a/httemplate/search/report_tax.cgi
+++ b/httemplate/search/report_tax.cgi
@@ -44,12 +44,11 @@
% 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 ) {
@@ -138,13 +137,12 @@
% 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;
@@ -277,6 +275,7 @@ if ( $conf->exists('tax-pkg_address') ) {
my $out = 'Out of taxable region(s)';
my %regions = ();
+my %taxclasses = ();
foreach my $r ( qsearch({ 'table' => 'cust_main_county',
'extra_sql' => $gotcust,
@@ -302,6 +301,8 @@ foreach my $r ( qsearch({ 'table' => 'cust_main_county',
$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'
@@ -528,7 +529,18 @@ my @regions = keys %regions;
@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) {
@@ -540,20 +552,16 @@ 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,