3 <TITLE>FS::cust_bill - Object methods for cust_bill records</TITLE>
4 <LINK REV="made" HREF="mailto:ivan@rootwood.sisd.com">
13 <LI><A HREF="#NAME">NAME</A>
14 <LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
15 <LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
16 <LI><A HREF="#METHODS">METHODS</A>
17 <LI><A HREF="#VERSION">VERSION</A>
18 <LI><A HREF="#BUGS">BUGS</A>
19 <LI><A HREF="#SEE_ALSO">SEE ALSO</A>
25 <H1><A NAME="NAME">NAME</A></H1>
27 FS::cust_bill - Object methods for cust_bill records
31 <H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
33 <PRE> use FS::cust_bill;
36 <PRE> $record = new FS::cust_bill \%hash;
37 $record = new FS::cust_bill { 'column' => 'value' };
40 <PRE> $error = $record->insert;
43 <PRE> $error = $new_record->replace($old_record);
46 <PRE> $error = $record->delete;
49 <PRE> $error = $record->check;
52 <PRE> ( $total_previous_balance, @previous_cust_bill ) = $record->previous;
55 <PRE> @cust_bill_pkg_objects = $cust_bill->cust_bill_pkg;
58 <PRE> ( $total_previous_credits, @previous_cust_credit ) = $record->cust_credit;
61 <PRE> @cust_pay_objects = $cust_bill->cust_pay;
64 <PRE> @lines = $cust_bill->print_text;
65 @lines = $cust_bill->print_text $time;
69 <H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
71 An FS::cust_bill object represents an invoice. FS::cust_bill inherits from
72 FS::Record. The following fields are currently supported:
75 <DT><STRONG><A NAME="item_invnum">invnum - primary key (assigned automatically for new invoices)</A></STRONG><DD>
76 <DT><STRONG><A NAME="item_custnum">custnum - customer (see FS::cust_main)</A></STRONG><DD>
77 <DT><STRONG><A NAME="item__date">_date - specified as a UNIX timestamp; see perlfunc/"time". Also see
78 Time::Local and Date::Parse for conversion functions.</A></STRONG><DD>
79 <DT><STRONG><A NAME="item_charged">charged - amount of this invoice</A></STRONG><DD>
80 <DT><STRONG><A NAME="item_owed">owed - amount still outstanding on this invoice, which is charged minus
81 all payments (see FS::cust_pay).</A></STRONG><DD>
82 <DT><STRONG><A NAME="item_printed">printed - how many times this invoice has been printed automatically
83 (see FS::cust_main/"collect").</A></STRONG><DD>
87 <H1><A NAME="METHODS">METHODS</A></H1>
89 <DT><STRONG><A NAME="item_new">new HASHREF</A></STRONG><DD>
91 Creates a new invoice. To add the invoice to the database, see <A HREF="#insert">insert</A>. Invoices are normally created by calling the bill method of a customer
92 object (see <A HREF="../FS/cust_main.html">FS::cust_main</A>).
94 <DT><STRONG><A NAME="item_insert">insert</A></STRONG><DD>
96 Adds this invoice to the database (``Posts'' the invoice). If there is an
97 error, returns the error, otherwise returns false.
100 When adding new invoices, owed must be charged (or null, in which case it
101 is automatically set to charged).
103 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><DD>
105 Currently unimplemented. I don't remove invoices because there would then
106 be no record you ever posted this invoice (which is bad, no?)
108 <DT><STRONG><A NAME="item_replace">replace OLD_RECORD</A></STRONG><DD>
110 Replaces the OLD_RECORD with this one in the database. If there is an
111 error, returns the error, otherwise returns false.
114 Only owed and printed may be changed. Owed is normally updated by creating
115 and inserting a payment (see <A HREF="../FS/cust_pay.html">FS::cust_pay</A>). Printed is normally updated by calling the collect method of a customer
116 object (see <A HREF="../FS/cust_main.html">FS::cust_main</A>).
118 <DT><STRONG><A NAME="item_check">check</A></STRONG><DD>
120 Checks all fields to make sure this is a valid invoice. If there is an
121 error, returns the error, otherwise returns false. Called by the insert and
124 <DT><STRONG><A NAME="item_previous">previous</A></STRONG><DD>
126 Returns a list consisting of the total previous balance for this customer,
127 followed by the previous outstanding invoices (as FS::cust_bill objects
130 <DT><STRONG><A NAME="item_cust_bill_pkg">cust_bill_pkg</A></STRONG><DD>
132 Returns the line items (see <A HREF="../FS/cust_bill_pkg.html">FS::cust_bill_pkg</A>) for this invoice.
134 <DT><STRONG><A NAME="item_cust_credit">cust_credit</A></STRONG><DD>
136 Returns a list consisting of the total previous credited (see
137 <A HREF="../FS/cust_credit.html">FS::cust_credit</A>) for this customer, followed by the previous outstanding credits
138 (FS::cust_credit objects).
140 <DT><STRONG><A NAME="item_cust_pay">cust_pay</A></STRONG><DD>
142 Returns all payments (see <A HREF="../FS/cust_pay.html">FS::cust_pay</A>) for this invoice.
144 <DT><STRONG><A NAME="item_print_text">print_text [TIME];</A></STRONG><DD>
146 Returns an ASCII invoice, as a list of lines.
149 TIME an optional value used to control the printing of overdue messages.
150 The default is now. It isn't the date of the invoice; that's the `_date'
151 field. It is specified as a UNIX timestamp; see <EM>perlfunc</EM>. Also see
152 <A HREF="../Time/Local.html">Time::Local</A> and <A HREF="../Date/Parse.html">Date::Parse</A> for conversion functions.
157 <H1><A NAME="VERSION">VERSION</A></H1>
159 $Id: cust_bill.html,v 1.1 1999-08-04 12:13:27 ivan Exp $
163 <H1><A NAME="BUGS">BUGS</A></H1>
168 print_text formatting (and some logic :/) is in source, but needs to be
169 slurped in from a file. Also number of lines ($=).
172 missing print_ps for a nice postscript copy (maybe HylaFAX-cover-page-style
173 or something similar so the look can be completely customized?)
177 <H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
179 <A HREF="../FS/Record.html">FS::Record</A>, <A HREF="../FS/cust_main.html">FS::cust_main</A>, <A HREF="../FS/cust_pay.html">FS::cust_pay</A>, <A HREF="../FS/cust_bill_pkg.html">FS::cust_bill_pkg</A>,
180 <A HREF="../FS/cust_credit.html">FS::cust_credit</A>, schema.html from the base documentation.