From 92c43e05cdc7dc5c5a4f8d6b0017f7d699cda90d Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 26 Dec 2001 09:18:18 +0000 Subject: search by check # --- httemplate/view/cust_main.cgi | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'httemplate/view/cust_main.cgi') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index b17c9277a..eea2403c4 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -361,6 +361,8 @@ print qq!

Payment History!. @history = (); #needed for mod_perl :) +my %target = (); + @bills = qsearch('cust_bill',{'custnum'=>$custnum}); foreach $bill (@bills) { my($bref)=$bill->hashref; @@ -386,9 +388,13 @@ foreach $bill (@bills) { $payment->payinfo, $cust_bill_pay->amount, ); - $payinfo = substr($payinfo,0,4). 'x'x(length($payinfo)-4) if $payby eq 'CARD'; + $payinfo = substr($payinfo,0,4). 'x'x(length($payinfo)-4) + if $payby eq 'CARD'; + my $target = "$payby$payinfo"; + $payby =~ s/^BILL$/Check #/ if $payinfo; + $payby =~ s/^(CARD|COMP)$/$1 /; push @history, - "$date\tPayment, Invoice #$invnum ($payby $payinfo)\t\t$paid\t\t"; + "$date\tPayment, Invoice #$invnum ($payby$payinfo)\t\t$paid\t\t\t$target"; } my(@cust_credit_bill)= @@ -438,12 +444,20 @@ foreach my $refund (@refunds) { my @unapplied_payments = grep { $_->unapplied > 0 } qsearch('cust_pay', { 'custnum' => $custnum } ); foreach my $payment (@unapplied_payments) { + my $payby = $payment->payby; + my $payinfo = $payment->payinfo; + #false laziness w/above + $payinfo = substr($payinfo,0,4). 'x'x(length($payinfo)-4) + if $payby eq 'CARD'; + my $target = "$payby$payinfo"; + $payby =~ s/^BILL$/Check #/ if $payinfo; + $payby =~ s/^(CARD|COMP)$/$1 /; push @history, $payment->_date. "\t". ''. 'Unapplied payment #' . - $payment->paynum . "". - "\t\t" . $payment->unapplied . "\t\t"; + $payment->paynum . " ($payby$payinfo)". + "\t\t" . $payment->unapplied . "\t\t\t$target"; } #formatting @@ -463,7 +477,7 @@ END $balance = 0; foreach $item (sort keyfield_numerically @history) { - my($date,$desc,$charge,$payment,$credit,$refund)=split(/\t/,$item); + my($date,$desc,$charge,$payment,$credit,$refund,$target)=split(/\t/,$item); $charge ||= 0; $payment ||= 0; $credit ||= 0; @@ -473,7 +487,11 @@ foreach $item (sort keyfield_numerically @history) { $balance = sprintf("%.2f", $balance); $balance =~ s/^\-0\.00$/0.00/; #yay ieee fp - print "",time2str("%D",$date),"", + print ""; + print qq!! unless $target{$target}++; + print time2str("%D",$date); + print '' if $target{$target} == 1; + print "", "$desc", "", ( $charge ? "\$".sprintf("%.2f",$charge) : '' ), -- cgit v1.2.1