- $cref->{_date} . "\tCredit #" . $cref->{crednum} . ", (Balance \$" .
- $cref->{credited} . ") by " . $cref->{otaker} . " - " .
- $cref->{reason} . "\t\t\t" . $cref->{amount} . "\t";
-
- my(@refunds)=qsearch('cust_refund',{'crednum'=> $cref->{crednum} } );
- my($refund);
- foreach $refund (@refunds) {
- my($rref)=$refund->hashref;
- push @history,
- $rref->{_date} . "\tRefund, Credit #" . $rref->{crednum} . " (" .
- $rref->{payby} . " " . $rref->{payinfo} . ") by " .
- $rref->{otaker} . " - ". $rref->{reason} . "\t\t\t\t" .
- $rref->{refund};
- }
+ $cref->{_date} . "\t" .
+ qq!<A HREF="! . popurl(2). qq!edit/cust_credit_bill.cgi?!. $cref->{crednum} . qq!">!.
+ '<b><font size="+1" color="#ff0000">Unapplied credit #' .
+ $cref->{crednum} . "</font></b></A>: ".
+ $cref->{reason} . "\t\t\t" . $credit->credited . "\t";
+}
+
+my(@refunds)=qsearch('cust_refund',{'custnum'=> $custnum } );
+foreach my $refund (@refunds) {
+ my($rref)=$refund->hashref;
+ my($refundnum) = (
+ $refund->refundnum,
+ );
+
+ push @history,
+ $rref->{_date} . "\tRefund #$refundnum, (" .
+ $rref->{payby} . " " . $rref->{payinfo} . ") by " .
+ $rref->{otaker} . " - ". $rref->{reason} . "\t\t\t\t" .
+ $rref->{refund};
+}
+
+my @unapplied_payments =
+ grep { $_->unapplied > 0 } qsearch('cust_pay', { 'custnum' => $custnum } );
+foreach my $payment (@unapplied_payments) {
+ push @history,
+ $payment->_date. "\t".
+ '<A HREF="'. popurl(2). 'edit/cust_bill_pay.cgi?'. $payment->paynum. '">'.
+ '<b><font size="+1" color="#ff0000">Unapplied payment #' .
+ $payment->paynum . "</font></b></A>".
+ "\t\t" . $payment->unapplied . "\t\t";