e09bae5e2fe88738dfec0f340a60c39d0cfc1b30
[freeside.git] / htdocs / docs / man / FS / cust_bill.html
1 <HTML>
2 <HEAD>
3 <TITLE>FS::cust_bill - Object methods for cust_bill records</TITLE>
4 <LINK REV="made" HREF="mailto:none">
5 </HEAD>
6
7 <BODY>
8
9 <!-- INDEX BEGIN -->
10
11 <UL>
12
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>
20 </UL>
21 <!-- INDEX END -->
22
23 <HR>
24 <P>
25 <H1><A NAME="NAME">NAME</A></H1>
26 <P>
27 FS::cust_bill - Object methods for cust_bill records
28
29 <P>
30 <HR>
31 <H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
32 <P>
33 <PRE>  use FS::cust_bill;
34 </PRE>
35 <P>
36 <PRE>  $record = new FS::cust_bill \%hash;
37   $record = new FS::cust_bill { 'column' =&gt; 'value' };
38 </PRE>
39 <P>
40 <PRE>  $error = $record-&gt;insert;
41 </PRE>
42 <P>
43 <PRE>  $error = $new_record-&gt;replace($old_record);
44 </PRE>
45 <P>
46 <PRE>  $error = $record-&gt;delete;
47 </PRE>
48 <P>
49 <PRE>  $error = $record-&gt;check;
50 </PRE>
51 <P>
52 <PRE>  ( $total_previous_balance, @previous_cust_bill ) = $record-&gt;previous;
53 </PRE>
54 <P>
55 <PRE>  @cust_bill_pkg_objects = $cust_bill-&gt;cust_bill_pkg;
56 </PRE>
57 <P>
58 <PRE>  ( $total_previous_credits, @previous_cust_credit ) = $record-&gt;cust_credit;
59 </PRE>
60 <P>
61 <PRE>  @cust_pay_objects = $cust_bill-&gt;cust_pay;
62 </PRE>
63 <P>
64 <PRE>  @lines = $cust_bill-&gt;print_text;
65   @lines = $cust_bill-&gt;print_text $time;
66 </PRE>
67 <P>
68 <HR>
69 <H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
70 <P>
71 An FS::cust_bill object represents an invoice. FS::cust_bill inherits from
72 FS::Record. The following fields are currently supported:
73
74 <DL>
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/&quot;time&quot;.  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/&quot;collect&quot;).</A></STRONG><DD>
84 </DL>
85 <P>
86 <HR>
87 <H1><A NAME="METHODS">METHODS</A></H1>
88 <DL>
89 <DT><STRONG><A NAME="item_new">new HASHREF</A></STRONG><DD>
90 <P>
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>).
93
94 <DT><STRONG><A NAME="item_insert">insert</A></STRONG><DD>
95 <P>
96 Adds this invoice to the database (``Posts'' the invoice). If there is an
97 error, returns the error, otherwise returns false.
98
99 <P>
100 When adding new invoices, owed must be charged (or null, in which case it
101 is automatically set to charged).
102
103 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><DD>
104 <P>
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?)
107
108 <DT><STRONG><A NAME="item_replace">replace OLD_RECORD</A></STRONG><DD>
109 <P>
110 Replaces the OLD_RECORD with this one in the database. If there is an
111 error, returns the error, otherwise returns false.
112
113 <P>
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>).
117
118 <DT><STRONG><A NAME="item_check">check</A></STRONG><DD>
119 <P>
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
122 replace methods.
123
124 <DT><STRONG><A NAME="item_previous">previous</A></STRONG><DD>
125 <P>
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
128 also).
129
130 <DT><STRONG><A NAME="item_cust_bill_pkg">cust_bill_pkg</A></STRONG><DD>
131 <P>
132 Returns the line items (see <A HREF="../FS/cust_bill_pkg.html">FS::cust_bill_pkg</A>) for this invoice.
133
134 <DT><STRONG><A NAME="item_cust_credit">cust_credit</A></STRONG><DD>
135 <P>
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).
139
140 <DT><STRONG><A NAME="item_cust_pay">cust_pay</A></STRONG><DD>
141 <P>
142 Returns all payments (see <A HREF="../FS/cust_pay.html">FS::cust_pay</A>) for this invoice.
143
144 <DT><STRONG><A NAME="item_print_text">print_text [TIME];</A></STRONG><DD>
145 <P>
146 Returns an ASCII invoice, as a list of lines.
147
148 <P>
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.
153
154 </DL>
155 <P>
156 <HR>
157 <H1><A NAME="VERSION">VERSION</A></H1>
158 <P>
159 $Id: cust_bill.html,v 1.2 2000-03-03 18:22:42 ivan Exp $
160
161 <P>
162 <HR>
163 <H1><A NAME="BUGS">BUGS</A></H1>
164 <P>
165 The delete method.
166
167 <P>
168 print_text formatting (and some logic :/) is in source, but needs to be
169 slurped in from a file. Also number of lines ($=).
170
171 <P>
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?)
174
175 <P>
176 <HR>
177 <H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
178 <P>
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.
181
182 </BODY>
183
184 </HTML>