convert from pod for 1.2.0 release
[freeside.git] / htdocs / docs / man / cust_bill.txt
1 NAME
2     FS::cust_bill - Object methods for cust_bill records
3
4 SYNOPSIS
5       use FS::cust_bill;
6
7       $record = new FS::cust_bill \%hash;
8       $record = new FS::cust_bill { 'column' => 'value' };
9
10       $error = $record->insert;
11
12       $error = $new_record->replace($old_record);
13
14       $error = $record->delete;
15
16       $error = $record->check;
17
18       ( $total_previous_balance, @previous_cust_bill ) = $record->previous;
19
20       @cust_bill_pkg_objects = $cust_bill->cust_bill_pkg;
21
22       ( $total_previous_credits, @previous_cust_credit ) = $record->cust_credit;
23
24       @cust_pay_objects = $cust_bill->cust_pay;
25
26       @lines = $cust_bill->print_text;
27       @lines = $cust_bill->print_text $time;
28
29 DESCRIPTION
30     An FS::cust_bill object represents an invoice. FS::cust_bill
31     inherits from FS::Record. The following fields are currently
32     supported:
33
34     invnum - primary key (assigned automatically for new invoices)
35     custnum - customer (see the FS::cust_main manpage)
36     _date - specified as a UNIX timestamp; see the section on "time" in the perlfunc manpage.  Also see
37     the Time::Local manpage and the Date::Parse manpage for conversion functions.
38     charged - amount of this invoice
39     owed - amount still outstanding on this invoice, which is charged minus
40     all payments (see the FS::cust_pay manpage).
41     printed - how many times this invoice has been printed automatically
42     (see the section on "collect" in the FS::cust_main manpage).
43 METHODS
44     new HASHREF
45         Creates a new invoice. To add the invoice to the database,
46         see the section on "insert". Invoices are normally created
47         by calling the bill method of a customer object (see the
48         FS::cust_main manpage).
49
50     insert
51         Adds this invoice to the database ("Posts" the invoice). If
52         there is an error, returns the error, otherwise returns
53         false.
54
55         When adding new invoices, owed must be charged (or null, in
56         which case it is automatically set to charged).
57
58     delete
59         Currently unimplemented. I don't remove invoices because
60         there would then be no record you ever posted this invoice
61         (which is bad, no?)
62
63     replace OLD_RECORD
64         Replaces the OLD_RECORD with this one in the database. If
65         there is an error, returns the error, otherwise returns
66         false.
67
68         Only owed and printed may be changed. Owed is normally
69         updated by creating and inserting a payment (see the
70         FS::cust_pay manpage). Printed is normally updated by
71         calling the collect method of a customer object (see the
72         FS::cust_main manpage).
73
74     check
75         Checks all fields to make sure this is a valid invoice. If
76         there is an error, returns the error, otherwise returns
77         false. Called by the insert and replace methods.
78
79     previous
80         Returns a list consisting of the total previous balance for
81         this customer, followed by the previous outstanding invoices
82         (as FS::cust_bill objects also).
83
84     cust_bill_pkg
85         Returns the line items (see the FS::cust_bill_pkg manpage)
86         for this invoice.
87
88     cust_credit
89         Returns a list consisting of the total previous credited
90         (see the FS::cust_credit manpage) for this customer,
91         followed by the previous outstanding credits
92         (FS::cust_credit objects).
93
94     cust_pay
95         Returns all payments (see the FS::cust_pay manpage) for this
96         invoice.
97
98     print_text [TIME];
99         Returns an ASCII invoice, as a list of lines.
100
101         TIME an optional value used to control the printing of
102         overdue messages. The default is now. It isn't the date of
103         the invoice; that's the `_date' field. It is specified as a
104         UNIX timestamp; see the section on "time" in the perlfunc
105         manpage. Also see the Time::Local manpage and the
106         Date::Parse manpage for conversion functions.
107
108 VERSION
109     $Id: cust_bill.txt,v 1.4 1999-04-08 13:39:31 ivan Exp $
110
111 BUGS
112     The delete method.
113
114     print_text formatting (and some logic :/) is in source, but
115     needs to be slurped in from a file. Also number of lines ($=).
116
117     missing print_ps for a nice postscript copy (maybe HylaFAX-
118     cover-page-style or something similar so the look can be
119     completely customized?)
120
121 SEE ALSO
122     the FS::Record manpage, the FS::cust_main manpage, the
123     FS::cust_pay manpage, the FS::cust_bill_pkg manpage, the
124     FS::cust_credit manpage, schema.html from the base
125     documentation.
126
127 HISTORY
128     ivan@voicenet.com 97-jul-1
129
130     small fix for new API ivan@sisd.com 98-mar-14
131
132     charges can be negative ivan@sisd.com 98-jul-13
133
134     pod, ingegrate with FS::Invoice ivan@sisd.com 98-sep-20
135
136     $Log: cust_bill.txt,v $
137     Revision 1.4  1999-04-08 13:39:31  ivan
138     convert from pod for 1.2.0 release
139  Revision 1.7 1999/02/09 09:55:05 ivan
140     invoices show line items for each service in a package (see the
141     label method of FS::cust_svc)
142
143     Revision 1.6 1999/01/25 12:26:07 ivan yet more mod_perl stuff
144
145     Revision 1.5 1999/01/18 21:58:03 ivan esthetic: eq and ne were
146     used in a few places instead of == and !=
147
148     Revision 1.4 1998/12/29 11:59:36 ivan mostly properly OO, some
149     work still to be done with svc_ stuff
150
151     Revision 1.3 1998/11/13 09:56:53 ivan change configuration file
152     layout to support multiple distinct databases (with own set of
153     config files, export, etc.)
154
155     Revision 1.2 1998/11/07 10:24:24 ivan don't use depriciated
156     FS::Bill and FS::Invoice, other miscellania
157