clean up tax rate editing:
[freeside.git] / httemplate / browse / agent.cgi
1 <%
2 #
3 # $Id: agent.cgi,v 1.1 2001-07-30 07:36:03 ivan Exp $
4 #
5 # ivan@sisd.com 97-dec-12
6 #
7 # changes to allow pages to load from a relative location in the web tree.
8 #       bmccane@maxbaud.net     98-mar-25
9 #
10 # changed 'type' to 'atype' because type is reserved word in Pg6.3
11 #       bmccane@maxbaud.net     98-apr-3
12 #
13 # agent type was linking to wrong cgi ivan@sisd.com 98-jul-18
14 #
15 # lose background, FS::CGI ivan@sisd.com 98-sep-2
16 #
17 # $Log: agent.cgi,v $
18 # Revision 1.1  2001-07-30 07:36:03  ivan
19 # templates!!!
20 #
21 # Revision 1.13  1999/04/09 04:22:34  ivan
22 # also table()
23 #
24 # Revision 1.12  1999/04/09 03:52:55  ivan
25 # explicit & for table/itable/ntable
26 #
27 # Revision 1.11  1999/01/20 09:43:16  ivan
28 # comment out future UI code (but look at it, it's neat!)
29 #
30 # Revision 1.10  1999/01/19 05:13:24  ivan
31 # for mod_perl: no more top-level my() variables; use vars instead
32 # also the last s/create/new/;
33 #
34 # Revision 1.9  1999/01/18 09:41:14  ivan
35 # all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
36 # (good idea anyway)
37 #
38 # Revision 1.8  1999/01/18 09:22:26  ivan
39 # changes to track email addresses for email invoicing
40 #
41 # Revision 1.7  1998/12/17 05:25:16  ivan
42 # fix visual and other bugs
43 #
44 # Revision 1.6  1998/11/23 05:29:46  ivan
45 # use CGI::Carp
46 #
47 # Revision 1.5  1998/11/23 05:27:31  ivan
48 # to eliminate warnings
49 #
50 # Revision 1.4  1998/11/20 08:50:36  ivan
51 # s/CGI::Base/CGI.pm, visual fixes
52 #
53 # Revision 1.3  1998/11/08 10:11:02  ivan
54 # CGI.pm
55 #
56 # Revision 1.2  1998/11/07 10:24:22  ivan
57 # don't use depriciated FS::Bill and FS::Invoice, other miscellania
58 #
59
60 use strict;
61 use vars qw( $ui $cgi $p $agent );
62 use CGI;
63 use CGI::Carp qw(fatalsToBrowser);
64 use FS::UID qw(cgisuidsetup swapuid);
65 use FS::Record qw(qsearch qsearchs);
66 use FS::CGI qw(header menubar table popurl);
67 use FS::agent;
68 use FS::agent_type;
69
70 #Begin silliness
71 #
72 #use FS::UI::CGI;
73 #use FS::UI::agent;
74 #
75 #$ui = new FS::UI::agent;
76 #$ui->browse;
77 #exit;
78 #__END__
79 #End silliness
80
81 $cgi = new CGI;
82
83 &cgisuidsetup($cgi);
84
85 $p = popurl(2);
86
87 print $cgi->header( '-expires' => 'now' ), header('Agent Listing', menubar(
88   'Main Menu'   => $p,
89   'Agent Types' => $p. 'browse/agent_type.cgi',
90 #  'Add new agent' => '../edit/agent.cgi'
91 )), <<END;
92 Agents are resellers of your service. Agents may be limited to a subset of your
93 full offerings (via their type).<BR><BR>
94 END
95 print &table(), <<END;
96       <TR>
97         <TH COLSPAN=2>Agent</TH>
98         <TH>Type</TH>
99         <TH><FONT SIZE=-1>Freq. (unimp.)</FONT></TH>
100         <TH><FONT SIZE=-1>Prog. (unimp.)</FONT></TH>
101       </TR>
102 END
103 #        <TH><FONT SIZE=-1>Agent #</FONT></TH>
104 #        <TH>Agent</TH>
105
106 foreach $agent ( sort { 
107   $a->getfield('agentnum') <=> $b->getfield('agentnum')
108 } qsearch('agent',{}) ) {
109   my($hashref)=$agent->hashref;
110   my($typenum)=$hashref->{typenum};
111   my($agent_type)=qsearchs('agent_type',{'typenum'=>$typenum});
112   my($atype)=$agent_type->getfield('atype');
113   print <<END;
114       <TR>
115         <TD><A HREF="${p}edit/agent.cgi?$hashref->{agentnum}">
116           $hashref->{agentnum}</A></TD>
117         <TD><A HREF="${p}edit/agent.cgi?$hashref->{agentnum}">
118           $hashref->{agent}</A></TD>
119         <TD><A HREF="${p}edit/agent_type.cgi?$typenum">$atype</A></TD>
120         <TD>$hashref->{freq}</TD>
121         <TD>$hashref->{prog}</TD>
122       </TR>
123 END
124
125 }
126
127 print <<END;
128       <TR>
129         <TD COLSPAN=2><A HREF="${p}edit/agent.cgi"><I>Add new agent</I></A></TD>
130         <TD><A HREF="${p}edit/agent_type.cgi"><I>Add new agent type</I></A></TD>
131       </TR>
132     </TABLE>
133
134   </BODY>
135 </HTML>
136 END
137
138 %>