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>
24 <TH>Taxclass<BR><FONT SIZE=-1>(per-package classification)</FONT></TH>
25 <TH>Tax name<BR><FONT SIZE=-1>(printed on invoices)</FONT></TH>
26 <TH><FONT SIZE=-1>Tax</FONT></TH>
27 <TH><FONT SIZE=-1>Exempt<BR>per<BR>month</TH>
31 my @regions = sort { $a->country cmp $b->country
32 or $a->state cmp $b->state
33 or $a->county cmp $b->county
34 or $a->taxclass cmp $b->taxclass
35 } qsearch('cust_main_county',{});
38 #foreach $cust_main_county ( @regions ) {
39 for ( my $i=0; $i<@regions; $i++ ) {
40 my $cust_main_county = $regions[$i];
41 my $hashref = $cust_main_county->hashref;
44 <TD BGCOLOR="#ffffff">$hashref->{country}</TD>
53 for ( $j=1; $i+$j<@regions; $j++ ) {
54 last if $hashref->{country} ne $regions[$i+$j]->country
55 || $hashref->{state} ne $regions[$i+$j]->state
56 || $hashref->{tax} != $regions[$i+$j]->tax
57 || $hashref->{exempt_amount} != $regions[$i+$j]->exempt_amount;
61 if ( $j>1 && $i+$j+1 < @regions
62 && ( $hashref->{state} ne $regions[$i+$j+1]->state
63 || $hashref->{country} ne $regions[$i+$j+1]->country
66 || $hashref->{state} ne $regions[$i-1]->state
67 || $hashref->{country} ne $regions[$i-1]->country
75 print "<TD ROWSPAN=$j", $hashref->{state}
76 ? ' BGCOLOR="#ffffff">'. $hashref->{state}
77 : qq! BGCOLOR="#cccccc">(ALL) <FONT SIZE=-1>!.
78 qq!<A HREF="${p}edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}.
79 qq!">expand country</A></FONT>!;
81 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;
89 if ( $hashref->{county} ) {
90 print ' BGCOLOR="#ffffff">'. $hashref->{county};
92 print ' BGCOLOR="#cccccc">(ALL)';
93 if ( $hashref->{state} ) {
94 print qq!<FONT SIZE=-1>!.
95 qq!<A HREF="${p}edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}.
96 qq!">expand state</A></FONT>!;
102 if ( $hashref->{taxclass} ) {
103 print ' BGCOLOR="#ffffff">'. $hashref->{taxclass};
105 print ' BGCOLOR="#cccccc">(ALL)';
106 if ( $enable_taxclasses ) {
107 print qq!<FONT SIZE=-1>!.
108 qq!<A HREF="${p}edit/cust_main_county-expand.cgi?taxclass!.
109 $hashref->{taxnum}. qq!">expand taxclasses</A></FONT>!;
116 if ( $hashref->{taxname} ) {
117 print ' BGCOLOR="#ffffff">'. $hashref->{taxname};
119 print ' BGCOLOR="#cccccc">Tax';
123 print "<TD BGCOLOR=\"#ffffff\">$hashref->{tax}%</TD>".
124 '<TD BGCOLOR="#ffffff">$'.
125 sprintf("%.2f", $hashref->{exempt_amount} || 0). '</TD>'.