4 my $conf = new FS::Conf;
5 my $enable_taxclasses = $conf->exists('enable_taxclasses');
7 print header("Tax Rate Listing", menubar(
9 'Edit tax rates' => $p. "edit/cust_main_county.cgi",
11 Click on <u>expand country</u> to specify a country's tax rates by state.
12 <BR>Click on <u>expand state</u> to specify a state's tax rates by county.
15 if ( $enable_taxclasses ) {
16 print '<BR>Click on <u>expand taxclasses</u> to specify tax classes';
19 print '<BR><BR>'. &table(). <<END;
21 <TH><FONT SIZE=-1>Country</FONT></TH>
22 <TH><FONT SIZE=-1>State</FONT></TH>
25 <TH><FONT SIZE=-1>Tax</FONT></TH>
26 <TH><FONT SIZE=-1>Exempt<BR>per<BR>month</TH>
30 my @regions = sort { $a->country cmp $b->country
31 or $a->state cmp $b->state
32 or $a->county cmp $b->county
33 or $a->taxclass cmp $b->taxclass
34 } qsearch('cust_main_county',{});
37 #foreach $cust_main_county ( @regions ) {
38 for ( my $i=0; $i<@regions; $i++ ) {
39 my $cust_main_county = $regions[$i];
40 my $hashref = $cust_main_county->hashref;
43 <TD BGCOLOR="#ffffff">$hashref->{country}</TD>
52 for ( $j=1; $i+$j<@regions; $j++ ) {
53 last if $hashref->{country} ne $regions[$i+$j]->country
54 || $hashref->{state} ne $regions[$i+$j]->state
55 || $hashref->{tax} != $regions[$i+$j]->tax
56 || $hashref->{exempt_amount} != $regions[$i+$j]->exempt_amount;
60 if ( $j>1 && $i+$j+1 < @regions
61 && ( $hashref->{state} ne $regions[$i+$j+1]->state
62 || $hashref->{country} ne $regions[$i+$j+1]->country
65 || $hashref->{state} ne $regions[$i-1]->state
66 || $hashref->{country} ne $regions[$i-1]->country
74 print "<TD ROWSPAN=$j", $hashref->{state}
75 ? ' BGCOLOR="#ffffff">'. $hashref->{state}
76 : qq! BGCOLOR="#cccccc">(ALL) <FONT SIZE=-1>!.
77 qq!<A HREF="${p}edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}.
78 qq!">expand country</A></FONT>!;
80 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;
88 if ( $hashref->{county} ) {
89 print ' BGCOLOR="#ffffff">'. $hashref->{county};
91 print ' BGCOLOR="#cccccc">(ALL)';
92 if ( $hashref->{state} ) {
93 print qq!<FONT SIZE=-1>!.
94 qq!<A HREF="${p}edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}.
95 qq!">expand state</A></FONT>!;
101 if ( $hashref->{taxclass} ) {
102 print ' BGCOLOR="#ffffff">'. $hashref->{taxclass};
104 print ' BGCOLOR="#cccccc">(ALL)';
105 if ( $enable_taxclasses ) {
106 print qq!<FONT SIZE=-1>!.
107 qq!<A HREF="${p}edit/cust_main_county-expand.cgi?taxclass!.
108 $hashref->{taxnum}. qq!">expand taxclasses</A></FONT>!;
114 print "<TD BGCOLOR=\"#ffffff\">$hashref->{tax}%</TD>".
115 '<TD BGCOLOR="#ffffff">$'.
116 sprintf("%.2f", $hashref->{exempt_amount} || 0). '</TD>'.