X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main.cgi;h=8710dd19d7bea1d8d0d8afe46370bcffa77237ff;hb=5e25b996982d42eb2587ec54db0d5b39508aa730;hp=b17c9277ad788dc9d1448db3ec90207ba24abc24;hpb=c00273147a2d400779fcdaf34f171b2180faa453;p=freeside.git diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index b17c9277a..8710dd19d 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 @@ -268,8 +268,11 @@ print ''. foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { my $pkgpart = $type_pkgs->pkgpart; - my $part_pkg = qsearchs('part_pkg', { 'pkgpart' => $pkgpart } ) - or do { warn "unknown type_pkgs.pkgpart $pkgpart"; next; }; +# my $part_pkg = qsearchs('part_pkg', { 'pkgpart' => $pkgpart } ) +# or do { warn "unknown type_pkgs.pkgpart $pkgpart"; next; }; + my $part_pkg = + qsearchs('part_pkg', { 'pkgpart' => $pkgpart, 'disabled' => '' } ) + or next; print qq!!. $part_pkg->pkg. ' - '. $part_pkg->comment; } @@ -361,6 +364,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 +391,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 +447,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 +480,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; @@ -472,8 +489,13 @@ foreach $item (sort keyfield_numerically @history) { $balance -= $credit - $refund; $balance = sprintf("%.2f", $balance); $balance =~ s/^\-0\.00$/0.00/; #yay ieee fp + $target = '' unless defined $target; - print "",time2str("%D",$date),"", + print ""; + print qq!! unless $target && $target{$target}++; + print time2str("%D",$date); + print '' if $target && $target{$target} == 1; + print "", "$desc", "", ( $charge ? "\$".sprintf("%.2f",$charge) : '' ),