- $hashref->{country}
-END
-
- my $j;
- if ( $sup ) {
- $sup--;
- } else {
-
- #lookahead
- for ( $j=1; $i+$j<@regions; $j++ ) {
- last if $hashref->{country} ne $regions[$i+$j]->country
- || $hashref->{state} ne $regions[$i+$j]->state
- || $hashref->{tax} != $regions[$i+$j]->tax
- || $hashref->{exempt_amount} != $regions[$i+$j]->exempt_amount
- || $hashref->{setuptax} ne $regions[$i+$j]->setuptax
- || $hashref->{recurtax} ne $regions[$i+$j]->recurtax;
- }
+my $state = '';
+if ( $cgi->param('state') =~ /^([\w \-\'\[\]]+)$/ ) {
+ $state = $1;
+ $title = "$state, $title";
+}
+$cgi->delete('state');
- my $newsup=0;
- if ( $j>1 && $i+$j+1 < @regions
- && ( $hashref->{state} ne $regions[$i+$j+1]->state
- || $hashref->{country} ne $regions[$i+$j+1]->country
- )
- && ( ! $i
- || $hashref->{state} ne $regions[$i-1]->state
- || $hashref->{country} ne $regions[$i-1]->country
- )
- ) {
- $sup = $j-1;
- } else {
- $j = 1;
- }
+my $county = '';
+if ( $cgi->param('county') =~ /^([\w \-\'\[\]]+)$/ ) {
+ $county = $1;
+ $title = "$county county, $title";
+}
+$cgi->delete('county');
- print "{state}
- ? ' BGCOLOR="#ffffff">'. $hashref->{state}
- : qq! BGCOLOR="#cccccc">(ALL) !.
- qq!expand country !;
+$title = " for $title" if $title;
- print qq! collapse state ! if $j>1;
+my $taxclass = '';
+if ( $cgi->param('taxclass') =~ /^([\w \-]+)$/ ) {
+ $taxclass = $1;
+ $title .= " for $taxclass tax class";
+}
+$cgi->delete('taxclass');
- print " ";
- }
+if ( $country || $taxclass ) {
+ push @menubar, 'View all tax rates' => $p.'browse/cust_main_county.cgi';
+}
-# $sup=$newsup;
-
- print "{county} ) {
- print ' BGCOLOR="#ffffff">'. $hashref->{county};
- } else {
- print ' BGCOLOR="#cccccc">(ALL)';
- if ( $hashref->{state} ) {
- print qq!!.
- qq!expand state !;
- }
- }
- print " ";
-
- print "{taxclass} ) {
- print ' BGCOLOR="#ffffff">'. $hashref->{taxclass};
- } else {
- print ' BGCOLOR="#cccccc">(ALL)';
- if ( $enable_taxclasses ) {
- print qq!!.
- qq!expand taxclasses !;
- }
+$cgi->param('dummy', 1);
- }
- print " ";
+my $country_filter_change =
+ "window.location = '".
+ $cgi->self_url. ";country=' + this.options[this.selectedIndex].value;";
- print "{taxname} ) {
- print ' BGCOLOR="#ffffff">'. $hashref->{taxname};
- } else {
- print ' BGCOLOR="#cccccc">Tax';
- }
- print " ";
+#restore this so pagination works
+$cgi->param('country', $country) if $country;
+$cgi->param('state', $state ) if $state;
+$cgi->param('county', $county ) if $county;
+$cgi->param('taxclass', $county ) if $taxclass;
- print "$hashref->{tax}% ".
- '';
- print '$'. sprintf("%.2f", $hashref->{exempt_amount} ).
- ' per month '
- if $hashref->{exempt_amount} > 0;
- print 'Setup fee ' if $hashref->{setuptax} =~ /^Y$/i;
- print 'Recurring fee ' if $hashref->{recurtax} =~ /^Y$/i;
- print ' ';
+my $html_posttotal =
+ '(show country: '.
+ qq().
+ qq((all)\n).
+ join("\n", map qq[ '. code2country($_). " ($_)",
+ @all_countries
+ ).
+ ' )';
+my $hashref = {};
+my $count_query = 'SELECT COUNT(*) FROM cust_main_county';
+if ( $country ) {
+ $hashref->{'country'} = $country;
+ $count_query .= ' WHERE country = '. dbh->quote($country);
+}
+if ( $state ) {
+ $hashref->{'state'} = $state;
+ $count_query .= ' AND state = '. dbh->quote($state);
+}
+if ( $county ) {
+ $hashref->{'country'} = $country;
+ $count_query .= ' AND county = '. dbh->quote($county);
+}
+if ( $taxclass ) {
+ $hashref->{'taxclass'} = $taxclass;
+ $count_query .= ( $count_query =~ /WHERE/i ? ' AND ' : ' WHERE ' ).
+ ' taxclass = '. dbh->quote($taxclass);
}
-print <
-