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