X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_bill_pay.pm;h=a7e2831ea46bcf398c63600b5a5c0e98569462b7;hp=045a9490b6f021cd67a927c14eeec8762a45f28a;hb=8c1f9804d9a02c0c054eededeb500c72a640249a;hpb=cdd5aa1d86cd5b266e02bed58570c97c2d7698ba diff --git a/FS/FS/cust_bill_pay.pm b/FS/FS/cust_bill_pay.pm index 045a9490b..a7e2831ea 100644 --- a/FS/FS/cust_bill_pay.pm +++ b/FS/FS/cust_bill_pay.pm @@ -3,7 +3,8 @@ package cust_bill_pay; 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 ); @@ -108,8 +109,8 @@ sub insert { 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". @@ -167,17 +168,40 @@ sub check { ''; #no error } +=item cust_pay + +Returns the payment (see L) + +=cut + +sub cust_pay { + my $self = shift; + qsearchs( 'cust_pay', { 'paynum' => $self->paynum } ); +} + +=item cust_bill + +Returns the invoice (see L) + +=cut + +sub cust_bill { + my $self = shift; + qsearchs( 'cust_bill', { '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.4 2001-09-02 02:46:55 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