1 <% include('/elements/header-popup.html', $title ) %>
3 <FORM ACTION="<% popurl(1)."process/bulk-cust_main_county.html" %>" METHOD="POST">
5 <INPUT TYPE="hidden" NAME="action" VALUE="<% $action %>">
6 <INPUT TYPE="hidden" NAME="rate_only" VALUE="<% $rate_only %>">
7 <INPUT TYPE="hidden" NAME="taxnum" VALUE="<% join(',', @taxnum) %>">
9 <TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
11 <% include('/elements/tr-td-label.html', 'label' => 'Country' ) %>
12 <TD BGCOLOR="#dddddd"><% $countries %>
16 <% include('/elements/tr-td-label.html', 'label' => 'State' ) %>
17 <TD BGCOLOR="#dddddd"><% $states %>
22 <% include('/elements/tr-td-label.html', 'label' => 'County' ) %>
23 <TD BGCOLOR="#dddddd"><% $counties %>
29 <& /elements/tr-td-label.html, 'label' => 'City' &>
30 <TD BGCOLOR="#dddddd"><% $cities %>
36 <& /elements/tr-td-label.html, 'label' => 'District' &>
37 <TD BGCOLOR="#dddddd"><% $districts %>
42 % if ( $conf->exists('enable_taxclasses') && $taxclasses ) {
43 <% include('/elements/tr-td-label.html', 'label' => 'Tax Class' ) %>
44 <TD BGCOLOR="#dddddd"><% $taxclasses %>
49 % unless ($rate_only) {
50 <% include('/elements/tr-input-text.html',
57 <% include('/elements/tr-input-percentage.html',
59 'label' => 'Tax rate',
63 % unless ($rate_only) {
64 <% include('/elements/tablebreak-tr-title.html', value=>'Exemptions' ) %>
66 <% include('/elements/tr-checkbox.html',
67 'field' => 'setuptax',
69 'label' => 'This tax not applicable to setup fees',
73 <% include('/elements/tr-checkbox.html',
74 'field' => 'recurtax',
76 'label' => 'This tax not applicable to recurring fees',
80 <% include('/elements/tr-input-money.html',
81 'field' => 'exempt_amount',
82 'label' => 'Monthly exemption per customer ($25 "Texas tax")',
91 <INPUT TYPE="submit" VALUE="Bulk <% $action %> tax">
95 my $conf = new FS::Conf;
98 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
101 $cgi->param('taxnum') =~ /^([\d,]+)$/
102 or $m->comp('/elements/errorpage-popup.html', $cgi->param('error') || 'Nothing selected');
103 my @taxnum = split(',', $1);
105 $cgi->param('action') =~ /^(add|edit|edit_rate_only)$/ or die "unknown action";
108 if ($action eq "edit_rate_only") {
112 my $title = "Bulk $action tax rate";
114 my @cust_main_county =
116 qsearchs('cust_main_county', { 'taxnum' => $_ })
117 or die "unknown taxnum $1";
121 my %seen_country = {};
122 my @countries = map FS::geocode_Mixin->code2country($_)." ($_)",
123 grep !$seen_country{$_}++,
126 my $countries = join(', ', @countries);
129 my @states = map state_label($_->[0], $_->[1]),
130 grep !$seen_state{$_->[0]}++,
131 map [ $_->state, $_->country ],
133 my $states = join(', ', @states);
135 my %seen_county = {};
136 my @counties = grep !$seen_county{$_}++, map $_->county, @cust_main_county;
137 my $counties = join(', ', @counties);
139 my %seen_city = ( map { $_->city => 1 } @cust_main_county );
140 my @cities = grep $_, keys %seen_city;
141 my $cities = join(', ', @cities);
143 my @districts = grep $_, map { $_->district } @cust_main_county;
144 my $districts = join(', ', @districts);
146 my %seen_taxclass = {};
147 my @taxclasses = grep !$seen_taxclass{$_}++, map $_->taxclass, @cust_main_county;
148 my $taxclasses = join(', ', @taxclasses);
151 # { field=>'country', type=>'fixed-country', },
152 # { field=>'state', type=>'fixed-state', },
153 # { field=>'county', type=>'fixed', },
156 #push @fields, { field=>'taxclass', type=>'fixed', }
157 # if $conf->exists('enable_taxclasses');