2 #<!-- $Id: cust_main_county.cgi,v 1.3 2001-08-21 09:34:13 ivan Exp $ -->
5 use vars qw( $cgi $p $cust_main_county );
7 use CGI::Carp qw(fatalsToBrowser);
8 use FS::UID qw(cgisuidsetup);
9 use FS::Record qw(qsearch qsearchs);
10 use FS::CGI qw(header menubar popurl table);
11 use FS::cust_main_county;
19 print $cgi->header( '-expires' => 'now' ), header("Tax Rate Listing", menubar(
21 'Edit tax rates' => $p. "edit/cust_main_county.cgi",
23 Click on <u>expand country</u> to specify a country's tax rates by state.
24 <BR>Click on <u>expand state</u> to specify a state's tax rates by county.
27 print &table(), <<END;
29 <TH><FONT SIZE=-1>Country</FONT></TH>
30 <TH><FONT SIZE=-1>State</FONT></TH>
32 <TH><FONT SIZE=-1>Tax</FONT></TH>
36 my @regions = sort { $a->country cmp $b->country
37 or $a->state cmp $b->state
38 or $a->county cmp $b->county
39 } qsearch('cust_main_county',{});
42 #foreach $cust_main_county ( @regions ) {
43 for ( my $i=0; $i<@regions; $i++ ) {
44 my $cust_main_county = $regions[$i];
45 my $hashref = $cust_main_county->hashref;
48 <TD>$hashref->{country}</TD>
57 for ( $j=1; $i+$j<@regions; $j++ ) {
58 last if $hashref->{country} ne $regions[$i+$j]->country
59 || $hashref->{state} ne $regions[$i+$j]->state
60 || $hashref->{tax} != $regions[$i+$j]->tax;
64 if ( $j>1 && $i+$j+1 < @regions
65 && ( $hashref->{state} ne $regions[$i+$j+1]->state
66 || $hashref->{country} ne $regions[$i+$j+1]->country
69 || $hashref->{state} ne $regions[$i-1]->state
70 || $hashref->{country} ne $regions[$i-1]->country
78 print "<TD ROWSPAN=$j>", $hashref->{state}
80 : qq!(ALL) <FONT SIZE=-1>!.
81 qq!<A HREF="${p}edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}.
82 qq!">expand country</A></FONT>!;
84 print qq! <FONT SIZE=-1><A HREF="${p}edit/process/cust_main_county-collapse.cgi?!. $hashref->{taxnum}. qq!">collapse state</A></FONT>! if $j>1;
92 if ( $hashref->{county} ) {
93 print $hashref->{county};
96 if ( $hashref->{state} ) {
97 print qq!<FONT SIZE=-1>!.
98 qq!<A HREF="${p}edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}.
99 qq!">expand state</A></FONT>!;
105 <TD>$hashref->{tax}%</TD>