time/data detail on invoices
[freeside.git] / httemplate / docs / schema.html
1 <head>
2   <title>Schema reference</title>
3 </head>
4 <body>
5   <h1>Schema reference</h1>
6   Schema diagram: <a href="schema.png">as a giant .png</a> or <a href="schema.dia">dia source</a> (<a href="http://www.lysator.liu.se/~alla/dia/">dia homepage</a>).
7   <ul>
8     <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).
9       <ul>
10         <li>agentnum - primary key
11         <li>agent - name of this agent
12         <li>typenum - <a href="#agent_type">agent type</a>
13         <li>prog - (unimplemented)
14         <li>freq - (unimplemented)
15       </ul>
16     <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.
17       <ul>
18         <li>typenum - primary key
19         <li>atype - name of this agent type
20       </ul>
21     <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>.
22       <ul>
23         <li>invnum - primary key
24         <li>custnum - <a href="#cust_main">customer</a>
25         <li>_date
26         <li>charged - amount of this invoice
27         <li>printed - how many times this invoice has been printed automatically
28         <li>closed - books closed flag, empty or `Y'
29       </ul>
30     <li><a name="cust_bill_event" href="man/FS/cust_bill_event.html">cust_bill_event</a> - Invoice event history
31       <ul>
32         <li>eventnum - primary key
33         <li>invnum - <a href="#cust_bill">invoice</a>
34         <li>eventpart - <a href="#part_bill_event">event definition</a>
35         <li>_date
36         <li>status
37         <li>statustext
38       </ul>
39     <li><a name="part_bill_event" href="man/FS/part_bill_event.html">part_bill_event</a> - Invoice event definitions
40       <ul>
41         <li>eventpart - primary key
42         <li>payby - CARD, CHEK, LECB, BILL, or COMP
43         <li>event - event name
44         <li>eventcode - event action
45         <li>seconds - how long after the invoice date (<a href="#cust_bill">cust_bill</a>._date) events of this type are triggered
46         <li>weight - ordering for events with identical seconds
47         <li>plan - eventcode plan
48         <li>plandata - additional plan data
49         <li>disabled - Disabled flag, empty or `Y'
50         <li>taxclass - Texas tax class flag, empty or "none", "access", or "hosting"
51       </ul>
52     <li><a name="cust_bill_pkg" href="man/FS/cust_bill_pkg.html">cust_bill_pkg</a> - Invoice line items
53       <ul>
54         <li>invnum - (multiple) key
55         <li>pkgnum - <a href="#cust_pkg">package</a> or 0 for the special virtual sales tax package
56         <li>setup - setup fee 
57         <li>recur - recurring fee
58         <li>sdate - starting date
59         <li>edate - ending date
60         <li>itemdesc - Line item description (currently used only when pkgnum is 0)
61       </ul>
62     <li><a name="cust_bill_pkg_detail" href="man/FS/cust_bill_pkg_detail.html">cust_bill_pkg_detail</a> - Invoice line items detail
63       <ul>
64         <li>detailnum - primary key
65         <li>pkgnum -
66         <li>invnum - 
67         <li>detail - Detail description
68       </ul>
69     <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.
70       <ul>
71         <li>crednum - primary key
72         <li>custnum - <a href="#cust_main">customer</a>
73         <li>amount - amount credited
74         <li>_date
75         <li>otaker - order taker
76         <li>reason
77         <li>closed - books closed flag, empty or `Y'
78       </ul>
79     <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.
80       <ul>
81         <li>creditbillnum - primary key
82         <li>crednum - <a href="#cust_credit">credit</a> being applied
83         <li>invnum - <a href="#cust_bill">invoice</a> to which credit is applied
84         <li>amount - amount applied
85         <li>_date
86       </ul>
87     <li><a name="cust_main" href="man/FS/cust_main.html">cust_main</a> - Customers
88       <ul>
89         <li>custnum - primary key
90         <li>agentnum - <a href="#agent">agent</a>
91         <li>refnum - <a href="#part_referral">referral</a>
92         <li>first - name
93         <li>last - name
94         <li>ss - social security number
95         <li>company
96         <li>address1
97         <li>address2
98         <li>city
99         <li>county
100         <li>state
101         <li>zip
102         <li>country
103         <li>daytime - phone
104         <li>night - phone
105         <li>fax - phone
106         <li><i>ship_first</i>
107         <li><i>ship_last</i>
108         <li><i>ship_company</i>
109         <li><i>ship_address1</i>
110         <li><i>ship_address2</i>
111         <li><i>ship_city</i>
112         <li><i>ship_county</i>
113         <li><i>ship_state</i>
114         <li><i>ship_zip</i>
115         <li><i>ship_country</i>
116         <li><i>ship_daytime</i>
117         <li><i>ship_night</i>
118         <li><i>ship_fax</i>
119         <li>payby - CARD, CHEK, LECB, BILL, or COMP
120         <li>payinfo - card number, P.O.#, or comp issuer
121         <li>paydate - expiration date
122         <li>payname - billing name (name on card)
123         <li>tax - tax exempt, Y or null
124         <li>otaker - order taker
125         <li>referral_custnum
126         <li>comments
127       </ul>
128       (columns in <i>italics</i> are optional)
129     <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.
130       <ul>
131         <li>destnum - primary key
132         <li>custnum - <a href="#cust_main">customer</a>
133         <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.
134       </ul>
135     <li><a name="cust_main_county" href="man/FS/cust_main_county.html">cust_main_county</a> - Tax rates
136       <ul>
137         <li>taxnum - primary key
138         <li>state
139         <li>county
140         <li>country
141         <li>tax - % rate
142         <li>taxclass
143         <li>exempt_amount
144         <li>taxname - if defined, printed on invoices instead of "Tax"
145       </ul>
146     <li><a name="cust_tax_exempt" href="man/FS/cust_tax_exempt.html">cust_tax_exempt</a> - Tax exemption record
147       <ul>
148         <li>exemptnum - primary key
149         <li>taxnum - <a href="#cust_main_county">tax rate</a>
150         <li>year
151         <li>month
152         <li>amount
153       </ul>
154     <li><a name="cust_pay" href="man/FS/cust_pay.html">cust_pay</a> - Payments.  Money being transferred from a customer.
155       <ul>
156         <li>paynum - primary key
157         <li>custnum - <a href="#cust_main">customer</a>
158         <li>paid - amount
159         <li>_date
160         <li>payby - CARD, CHEK, LECB, BILL, or COMP
161         <li>payinfo - card number, P.O.#, or comp issuer
162         <li>paybatch - text field for tracking card processor batches
163         <li>closed - books closed flag, empty or `Y'
164       </ul>
165     <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.
166       <ul>
167         <li>billpaynum
168         <li>invnum - <a href="#cust_bill">invoice</a>
169         <li>paynum - <a href="#cust_pay">payment</a>
170         <li>amount
171         <li>_date
172       </ul>
173     <li><a name="cust_pay_batch" href="man/FS/cust_pay_batch.html">cust_pay_batch</a> - Pending batch
174       <ul>
175         <li>paybatchnum
176         <li>cardnum
177         <li>exp - card expiration
178         <li>amount
179         <li>invnum - <a href="#cust_bill">invoice</a>
180         <li>custnum - <a href="#cust_main">customer</a>
181         <li>payname - name on card
182         <li>first - name
183         <li>last - name
184         <li>address1
185         <li>address2
186         <li>city
187         <li>state
188         <li>zip
189         <li>country
190       </ul>
191     <li><a name="cust_pkg" href="man/FS/cust_pkg.html">cust_pkg</a> - Customer billing items
192       <ul>
193         <li>pkgnum - primary key
194         <li>custnum - <a href="#cust_main">customer</a>
195         <li>pkgpart - <a href="#part_pkg">Package definition</a>
196         <li>setup - date
197         <li>bill - next bill date
198         <li>susp - (past) suspension date
199         <li>expire - (future) cancellation date
200         <li>cancel - (past) cancellation date
201         <li>otaker - order taker
202         <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.
203       </ul>
204     <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.
205       <ul>
206         <li>refundnum - primary key
207         <li>custnum - <a href="#cust_main">customer</a>
208         <li>refund - amount
209         <li>_date
210         <li>payby - CARD, CHEK, LECB, BILL or COMP
211         <li>payinfo - card number, P.O.#, or comp issuer
212         <li>otaker - order taker
213         <li>closed - books closed flag, empty or `Y'
214       </ul>
215     <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.
216       <ul>
217         <li>creditrefundnum - primary key
218         <li>crednum - <a href="#cust_credit">credit</a>
219         <li>refundnum - <a href="#cust_refund">refund</a>
220         <li>amount
221         <li>_date
222       </ul>
223     <li><a name="cust_svc" href="man/FS/cust_svc.html">cust_svc</a> - Customer services
224       <ul>
225         <li>svcnum - primary key
226         <li>pkgnum - <a href="#cust_pkg">package</a>
227         <li>svcpart - <a href="#part_svc">Service definition</a>
228       </ul>
229     <li><a name="nas" href="man/FS/nas.html">nas</a> - Network Access Server (terminal server)
230       <ul>
231         <li>nasnum - primary key
232         <li>nas - NAS name
233         <li>nasip - NAS ip address
234         <li>nasfqdn - NAS fully-qualified domain name
235         <li>last - timestamp indicating the last instant the NAS was in a known state (used by the session monitoring).
236       </ul>
237     <li><a name="part_pkg" href="man/FS/part_pkg.html">part_pkg</a> - Package definitions
238       <ul>
239         <li>pkgpart - primary key
240         <li>pkg - package name
241         <li>comment - non-customer visable package comment
242         <li>setup - setup fee expression
243         <li>freq - recurring frequency (months)
244         <li>recur - recurring fee expression
245         <li>setuptax - Setup fee tax exempt flag, empty or `Y'
246         <li>recurtax - Recurring fee tax exempt flag, empty or `Y'
247         <li>plan - price plan
248         <li>plandata - additional price plan data
249         <li>disabled - Disabled flag, empty or `Y'
250       </ul>
251     <li><a name="part_referral" href="man/FS/part_referral.html">part_referral</a> - Referral listing
252       <ul>
253         <li>refnum - primary key
254         <li>referral - referral
255       </ul>
256     <li><a name="part_svc" href="man/FS/part_svc.html">part_svc</a> - Service definitions
257       <ul>
258         <li>svcpart - primary key
259         <li>svc - name of this service
260         <li>svcdb - table used for this service: svc_acct, svc_forward, svc_domain, svc_charge or svc_wo
261         <li>disabled - Disabled flag, empty or `Y'
262 <!--        <li><i>table</i>__<i>field</i> - Default or fixed value for <i>field</i> in <i>table</i>
263         <li><i>table</i>__<i>field</i>_flag - null, D or F
264 -->
265       </ul>
266     <li><a name="part_svc_column" href="man/FS/part_svc_column.html">part_svc_column</a>
267       <ul>
268         <li>columnnum - primary key
269         <li>svcpart - <a href="#part_svc">Service definition</a>
270         <li>columnname - column name in part_svc.svcdb table
271         <li>columnvalue - default or fixed value for the column
272         <li>columnflag - null, D or F
273       </ul>
274     <li><a name="pkg_svc" href="man/FS/pkg_svc.html">pkg_svc</a>
275       <ul>
276         <li>pkgpart - <a href="#part_pkg">Package definition</a>
277         <li>svcpart - <a href="#part_svc">Service definition</a>
278         <li>quantity - quantity of this service that this package includes
279       </ul>
280     <li><a name="export_svc" href="man/FS/export_svc.html">export_svc</a>
281       <ul>
282         <li>exportsvcnum - primary key
283         <li>svcpart - <a href="#part_svc">Service definition</a>
284         <li>exportnum - <a href="#exportnum">Export</a>
285       </ul>
286     <li><a name="part_export" href="man/FS/part_export.html">part_export</a> - Export to external provisioning
287       <ul>
288         <li>exportnum - primary key
289         <li>machine - Machine name 
290         <li>exporttype - Export type
291         <li>nodomain - blank or Y: usernames are exported to this service with no domain
292       </ul>
293     <li><a name="part_export_option" href="man/FS/part_export_option.html">part_export_option</a> - provisioning options
294       <ul>
295         <li>optionnum - primary key
296         <li>exportnum - <a href="#part_export">Export</a>
297         <li>optionname - option name
298         <li>optionvalue - option value
299       </ul>
300     <li><a name="port" href="man/FS/port.html">port</a> - individual port on a <a href="#nas">nas</a>
301       <ul>
302         <li>portnum - primary key
303         <li>ip - IP address of this port
304         <li>nasport - port number on the NAS
305         <li>nasnum - <a href="#nas">NAS</a>
306       </ul>
307     <li><a name="prepay_credit" href="man/FS/prepay_credit.html">prepay_credit</a>
308       <ul>
309         <li>prepaynum - primary key
310         <li>identifier - text or numeric string used to receive this credit
311         <li>amount - amount of credit
312       </ul>
313     <li><a name="session" href="man/FS/session.html">session</a>
314       <ul>
315         <li>sessionnum - primary key
316         <li>portnum - <a href="#port">Port</a>
317         <li>svcnum - <a href="#svc_acct">Account</a>
318         <li>login - timestamp indicating the beginning of this user session.
319         <li>logout - timestamp indicating the end of this user session.  May be null, which indicates a currently open session.
320       </ul>
321
322     <li><a name="svc_acct" href="man/FS/svc_acct.html">svc_acct</a> - Accounts
323       <ul>
324         <li>svcnum - <a href="#cust_svc">primary key</a>
325         <li>username
326         <li>_password
327         <li>sec_phrase - security phrase
328         <li>popnum - <a href="#svc_acct_pop">Point of Presence</a>
329         <li>uid
330         <li>gid
331         <li>finger - GECOS
332         <li>dir
333         <li>shell
334         <li>quota - (unimplementd)
335         <li>slipip - IP address
336         <li>seconds
337         <li>domsvc
338         <li>radius_<i>Radius_Reply_Attribute</i> - Radius-Reply-Attribute
339         <li>rc_<i>Radius_Check_Attribute</i> - Radius-Check-Attribute
340       </ul>
341     <li><a name="svc_acct_pop" href="man/FS/svc_acct_pop.html">svc_acct_pop</a> - Points of Presence
342       <ul>
343         <li>popnum - primary key
344         <li>city
345         <li>state
346         <li>ac - area code
347         <li>exch - exchange
348         <li>loc - rest of number
349       </ul>
350     <li><a name="part_pop_local" href="man/FS/part_pop_local.html">part_pop_local</a> - Local calling areas
351       <ul>
352         <li>localnum - primary key
353         <li>popnum - primary key
354         <li>city
355         <li>state
356         <li>npa - area code
357         <li>nxx - exchange
358       </ul>
359     <li><a name="svc_domain" href="man/FS/svc_domain.html">svc_domain</a> - Domains
360       <ul>
361         <li>svcnum - <a href="#cust_svc">primary key</a>
362         <li>domain
363       </ul>
364     <li><a name="svc_forward" href="man/FS/svc_forward.html">svc_forward</a> - Mail forwarding aliases
365       <ul>
366         <li>svcnum - <a href="#cust_svc">primary key</a>
367         <li>srcsvc - <a href="#svc_acct">svcnum of the source of this forward</a>
368         <li>dstsvc - <a href="#svc_acct">svcnum of the destination of this forward</a>
369         <li>dst - foreign destination (email address) - forward not local to freeside
370       </ul>
371     <li><a name="domain_record" href="man/FS/domain_record.html">domain_record</a> - Domain zone detail
372       <ul>
373         <li>recnum - primary key
374         <li>svcnum - <a href="#svc_domain">Domain</a> (by svcnum)
375         <li>reczone - zone for this line
376         <li>recaf - address family, usually <b>IN</b>
377         <li>rectype - type for this record (<b>A</b>, <b>MX</b>, etc.)
378         <li>recdata - data for this record
379       </ul>
380     <li><a name="svc_www" href="man/FS/svc_www.html">svc_www</a>
381       <ul>
382        <li>svcnum - <a href="#cust-svc">primary key</a>
383        <li>recnum - <a href="#domain_record">host</a>
384        <li>usersvc - <a href="#svc_acct">account</a>
385       </ul>
386     <li><a name="type_pkgs" href="man/FS/type_pkgs.html">type_pkgs</a>
387       <ul>
388         <li>typenum - <a href="#agent_type">agent type</a>
389         <li>pkgpart - <a href="#part_pkg">Package definition</a>
390       </ul>
391     <li><a name="queue" href="man/FS/queue.html">queue</a> - job queue
392       <ul>
393         <li>jobnum - primary key
394         <li>job
395         <li>_date
396         <li>status
397         <li>statustext
398         <li>svcnum
399       </ul>
400     <li><a name="queue_arg" href="man/FS/queue_arg.html">queue_arg</a> - job arguments
401       <ul>
402         <li>argnum - primary key
403         <li>jobnum - <a href="#queue">job</a>
404         <li>arg - argument
405       </ul>
406     <li><a name="queue_depend" href="man/FS/queue_depend.html">queue_depend</a> - job dependancies
407       <ul>
408         <li>dependnum - primary key
409         <li>jobnum - source jobnum
410         <li>depend_jobnum - dependancy jobnum
411       </ul>
412     <li><a name="radius_usergroup" href="man/FS/radius_usergroup.html">radius_usergroup</a> - Link users to RADIUS groups.
413       <ul>
414         <li>usergroupnum - primary key
415         <li>svcnum - <a href="#svc_acct">account</a>
416         <li>groupname
417       </ul>
418     <li><a name="msgcat" href="man/FS/msgcat.html">msgcat</a> - i18n message catalog
419       <ul>
420         <li>msgnum - primary key
421         <li>msgcode - message code
422         <li>locale - locale
423         <li>msg - Message text
424       </ul>
425   </ul>
426 </body>