<% include('/elements/header-popup.html', $title ) %>
" METHOD="POST"> <% include('/elements/tr-td-label.html', 'label' => 'Country' ) %> <% include('/elements/tr-td-label.html', 'label' => 'State' ) %> % if ( $counties ) { <% include('/elements/tr-td-label.html', 'label' => 'County' ) %> % } % if ( $cities ) { <& /elements/tr-td-label.html, 'label' => 'City' &> % } % if ( $districts ) { <& /elements/tr-td-label.html, 'label' => 'District' &> % } % if ( $conf->exists('enable_taxclasses') && $taxclasses ) { <% include('/elements/tr-td-label.html', 'label' => 'Tax Class' ) %> % } % unless ($rate_only) { <% include('/elements/tr-input-text.html', 'field' => 'taxname', 'label' => 'Tax name' ) %> % } <% include('/elements/tr-input-percentage.html', 'field' => 'tax', 'label' => 'Tax rate', ) %> % unless ($rate_only) { <% include('/elements/tablebreak-tr-title.html', value=>'Exemptions' ) %> <% include('/elements/tr-checkbox.html', 'field' => 'setuptax', 'value' => 'Y', 'label' => 'This tax not applicable to setup fees', ) %> <% include('/elements/tr-checkbox.html', 'field' => 'recurtax', 'value' => 'Y', 'label' => 'This tax not applicable to recurring fees', ) %> <% include('/elements/tr-input-money.html', 'field' => 'exempt_amount', 'label' => 'Monthly exemption per customer ($25 "Texas tax")', ) %> % }
<% $countries %>
<% $states %>
<% $counties %>
<% $cities %>
<% $districts %>
<% $taxclasses %>

<%init> my $conf = new FS::Conf; die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); my @taxnum; $cgi->param('taxnum') =~ /^([\d,]+)$/ or $m->comp('/elements/errorpage-popup.html', $cgi->param('error') || 'Nothing selected'); my @taxnum = split(',', $1); $cgi->param('action') =~ /^(add|edit|edit_rate_only)$/ or die "unknown action"; my $action = $1; my $rate_only; if ($action eq "edit_rate_only") { $action = "edit"; $rate_only = 1; } my $title = "Bulk $action tax rate"; my @cust_main_county = map { qsearchs('cust_main_county', { 'taxnum' => $_ }) or die "unknown taxnum $1"; } @taxnum; my %seen_country = {}; my @countries = map FS::geocode_Mixin->code2country($_)." ($_)", grep !$seen_country{$_}++, map $_->country, @cust_main_county; my $countries = join(', ', @countries); my %seen_state = {}; my @states = map state_label($_->[0], $_->[1]), grep !$seen_state{$_->[0]}++, map [ $_->state, $_->country ], @cust_main_county; my $states = join(', ', @states); my %seen_county = {}; my @counties = grep !$seen_county{$_}++, map $_->county, @cust_main_county; my $counties = join(', ', @counties); my %seen_city = ( map { $_->city => 1 } @cust_main_county ); my @cities = grep $_, keys %seen_city; my $cities = join(', ', @cities); my @districts = grep $_, map { $_->district } @cust_main_county; my $districts = join(', ', @districts); my %seen_taxclass = {}; my @taxclasses = grep !$seen_taxclass{$_}++, map $_->taxclass, @cust_main_county; my $taxclasses = join(', ', @taxclasses); #my @fields = ( # { field=>'country', type=>'fixed-country', }, # { field=>'state', type=>'fixed-state', }, # { field=>'county', type=>'fixed', }, #); #push @fields, { field=>'taxclass', type=>'fixed', } # if $conf->exists('enable_taxclasses');