=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
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 } )
;
}
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<FS::cust_pay_refund>).
+
+=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<FS::cust_main>).