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