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>Exemption</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
58 || $hashref->{setuptax} ne $regions[$i+$j]->setuptax
59 || $hashref->{recurtax} ne $regions[$i+$j]->recurtax;
63 if ( $j>1 && $i+$j+1 < @regions
64 && ( $hashref->{state} ne $regions[$i+$j+1]->state
65 || $hashref->{country} ne $regions[$i+$j+1]->country
68 || $hashref->{state} ne $regions[$i-1]->state
69 || $hashref->{country} ne $regions[$i-1]->country
77 print "<TD ROWSPAN=$j", $hashref->{state}
78 ? ' BGCOLOR="#ffffff">'. $hashref->{state}
79 : qq! BGCOLOR="#cccccc">(ALL) <FONT SIZE=-1>!.
80 qq!<A HREF="${p}edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}.
81 qq!">expand country</A></FONT>!;
83 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;
91 if ( $hashref->{county} ) {
92 print ' BGCOLOR="#ffffff">'. $hashref->{county};
94 print ' BGCOLOR="#cccccc">(ALL)';
95 if ( $hashref->{state} ) {
96 print qq!<FONT SIZE=-1>!.
97 qq!<A HREF="${p}edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}.
98 qq!">expand state</A></FONT>!;
104 if ( $hashref->{taxclass} ) {
105 print ' BGCOLOR="#ffffff">'. $hashref->{taxclass};
107 print ' BGCOLOR="#cccccc">(ALL)';
108 if ( $enable_taxclasses ) {
109 print qq!<FONT SIZE=-1>!.
110 qq!<A HREF="${p}edit/cust_main_county-expand.cgi?taxclass!.
111 $hashref->{taxnum}. qq!">expand taxclasses</A></FONT>!;
118 if ( $hashref->{taxname} ) {
119 print ' BGCOLOR="#ffffff">'. $hashref->{taxname};
121 print ' BGCOLOR="#cccccc">Tax';
125 print "<TD BGCOLOR=\"#ffffff\">$hashref->{tax}%</TD>".
126 '<TD BGCOLOR="#ffffff">';
127 print '$'. sprintf("%.2f", $hashref->{exempt_amount} ).
128 ' per month<BR>'
129 if $hashref->{exempt_amount} > 0;
130 print 'Setup fee<BR>' if $hashref->{setuptax} =~ /^Y$/i;
131 print 'Recurring fee<BR>' if $hashref->{recurtax} =~ /^Y$/i;