2 FS::cust_bill - Object methods for cust_bill records
7 $record = create FS::cust_bill \%hash;
8 $record = create FS::cust_bill { 'column' => 'value' };
10 $error = $record->insert;
12 $error = $new_record->replace($old_record);
14 $error = $record->delete;
16 $error = $record->check;
18 ( $total_previous_balance, @previous_cust_bill ) = $record->previous;
20 @cust_bill_pkg_objects = $cust_bill->cust_bill_pkg;
22 ( $total_previous_credits, @previous_cust_credit ) = $record->cust_credit;
24 @cust_pay_objects = $cust_bill->cust_pay;
26 @lines = $cust_bill->print_text;
27 @lines = $cust_bill->print_text $time;
30 An FS::cust_bill object represents an invoice. FS::cust_bill
31 inherits from FS::Record. The following fields are currently
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).
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).
51 Adds this invoice to the database ("Posts" the invoice). If
52 there is an error, returns the error, otherwise returns
55 When adding new invoices, owed must be charged (or null, in
56 which case it is automatically set to charged).
59 Currently unimplemented. I don't remove invoices because
60 there would then be no record you ever posted this invoice
64 Replaces the OLD_RECORD with this one in the database. If
65 there is an error, returns the error, otherwise returns
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).
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.
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).
85 Returns the line items (see the FS::cust_bill_pkg manpage)
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).
95 Returns all payments (see the FS::cust_pay manpage) for this
99 Returns an ASCII invoice, as a list of lines.
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.
111 It doesn't properly override FS::Record yet.
113 print_text formatting (and some logic :/) is in source as a
114 format declaration, which needs to be slurped in from a file.
115 the fork is rather kludgy as well. It could be cleaned with
116 swrite from man perlform, and the picture could be put in a
117 /var/spool/freeside/conf file. Also number of lines ($=).
119 missing print_ps for a nice postscript copy (maybe HylaFAX-
120 cover-page-style or something similar so the look can be
121 completely customized?)
123 There is an off-by-one error in print_text which causes a visual
124 error: "Page 1 of 2" printed on some single-page invoices?
127 the FS::Record manpage, the FS::cust_main manpage, the
128 FS::cust_pay manpage, the FS::cust_bill_pkg manpage, the
129 FS::cust_credit manpage, schema.html from the base
133 ivan@voicenet.com 97-jul-1
135 small fix for new API ivan@sisd.com 98-mar-14
137 charges can be negative ivan@sisd.com 98-jul-13
139 pod, ingegrate with FS::Invoice ivan@sisd.com 98-sep-20
141 $Log: cust_bill.txt,v $
142 Revision 1.2 1998-11-13 09:56:38 ivan
143 change configuration file layout to support multiple distinct databases (with
144 own set of config files, export, etc.)
145 Revision 1.2 1998/11/07 10:24:24 ivan
146 don't use depriciated FS::Bill and FS::Invoice, other