explicit & for table/itable/ntable
[freeside.git] / htdocs / browse / cust_main_county.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # $Id: cust_main_county.cgi,v 1.6 1999-04-09 03:52:55 ivan Exp $
4 #
5 # ivan@sisd.com 97-dec-13
6 #
7 # Changes to allow page to work at a relative position in server
8 #       bmccane@maxbaud.net     98-apr-3
9 #
10 # lose background, FS::CGI ivan@sisd.com 98-sep-2
11 #
12 # $Log: cust_main_county.cgi,v $
13 # Revision 1.6  1999-04-09 03:52:55  ivan
14 # explicit & for table/itable/ntable
15 #
16 # Revision 1.5  1999/01/19 05:13:26  ivan
17 # for mod_perl: no more top-level my() variables; use vars instead
18 # also the last s/create/new/;
19 #
20 # Revision 1.4  1999/01/18 09:41:16  ivan
21 # all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
22 # (good idea anyway)
23 #
24 # Revision 1.3  1998/12/17 05:25:18  ivan
25 # fix visual and other bugs
26 #
27 # Revision 1.2  1998/11/18 09:01:34  ivan
28 # i18n! i18n!
29 #
30
31 use strict;
32 use vars qw( $cgi $p $cust_main_county );
33 use CGI;
34 use CGI::Carp qw(fatalsToBrowser);
35 use FS::UID qw(cgisuidsetup swapuid);
36 use FS::Record qw(qsearch qsearchs);
37 use FS::CGI qw(header menubar popurl table);
38 use FS::cust_main_county;
39
40 $cgi = new CGI;
41
42 &cgisuidsetup($cgi);
43
44 $p = popurl(2);
45
46 print $cgi->header( '-expires' => 'now' ), header("Tax Rate Listing", menubar(
47   'Main Menu' => $p,
48   'Edit tax rates' => $p. "edit/cust_main_county.cgi",
49 )),<<END;
50     Click on <u>expand country</u> to specify a country's tax rates by state.
51     <BR>Click on <u>expand state</u> to specify a state's tax rates by county.
52     <BR><BR>
53 END
54 print &table, <<END;
55       <TR>
56         <TH><FONT SIZE=-1>Country</FONT></TH>
57         <TH><FONT SIZE=-1>State</FONT></TH>
58         <TH>County</TH>
59         <TH><FONT SIZE=-1>Tax</FONT></TH>
60       </TR>
61 END
62
63 foreach $cust_main_county ( qsearch('cust_main_county',{}) ) {
64   my($hashref)=$cust_main_county->hashref;
65   print <<END;
66       <TR>
67         <TD>$hashref->{country}</TD>
68 END
69   print "<TD>", $hashref->{state}
70       ? $hashref->{state}
71       : qq!(ALL) <FONT SIZE=-1>!.
72         qq!<A HREF="${p}edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}.
73         qq!">expand country</A></FONT>!
74     , "</TD>";
75   print "<TD>";
76   if ( $hashref->{county} ) {
77     print $hashref->{county};
78   } else {
79     print "(ALL)";
80     if ( $hashref->{state} ) {
81       print qq!<FONT SIZE=-1>!.
82           qq!<A HREF="${p}edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}.
83           qq!">expand state</A></FONT>!;
84     }
85   }
86   print "</TD>";
87
88   print <<END;
89         <TD>$hashref->{tax}%</TD>
90       </TR>
91 END
92
93 }
94
95 print <<END;
96     </TABLE>
97     </CENTER>
98   </BODY>
99 </HTML>
100 END
101