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