<% include('/elements/header-popup.html', ucfirst($action). ' Tax Rates') %> <% include('/elements/error.html') %>
This will <% $action %> <% $count %> tax <% $count == 1 ? 'rate' : 'rates' %>. Are you certain you want to do this?

<%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); my $action = ''; if ( $cgi->param('action') =~ /^(\w+)$/ ) { $action = $1; } my $data_vendor = ''; if ( $cgi->param('data_vendor') =~ /^(\w+)$/ ) { $data_vendor = $1; } my $geocode = ''; if ( $cgi->param('geocode') =~ /^(\w+)$/ ) { $geocode = $1; } my $taxclassnum = ''; if ( $cgi->param('taxclassnum') =~ /^(\d+)$/ ) { $taxclassnum = $1; my $tax_class = qsearchs('tax_class', {'taxclassnum' => $taxclassnum}); $taxclassnum = '' unless ($tax_class); } my $tax_type = $1 if ( $cgi->param('tax_type') =~ /^(\d+)$/ ); my $tax_cat = $1 if ( $cgi->param('tax_cat') =~ /^(\d+)$/ ); my @taxclassnum = (); if ($tax_type || $tax_cat ) { my $compare = "LIKE '". ( $tax_type || "%" ). ":". ( $tax_cat || "%" ). "'"; $compare = "= '$tax_type:$tax_cat'" if ($tax_type && $tax_cat); my @tax_class = qsearch({ 'table' => 'tax_class', 'hashref' => {}, 'extra_sql' => "WHERE taxclass $compare", }); if (@tax_class) { @taxclassnum = map { $_->taxclassnum } @tax_class; $tax_class[0]->description =~ /^(.*):(.*)/; }else{ $tax_type = ''; $tax_cat = ''; } } my $extra_sql = ''; if ( $data_vendor ) { $extra_sql .= ' WHERE data_vendor = '. dbh->quote($data_vendor); } if ( $geocode ) { $extra_sql .= ( $extra_sql =~ /WHERE/i ? ' AND ' : ' WHERE ' ). ' geocode LIKE '. dbh->quote($geocode.'%'); } if ( $taxclassnum ) { $extra_sql .= ( $extra_sql =~ /WHERE/i ? ' AND ' : ' WHERE ' ). ' taxclassnum = '. dbh->quote($taxclassnum); } if ( @taxclassnum ) { $extra_sql .= ( $extra_sql =~ /WHERE/i ? ' AND ' : ' WHERE ' ). join(' OR ', map { " taxclassnum = $_ " } @taxclassnum ); } my $count_query = "SELECT COUNT(*) FROM tax_rate $extra_sql"; my $count_sth = dbh->prepare($count_query) or die "Error preparing $count_query: ". dbh->errstr; $count_sth->execute or die "Error executing $count_query: ". $count_sth->errstr; my $count = $count_sth->fetchrow_arrayref->[0];