add require_taxclasses config flag
[freeside.git] / httemplate / view / cust_main / quick-charge.html
1 <%
2   my( $cust_main ) = @_;
3   my $conf = new FS::Conf;
4 %>
5
6 <FORM ACTION="<%=$p%>edit/process/quick-charge.cgi" METHOD="POST">
7 <INPUT TYPE="hidden" NAME="custnum" VALUE="<%= $cust_main->custnum %>">
8 Description:<INPUT TYPE="text" NAME="pkg">
9 Amount:<INPUT TYPE="text" NAME="amount" SIZE=6>
10 <% #false laziness w/ edit/part_pkg.cgi %>
11 <% if ( $conf->exists('enable_taxclasses') ) { %>
12
13     <SELECT NAME="taxclass">
14
15       <% if ( $conf->exists('require_taxclasses') ) { %>
16
17         <OPTION VALUE="(select)">Select tax class
18
19       <% } else { %>
20
21         <OPTION VALUE="">
22
23       <% } %>
24
25       <%
26         my $sth = dbh->prepare('SELECT DISTINCT taxclass FROM cust_main_county')
27           or die dbh->errstr;
28         $sth->execute or die $sth->errstr;
29         my %taxclasses = map { $_->[0] => 1 } @{$sth->fetchall_arrayref};
30         my @taxclasses = grep $_, keys %taxclasses;
31       %>
32   
33       <% foreach my $taxclass ( @taxclasses ) { %>
34   
35           <OPTION VALUE="<%= $taxclass %>"<%= 0 ? ' SELECTED' : '' %>><%= $taxclass %>
36   
37       <% } %>
38
39     </SELECT>
40
41 <% } else { %>
42
43   <INPUT TYPE="hidden" NAME="taxclass" VALUE="">';
44   
45 <% } %>
46   
47 <INPUT TYPE="submit" VALUE="One-time charge">
48 </FORM>
49