use strict;
use vars qw( @ISA );
use FS::Record qw( qsearch qsearchs dbh );
-#use FS::cust_bill
+use FS::cust_bill;
+use FS::cust_pay;
@ISA = qw( FS::Record );
my $bill_total = 0;
$bill_total += foreach map { $_->amount }
qsearch('cust_bill_pay', { 'invnum' => $self->invnum } );
-# $bill_total += foreach map { $_->amount }
-# qsearch('cust_credit_bill', { 'invnum' => $self->invnum } );
+ $bill_total += foreach map { $_->amount }
+ qsearch('cust_credit_bill', { 'invnum' => $self->invnum } );
if ( $bill_total > $cust_bill->charged ) {
$dbh->rollback if $oldAutoCommit;
return "total cust_bill_pay.amount and cust_credit_bill.amount $bill_total".
''; #no error
}
+=item cust_pay
+
+Returns the payment (see L<FS::cust_pay>)
+
+=cut
+
+sub cust_pay {
+ my $self = shift;
+ qsearchs( 'cust_pay', { 'invnum' => $self->invnum } );
+}
+
=back
=head1 VERSION
-$Id: cust_bill_pay.pm,v 1.1 2001-09-01 20:11:07 ivan Exp $
+$Id: cust_bill_pay.pm,v 1.3 2001-09-02 01:27:11 ivan Exp $
=head1 BUGS
Delete and replace methods.
-cust_credit_bill isn't checked yet (uncomment around line 111)
+the checks for over-applied payments could be better done like the ones in
+cust_bill_credit
=head1 SEE ALSO