so Search.tsf and Search.rdf work
[freeside.git] / httemplate / edit / cust_main_county.cgi
1 <!-- mason kludge -->
2 <%
3
4 print header("Edit tax rates", menubar(
5   'Main Menu' => popurl(2),
6 ));
7
8 print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
9       "</FONT>"
10   if $cgi->param('error');
11
12 print qq!<FORM ACTION="!, popurl(1),
13     qq!process/cust_main_county.cgi" METHOD=POST>!, &table(), <<END;
14       <TR>
15         <TH><FONT SIZE=-1>Country</FONT></TH>
16         <TH><FONT SIZE=-1>State</FONT></TH>
17         <TH><FONT SIZE=-1>County</FONT></TH>
18         <TH><FONT SIZE=-1>Taxclass</FONT><BR><FONT SIZE=-2>(per-package classification)</FONT></TH>
19 END
20
21 if ( dbdef->table('cust_main_county')->column('taxname') ) {
22   print '<TH><FONT SIZE=-1>Tax name</FONT><BR><FONT SIZE=-2>(printed on invoices)</FONT></TH>';
23 }
24
25 print <<END;
26         <TH><FONT SIZE=-1>Tax</FONT></TH>
27         <TH><FONT SIZE=-1>Exempt<BR>per<BR>month</TH>
28 END
29
30 if ( dbdef->table('cust_main_county')->column('setuptax') ) {
31   print '<TH><FONT SIZE=-1>Setup<BR>fee<BR>exempt</TH>';
32 }
33 if ( dbdef->table('cust_main_county')->column('recurtax') ) {
34   print '<TH><FONT SIZE=-1>Recurring<BR>fee<BR>exempt</TH>';
35 }
36
37 print '</TR>';
38
39 foreach my $cust_main_county ( sort {    $a->country cmp $b->country
40                                       or $a->state   cmp $b->state
41                                       or $a->county  cmp $b->county
42                                     } qsearch('cust_main_county',{}) ) {
43   my($hashref)=$cust_main_county->hashref;
44   print <<END;
45       <TR>
46         <TD BGCOLOR="#ffffff">$hashref->{country}</TD>
47 END
48
49   print "<TD", $hashref->{state}
50       ? ' BGCOLOR="#ffffff">'.$hashref->{state}
51       : ' BGCOLOR="#cccccc">(ALL)'
52     , "</TD>";
53
54   print "<TD", $hashref->{county}
55       ? ' BGCOLOR="#ffffff">'. $hashref->{county}
56       : ' BGCOLOR="#cccccc">(ALL)'
57     , "</TD>";
58
59   print "<TD", $hashref->{taxclass}
60       ? ' BGCOLOR="#ffffff">'. $hashref->{taxclass}
61       : ' BGCOLOR="#cccccc">(ALL)'
62     , "</TD>";
63
64   print qq!<TD><INPUT TYPE="text" NAME="taxname!, $hashref->{taxnum},
65         qq!" VALUE="!, $hashref->{taxname}, qq!"></TD>!
66     if dbdef->table('cust_main_county')->column('taxname');
67
68   print qq!<TD><TABLE><TR><TD><INPUT TYPE="text" NAME="tax!, $hashref->{taxnum},
69         qq!" VALUE="!, $hashref->{tax}, qq!" SIZE=6 MAXLENGTH=6></TD><TD>%</TD></TR></TABLE></TD>!;
70   print qq!<TD><TABLE><TR><TD>\$</TD><TD><INPUT TYPE="text" NAME="exempt_amount!, $hashref->{taxnum},
71         qq!" VALUE="!, $hashref->{exempt_amount}||0, qq!" SIZE=6></TD></TR></TABLE></TD>!;
72
73   print qq!<TD><INPUT TYPE="checkbox" NAME="setuptax!. $hashref->{taxnum}.
74         '" VALUE="Y"'.
75         ( $hashref->{setuptax} =~ /^Y$/i ? ' CHECKED' : '' ).
76         '></TD>'
77     if dbdef->table('cust_main_county')->column('setuptax');
78
79   print qq!<TD><INPUT TYPE="checkbox" NAME="recurtax!. $hashref->{taxnum}.
80         '" VALUE="Y"'.
81         ( $hashref->{recurtax} =~ /^Y$/i ? ' CHECKED' : '' ).
82         '></TD>'
83     if dbdef->table('cust_main_county')->column('recurtax');
84
85   print '</TR>';
86
87 }
88
89 print <<END;
90     </TABLE>
91     <INPUT TYPE="submit" VALUE="Apply changes">
92     </FORM>
93     </CENTER>
94   </BODY>
95 </HTML>
96 END
97
98 %>