X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_pay.pm;h=d901c7811e4076822b0a198807f968fd9ac3737f;hp=3317a32bd4392503305e1772a7d5d389ec5eaaa8;hb=2295d728ff0bf2b692c97eb23fe76e38036ee631;hpb=cfe85e45bcba97089988b4dc22a895aec687f2c3 diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 3317a32bd..d901c7811 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -325,13 +325,7 @@ sub delete { =item replace OLD_RECORD -Currently unimplemented (accounting reasons). - -=cut - -sub replace { - return "Can't (yet?) modify cust_pay records!"; -} +You probably shouldn't modify payments... =item check @@ -396,7 +390,8 @@ payment. sub cust_bill_pay { my $self = shift; - sort { $a->_date <=> $b->_date } + sort { $a->_date <=> $b->_date + || $a->invnum <=> $b->invnum } qsearch( 'cust_bill_pay', { 'paynum' => $self->paynum } ) ; } @@ -432,6 +427,21 @@ sub unapplied { sprintf("%.2f", $amount ); } +=item unrefunded + +Returns the amount of this payment that has not been refuned; which is +paid minus all refund applications (see L). + +=cut + +sub unrefunded { + my $self = shift; + my $amount = $self->paid; + $amount -= $_->amount foreach ( $self->cust_pay_refund ); + sprintf("%.2f", $amount ); +} + + =item cust_main Returns the parent customer object (see L).