import torrus 1.0.9
[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 ( $conf->exists('enable_taxclasses') && $taxclasses ) {
28   <% include('/elements/tr-td-label.html', 'label' => 'Tax Class' ) %>
29     <TD BGCOLOR="#dddddd"><% $taxclasses %>
30     </TD>
31   </TR>
32 % }
33
34 <% include('/elements/tr-input-text.html',
35              'field' => 'taxname',
36              'label' => 'Tax name'
37           )
38 %>
39
40 <% include('/elements/tr-input-percentage.html',
41              'field' => 'tax',
42              'label' => 'Tax rate',
43           )
44 %>
45
46 <% include('/elements/tablebreak-tr-title.html', value=>'Exemptions' ) %>
47
48 <% include('/elements/tr-checkbox.html',
49              'field' => 'setuptax',
50              'value' => 'Y',
51              'label' => 'This tax not applicable to setup fees',
52           )
53 %>
54
55 <% include('/elements/tr-checkbox.html',
56              'field' => 'recurtax',
57              'value' => 'Y',
58              'label' => 'This tax not applicable to recurring fees',
59           )
60 %>
61
62 <% include('/elements/tr-input-money.html',
63              'field' => 'exempt_amount',
64              'label' => 'Monthly exemption per customer ($25 "Texas tax")',
65           )
66 %>
67
68 </TABLE>
69
70 <BR>
71
72 <INPUT TYPE="submit" VALUE="Bulk <% $action %> tax">
73
74 <%init>
75
76 my $conf = new FS::Conf;
77
78 die "access denied"
79   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
80
81 my @taxnum;
82 $cgi->param('taxnum') =~ /^([\d,]+)$/
83    or $m->comp('/elements/errorpage-popup.html', $cgi->param('error') || 'Nothing selected');
84 my @taxnum = split(',', $1);
85
86 $cgi->param('action') =~ /^(add|edit)$/ or die "unknown action";
87 my $action = $1;
88 my $title = "Bulk $action tax rate";
89
90 my @cust_main_county =
91   map {
92         qsearchs('cust_main_county', { 'taxnum' => $_ })
93           or die "unknown taxnum $1";
94       }
95       @taxnum;
96
97 my %seen_country = {};
98 my @countries = map  code2country($_)."&nbsp;($_)",
99                 grep !$seen_country{$_}++,
100                 map  $_->country,
101                      @cust_main_county;
102 my $countries = join(', ', @countries);
103
104 my %seen_state = {};
105 my @states = map state_label($_->[0], $_->[1]),
106             grep !$seen_state{$_->[0]}++,
107              map [ $_->state, $_->country ],
108                  @cust_main_county;
109 my $states = join(', ', @states);
110
111 my %seen_county = {};
112 my @counties = grep !$seen_county{$_}++, map $_->county, @cust_main_county;
113 my $counties = join(', ', @counties);
114
115 my %seen_taxclass = {};
116 my @taxclasses = grep !$seen_taxclass{$_}++, map $_->taxclass, @cust_main_county;
117 my $taxclasses = join(', ', @taxclasses);
118
119 #my @fields = (
120 #  { field=>'country',  type=>'fixed-country', },
121 #  { field=>'state',    type=>'fixed-state', },
122 #  { field=>'county',   type=>'fixed', },
123 #);
124
125 #push @fields, { field=>'taxclass', type=>'fixed', }
126 #  if $conf->exists('enable_taxclasses');
127
128 </%init>