depriciate cust_pay_batch.trancode
[freeside.git] / httemplate / docs / schema.html
1 <head>
2   <title>Schema reference</title>
3 </head>
4 <body>
5   <h1>Schema reference</h1>
6   <ul>
7     <li><a name="agent" href="man/FS/agent.html">agent</a> - Agents are resellers of your service.  Agents may be limited to a subset of your full offerings (via their agent type).
8       <ul>
9         <li>agentnum - primary key
10         <li>agent - name of this agent
11         <li>typenum - <a href="#agent_type">agent type</a>
12         <li>prog - (unimplemented)
13         <li>freq - (unimplemented)
14       </ul>
15     <li><a name="agent_type" href="man/FS/agent_type.html">agent_type</a> - Agent types define groups of packages that you can then assign to particular agents.
16       <ul>
17         <li>typenum - primary key
18         <li>atype - name of this agent type
19       </ul>
20     <li><a name="cust_bill" href="man/FS/cust_bill.html">cust_bill</a> - Invoices.  Declarations that a customer owes you money.  The specific charges are itemized in <a href="#cust_bill_pkg">cust_bill_pkg</a>.
21       <ul>
22         <li>invnum - primary key
23         <li>custnum - <a href="#cust_main">customer</a>
24         <li>_date
25         <li>charged - amount of this invoice
26         <li>printed - how many times this invoice has been printed automatically
27       </ul>
28     <li><a name="cust_bill_pkg" href="man/FS/cust_bill_pkg.html">cust_bill_pkg</a> - Invoice line items
29       <ul>
30         <li>invnum - (multiple) key
31         <li>pkgnum - <a href="#cust_pkg">package</a> or 0 for the special virtual sales tax package
32         <li>setup - setup fee 
33         <li>recur - recurring fee
34         <li>sdate - starting date
35         <li>edate - ending date
36       </ul>
37     <li><a name="cust_credit" href="man/FS/cust_credit.html">cust_credit</a> - Credits.  The equivalent of a negative <a href="#cust_bill">cust_bill</a> record.
38       <ul>
39         <li>crednum - primary key
40         <li>custnum - <a href="#cust_main">customer</a>
41         <li>amount - amount credited
42         <li>_date
43         <li>otaker - order taker
44         <li>reason
45       </ul>
46     <li><a name="cust_credit_bill" href="man/FS/cust_credit_bill.html">cust_credit_bill</a> - Credit invoice application.  Links a credit to an invoice.
47       <ul>
48         <li>creditbillnum - primary key
49         <li>crednum - <a href="#cust_credit">credit</a> being applied
50         <li>invnum - <a href="#cust_bill">invoice</a> to which credit is applied
51         <li>amount - amount applied
52         <li>_date
53       </ul>
54     <li><a name="cust_main" href="man/FS/cust_main.html">cust_main</a> - Customers
55       <ul>
56         <li>custnum - primary key
57         <li>agentnum - <a href="#agent">agent</a>
58         <li>refnum - <a href="#part_referral">referral</a>
59         <li>first - name
60         <li>last - name
61         <li>ss - social security number
62         <li>company
63         <li>address1
64         <li>address2
65         <li>city
66         <li>county
67         <li>state
68         <li>zip
69         <li>country
70         <li>daytime - phone
71         <li>night - phone
72         <li>fax - phone
73         <li><i>ship_first</i>
74         <li><i>ship_last</i>
75         <li><i>ship_company</i>
76         <li><i>ship_address1</i>
77         <li><i>ship_address2</i>
78         <li><i>ship_city</i>
79         <li><i>ship_county</i>
80         <li><i>ship_state</i>
81         <li><i>ship_zip</i>
82         <li><i>ship_country</i>
83         <li><i>ship_daytime</i>
84         <li><i>ship_night</i>
85         <li><i>ship_fax</i>
86         <li>payby - CARD, BILL, or COMP
87         <li>payinfo - card number, P.O.#, or comp issuer
88         <li>paydate - expiration date
89         <li>payname - billing name (name on card)
90         <li>tax - tax exempt, Y or null
91         <li>otaker - order taker
92         <li>referral_custnum
93         <li>comments
94       </ul>
95       (columns in <i>italics</i> are optional)
96     <li><a name="cust_main_invoice" href="man/FS/cust_main_invoice.html">cust_main_invoice</a> - Invoice destinations for email invoices.  Note that a customer can have many email destinations for their invoice (either literal or via svcnum), but only one postal destination.
97       <ul>
98         <li>destnum - primary key
99         <li>custnum - <a href="#cust_main">customer</a>
100         <li>dest - Invoice destination.  Freeside supports three types of invoice delivery: send directly to a service defined in Freeside, send to an arbitrary email address, or print the invoice to a printer and have someone send it out via snail mail.  Freeside determines which method to use based on the contents of the dest field.  If the contents are numeric, a <a href="#svc_acct">svcnum</a> pointing to a valid service is expected in the field.  If the contents are a string, a literal email address is expected to be in the field.  If the special keyword `POST' is present, the snail mail method is used (which is the default if no cust_main_invoice records exist).  Snail mail invoices get their address information from <A name="#cust_main">cust_main</A> and are printed with the printer defined in the configuration files.
101       </ul>
102     <li><a name="cust_main_county" href="man/FS/cust_main_county.html">cust_main_county</a> - Tax rates
103       <ul>
104         <li>taxnum - primary key
105         <li>state
106         <li>county
107         <li>country
108         <li>tax - % rate
109       </ul>
110     <li><a name="cust_pay" href="man/FS/cust_pay.html">cust_pay</a> - Payments.  Money being transferred from a customer.
111       <ul>
112         <li>paynum - primary key
113         <li>custnum - <a href="#cust_main">customer</a>
114         <li>paid - amount
115         <li>_date
116         <li>payby - CARD, BILL, or COMP
117         <li>payinfo - card number, P.O.#, or comp issuer
118         <li>paybatch - text field for tracking card processor batches
119       </ul>
120     <li><a name="cust_bill_pay" href="man/FS/cust_bill_pay.html">cust_bill_pay</a> - Applicaton of a payment to a specific invoice.
121       <ul>
122         <li>billpaynum
123         <li>invnum - <a href="#cust_bill">invoice</a>
124         <li>paynum - <a href="#cust_pay">payment</a>
125         <li>amount
126         <li>_date
127       </ul>
128     <li><a name="cust_pay_batch" href="man/FS/cust_pay_batch.html">cust_pay_batch</a> - Pending batch
129       <ul>
130         <li>paybatchnum
131         <li>cardnum
132         <li>exp - card expiration
133         <li>amount
134         <li>invnum - <a href="#cust_bill">invoice</a>
135         <li>custnum - <a href="#cust_main">customer</a>
136         <li>payname - name on card
137         <li>first - name
138         <li>last - name
139         <li>address1
140         <li>address2
141         <li>city
142         <li>state
143         <li>zip
144         <li>country
145       </ul>
146     <li><a name="cust_pkg" href="man/FS/cust_pkg.html">cust_pkg</a> - Customer billing items
147       <ul>
148         <li>pkgnum - primary key
149         <li>custnum - <a href="#cust_main">customer</a>
150         <li>pkgpart - <a href="#part_pkg">Package definition</a>
151         <li>setup - date
152         <li>bill - next bill date
153         <li>susp - (past) suspension date
154         <li>expire - (future) cancellation date
155         <li>cancel - (past) cancellation date
156         <li>otaker - order taker
157         <li>manual_flag - If this field is set to 1, disables the automatic unsuspensiond of this package when using the <a href="config.html#unsuspendauto">unsuspendauto</a> config file.
158       </ul>
159     <li><a name="cust_refund" href="man/FS/cust_refund.html">cust_refund</a> - Refunds.  The transfer of money to a customer; equivalent to a negative <a href="#cust_pay">cust_pay</a> record.
160       <ul>
161         <li>refundnum - primary key
162         <li>custnum - <a href="#cust_main">customer</a>
163         <li>refund - amount
164         <li>_date
165         <li>payby - CARD, BILL or COMP
166         <li>payinfo - card number, P.O.#, or comp issuer
167         <li>otaker - order taker
168       </ul>
169     <li><a name="cust_credit_refund" href="man/FS/cust_credit_refund.html">cust_credit_refund</a> - Applicaton of a refund to a specific credit.
170       <ul>
171         <li>creditrefundnum - primary key
172         <li>crednum - <a href="#cust_credit">credit</a>
173         <li>refundnum - <a href="#cust_refund">refund</a>
174         <li>amount
175         <li>_date
176       </ul>
177     <li><a name="cust_svc" href="man/FS/cust_svc.html">cust_svc</a> - Customer services
178       <ul>
179         <li>svcnum - primary key
180         <li>pkgnum - <a href="#cust_pkg">package</a>
181         <li>svcpart - <a href="#part_svc">Service definition</a>
182       </ul>
183     <li><a name="nas" href="man/FS/nas.html">nas</a> - Network Access Server (terminal server)
184       <ul>
185         <li>nasnum - primary key
186         <li>nas - NAS name
187         <li>nasip - NAS ip address
188         <li>nasfqdn - NAS fully-qualified domain name
189         <li>last - timestamp indicating the last instant the NAS was in a known state (used by the session monitoring).
190       </ul>
191     <li><a name="part_pkg" href="man/FS/part_pkg.html">part_pkg</a> - Package definitions
192       <ul>
193         <li>pkgpart - primary key
194         <li>pkg - package name
195         <li>comment - non-customer visable package comment
196         <li>setup - setup fee expression
197         <li>freq - recurring frequency (months)
198         <li>recur - recurring fee expression
199         <li>setuptax - Setup fee tax exempt flag, empty or `Y'
200         <li>recurtax - Recurring fee tax exempt flag, empty or `Y'
201         <li>plan - price plan
202         <li>plandata - additional price plan data
203       </ul>
204     <li><a name="part_referral" href="man/FS/part_referral.html">part_referral</a> - Referral listing
205       <ul>
206         <li>refnum - primary key
207         <li>referral - referral
208       </ul>
209     <li><a name="part_svc" href="man/FS/part_svc.html">part_svc</a> - Service definitions
210       <ul>
211         <li>svcpart - primary key
212         <li>svc - name of this service
213         <li>svcdb - table used for this service: svc_acct, svc_acct_sm, svc_forward, svc_domain, svc_charge or svc_wo
214 <!--        <li><i>table</i>__<i>field</i> - Default or fixed value for <i>field</i> in <i>table</i>
215         <li><i>table</i>__<i>field</i>_flag - null, D or F
216 -->
217       </ul>
218     <li><a name="part_svc_column" href="man/FS/part_svc_column.html">part_svc_column</a>
219       <ul>
220         <li>columnnum - primary key
221         <li>svcpart - <a href="#part_svc">Service definition</a>
222         <li>columnname - column name in part_svc.svcdb table
223         <li>columnvalue - default or fixed value for the column
224         <li>columnflag - null, D or F
225       </ul>
226     <li><a name="pkg_svc" href="man/FS/pkg_svc.html">pkg_svc</a>
227       <ul>
228         <li>pkgpart - <a href="#part_pkg">Package definition</a>
229         <li>svcpart - <a href="#part_svc">Service definition</a>
230         <li>quantity - quantity of this service that this package includes
231       </ul>
232     <li><a name="port" href="man/FS/port.html">port</a> - individual port on a <a href="#nas">nas</a>
233       <ul>
234         <li>portnum - primary key
235         <li>ip - IP address of this port
236         <li>nasport - port number on the NAS
237         <li>nasnum - <a href="#nas">NAS</a>
238       </ul>
239     <li><a name="prepay_credit" href="man/FS/prepay_credit.html">prepay_credit</a>
240       <ul>
241         <li>prepaynum - primary key
242         <li>identifier - text or numeric string used to receive this credit
243         <li>amount - amount of credit
244       </ul>
245     <li><a name="session" href="man/FS/session.html">session</a>
246       <ul>
247         <li>sessionnum - primary key
248         <li>portnum - <a href="#port">Port</a>
249         <li>svcnum - <a href="#svc_acct">Account</a>
250         <li>login - timestamp indicating the beginning of this user session.
251         <li>logout - timestamp indicating the end of this user session.  May be null, which indicates a currently open session.
252       </ul>
253
254     <li><a name="svc_acct" href="man/FS/svc_acct.html">svc_acct</a> - Accounts
255       <ul>
256         <li>svcnum - <a href="#cust_svc">primary key</a>
257         <li>username
258         <li>_password
259         <li>popnum - <a href="#svc_acct_pop">Point of Presence</a>
260         <li>uid
261         <li>gid
262         <li>finger - GECOS
263         <li>dir
264         <li>shell
265         <li>quota - (unimplementd)
266         <li>slipip - IP address
267         <li>seconds
268         <li>domsvc
269         <li>radius_<i>Radius_Reply_Attribute</i> - Radius-Reply-Attribute
270         <li>rc_<i>Radius_Check_Attribute</i> - Radius-Check-Attribute
271       </ul>
272     <li><a name="svc_acct_pop" href="man/FS/svc_acct_pop.html">svc_acct_pop</a> - Points of Presence
273       <ul>
274         <li>popnum - primary key
275         <li>city
276         <li>state
277         <li>ac - area code
278         <li>exch - exchange
279         <li>loc - rest of number
280       </ul>
281     <li><a name="part_pop_local" href="man/FS/part_pop_local.html">part_pop_local</a> - Local calling areas
282       <ul>
283         <li>localnum - primary key
284         <li>popnum - primary key
285         <li>city
286         <li>state
287         <li>npa - area code
288         <li>nxx - exchange
289       </ul>
290     <li><a name="svc_acct_sm" href="man/FS/svc_acct_sm.html">svc_acct_sm</a> - <b>DEPRECIATED</b> Domain mail aliases
291       <ul>
292         <li>svcnum - <a href="#cust_svc">primary key</a>
293         <li>domsvc - <a href="#svc_domain">Domain</a> (by svcnum)
294         <li>domuid - <a href="#svc_acct">Account</a> (by uid)
295         <li>domuser - domuser @ <a href="#svc_domain">Domain</a> forwards to <a href="#svc_acct">Account</a>
296       </ul>
297     <li><a name="svc_domain" href="man/FS/svc_domain.html">svc_domain</a> - Domains
298       <ul>
299         <li>svcnum - <a href="#cust_svc">primary key</a>
300         <li>domain
301       </ul>
302     <li><a name="svc_forward" href="man/FS/svc_forward.html">svc_forward</a> - Mail forwarding aliases
303       <ul>
304         <li>svcnum - <a href="#cust_svc">primary key</a>
305         <li>srcsvc - <a href="#svc_acct">svcnum of the source of this forward</a>
306         <li>dstsvc - <a href="#svc_acct">svcnum of the destination of this forward</a>
307         <li>dst - foreign destination (email address) - forward not local to freeside
308       </ul>
309     <li><a name="domain_record" href="man/FS/domain_record.html">domain_record</a> - Domain zone detail
310       <ul>
311         <li>recnum - primary key
312         <li>svcnum - <a href="#svc_domain">Domain</a> (by svcnum)
313         <li>reczone - zone for this line
314         <li>recaf - address family, usually <b>IN</b>
315         <li>rectype - type for this record (<b>A</b>, <b>MX</b>, etc.)
316         <li>recdata - data for this record
317       </ul>
318     <li><a name="svc_www" href="man/FS/svc_www.html">svc_www</a>
319       <ul>
320        <li>svcnum - <a href="#cust-svc">primary key</a>
321        <li>recnum - <a href="#domain_record">host</a>
322        <li>usersvc - <a href="#svc_acct">account</a>
323       </ul>
324     <li><a name="type_pkgs" href="man/FS/type_pkgs.html">type_pkgs</a>
325       <ul>
326         <li>typenum - <a href="#agent_type">agent type</a>
327         <li>pkgpart - <a href="#part_pkg">Package definition</a>
328       </ul>
329     <li><a name="queue" href="man/FS/queue.html">queue</a> - job queue
330       <ul>
331         <li>jobnum - primary key
332         <li>job
333         <li>_date
334         <li>status
335       </ul>
336     <li><a name="queue_arg" href="man/FS/queue_arg.html">queue_arg</a> - job arguments
337       <ul>
338         <li>argnum - primary key
339         <li>jobnum - <a href="#queue">job</a>
340         <li>arg - argument
341       </ul>
342   </ul>
343 </body>