8b123482530f5154e2115e2205ab4e36a2bff1d0
[freeside.git] / httemplate / edit / bulk-cust_main_county.html
1 <% include('/elements/header-popup.html', $title ) %>
2
3 <FORM ACTION="<% popurl(1)."process/bulk-cust_main_county.html" %>" METHOD="POST">
4
5 <INPUT TYPE="hidden" NAME="action" VALUE="<% $action %>">
6 <INPUT TYPE="hidden" NAME="taxnum" VALUE="<% join(',', @taxnum) %>">
7
8 <TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
9
10 <% include('/elements/tr-td-label.html', 'label' => 'Country' ) %>
11   <TD BGCOLOR="#dddddd"><% $countries %>
12   </TD>
13 </TR>
14
15 <% include('/elements/tr-td-label.html', 'label' => 'State' ) %>
16   <TD BGCOLOR="#dddddd"><% $states %>
17   </TD>
18 </TR>
19
20 % if ( $counties ) {
21   <% include('/elements/tr-td-label.html', 'label' => 'County' ) %>
22     <TD BGCOLOR="#dddddd"><% $counties %>
23     </TD>
24   </TR>
25 % }
26
27 % if ( $cities ) {
28   <& /elements/tr-td-label.html, 'label' => 'City' &>
29     <TD BGCOLOR="#dddddd"><% $cities %>
30     </TD>
31   </TR>
32 % }
33
34 % if ( $districts ) {
35   <& /elements/tr-td-label.html, 'label' => 'District' &>
36     <TD BGCOLOR="#dddddd"><% $districts %>
37     </TD>
38   </TR>
39 % }
40
41 % if ( $conf->exists('enable_taxclasses') && $taxclasses ) {
42   <% include('/elements/tr-td-label.html', 'label' => 'Tax Class' ) %>
43     <TD BGCOLOR="#dddddd"><% $taxclasses %>
44     </TD>
45   </TR>
46 % }
47
48 <% include('/elements/tr-input-text.html',
49              'field' => 'taxname',
50              'label' => 'Tax name'
51           )
52 %>
53
54 <% include('/elements/tr-input-percentage.html',
55              'field' => 'tax',
56              'label' => 'Tax rate',
57           )
58 %>
59
60 <% include('/elements/tablebreak-tr-title.html', value=>'Exemptions' ) %>
61
62 <% include('/elements/tr-checkbox.html',
63              'field' => 'setuptax',
64              'value' => 'Y',
65              'label' => 'This tax not applicable to setup fees',
66           )
67 %>
68
69 <% include('/elements/tr-checkbox.html',
70              'field' => 'recurtax',
71              'value' => 'Y',
72              'label' => 'This tax not applicable to recurring fees',
73           )
74 %>
75
76 <% include('/elements/tr-input-money.html',
77              'field' => 'exempt_amount',
78              'label' => 'Monthly exemption per customer ($25 "Texas tax")',
79           )
80 %>
81
82 </TABLE>
83
84 <BR>
85
86 <INPUT TYPE="submit" VALUE="Bulk <% $action %> tax">
87
88 <%init>
89
90 my $conf = new FS::Conf;
91
92 die "access denied"
93   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
94
95 my @taxnum;
96 $cgi->param('taxnum') =~ /^([\d,]+)$/
97    or $m->comp('/elements/errorpage-popup.html', $cgi->param('error') || 'Nothing selected');
98 my @taxnum = split(',', $1);
99
100 $cgi->param('action') =~ /^(add|edit)$/ or die "unknown action";
101 my $action = $1;
102 my $title = "Bulk $action tax rate";
103
104 my @cust_main_county =
105   map {
106         qsearchs('cust_main_county', { 'taxnum' => $_ })
107           or die "unknown taxnum $1";
108       }
109       @taxnum;
110
111 my %seen_country = {};
112 my @countries = map  FS::geocode_Mixin->code2country($_)."&nbsp;($_)",
113                 grep !$seen_country{$_}++,
114                 map  $_->country,
115                      @cust_main_county;
116 my $countries = join(', ', @countries);
117
118 my %seen_state = {};
119 my @states = map state_label($_->[0], $_->[1]),
120             grep !$seen_state{$_->[0]}++,
121              map [ $_->state, $_->country ],
122                  @cust_main_county;
123 my $states = join(', ', @states);
124
125 my %seen_county = {};
126 my @counties = grep !$seen_county{$_}++, map $_->county, @cust_main_county;
127 my $counties = join(', ', @counties);
128
129 my %seen_city = ( map { $_->city => 1 } @cust_main_county );
130 my @cities = grep $_, keys %seen_city;
131 my $cities = join(', ', @cities);
132
133 my @districts = grep $_, map { $_->district } @cust_main_county;
134 my $districts = join(', ', @districts);
135
136 my %seen_taxclass = {};
137 my @taxclasses = grep !$seen_taxclass{$_}++, map $_->taxclass, @cust_main_county;
138 my $taxclasses = join(', ', @taxclasses);
139
140 #my @fields = (
141 #  { field=>'country',  type=>'fixed-country', },
142 #  { field=>'state',    type=>'fixed-state', },
143 #  { field=>'county',   type=>'fixed', },
144 #);
145
146 #push @fields, { field=>'taxclass', type=>'fixed', }
147 #  if $conf->exists('enable_taxclasses');
148
149 </%init>