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="taxnum" VALUE="<% join(',', @taxnum) %>">
8 <TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
10 <% include('/elements/tr-td-label.html', 'label' => 'Country' ) %>
11 <TD BGCOLOR="#dddddd"><% $countries %>
15 <% include('/elements/tr-td-label.html', 'label' => 'State' ) %>
16 <TD BGCOLOR="#dddddd"><% $states %>
21 <% include('/elements/tr-td-label.html', 'label' => 'County' ) %>
22 <TD BGCOLOR="#dddddd"><% $counties %>
28 <& /elements/tr-td-label.html, 'label' => 'City' &>
29 <TD BGCOLOR="#dddddd"><% $cities %>
35 <& /elements/tr-td-label.html, 'label' => 'District' &>
36 <TD BGCOLOR="#dddddd"><% $districts %>
41 % if ( $conf->exists('enable_taxclasses') && $taxclasses ) {
42 <% include('/elements/tr-td-label.html', 'label' => 'Tax Class' ) %>
43 <TD BGCOLOR="#dddddd"><% $taxclasses %>
48 <% include('/elements/tr-input-text.html',
54 <% include('/elements/tr-input-percentage.html',
56 'label' => 'Tax rate',
60 <% include('/elements/tablebreak-tr-title.html', value=>'Exemptions' ) %>
62 <% include('/elements/tr-checkbox.html',
63 'field' => 'setuptax',
65 'label' => 'This tax not applicable to setup fees',
69 <% include('/elements/tr-checkbox.html',
70 'field' => 'recurtax',
72 'label' => 'This tax not applicable to recurring fees',
76 <% include('/elements/tr-input-money.html',
77 'field' => 'exempt_amount',
78 'label' => 'Monthly exemption per customer ($25 "Texas tax")',
86 <INPUT TYPE="submit" VALUE="Bulk <% $action %> tax">
90 my $conf = new FS::Conf;
93 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
96 $cgi->param('taxnum') =~ /^([\d,]+)$/
97 or $m->comp('/elements/errorpage-popup.html', $cgi->param('error') || 'Nothing selected');
98 my @taxnum = split(',', $1);
100 $cgi->param('action') =~ /^(add|edit)$/ or die "unknown action";
102 my $title = "Bulk $action tax rate";
104 my @cust_main_county =
106 qsearchs('cust_main_county', { 'taxnum' => $_ })
107 or die "unknown taxnum $1";
111 my %seen_country = {};
112 my @countries = map FS::geocode_Mixin->code2country($_)." ($_)",
113 grep !$seen_country{$_}++,
116 my $countries = join(', ', @countries);
119 my @states = map state_label($_->[0], $_->[1]),
120 grep !$seen_state{$_->[0]}++,
121 map [ $_->state, $_->country ],
123 my $states = join(', ', @states);
125 my %seen_county = {};
126 my @counties = grep !$seen_county{$_}++, map $_->county, @cust_main_county;
127 my $counties = join(', ', @counties);
129 my %seen_city = ( map { $_->city => 1 } @cust_main_county );
130 my @cities = grep $_, keys %seen_city;
131 my $cities = join(', ', @cities);
133 my @districts = grep $_, map { $_->district } @cust_main_county;
134 my $districts = join(', ', @districts);
136 my %seen_taxclass = {};
137 my @taxclasses = grep !$seen_taxclass{$_}++, map $_->taxclass, @cust_main_county;
138 my $taxclasses = join(', ', @taxclasses);
141 # { field=>'country', type=>'fixed-country', },
142 # { field=>'state', type=>'fixed-state', },
143 # { field=>'county', type=>'fixed', },
146 #push @fields, { field=>'taxclass', type=>'fixed', }
147 # if $conf->exists('enable_taxclasses');