>
% unless ( !$target || $target{$target}++ ) {
% }
<% time2str("%D",$item->{'date'}) %>
% if ( $target && $target{$target} == 1 ) {
% }
|
<% $item->{'desc'} %>
|
<% $charge %>
|
<% $payment %>
|
<% $credit %>
|
<% $refund %>
|
<% $showbalance %>
|
% }
%if ( scalar(@history) && $hidden && ! $seen++ ) {
% balance_forward_row($balance, $lastdate);
%}
<%init>
my( $cust_main ) = @_;
my $custnum = $cust_main->custnum;
my $conf = new FS::Conf;
my $curuser = $FS::CurrentUser::CurrentUser;
my @payby = grep /\w/, $conf->config('payby');
#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP ))
@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP ))
unless @payby;
my %payby = map { $_=>1 } @payby;
my %status = (
'Queued' => 'O', #Open
'In-transit' => 'I',
'Complete' => 'R', #Resolved
'All' => '',
);
#get payment history
my @history = ();
#invoices
foreach my $cust_bill ($cust_main->cust_bill) {
push @history, {
'date' => $cust_bill->_date,
'desc' => include('payment_history/invoice.html', $cust_bill),
'charge' => $cust_bill->charged,
};
}
#payments (some false laziness w/credits)
foreach my $cust_pay ($cust_main->cust_pay) {
push @history, {
'date' => $cust_pay->_date,
'desc' => include('payment_history/payment.html', $cust_pay),
'payment' => $cust_pay->paid,
#'target' => $target, #XXX
};
}
#voided payments
foreach my $cust_pay_void ($cust_main->cust_pay_void) {
push @history, {
'date' => $cust_pay_void->_date,
'desc' => include('payment_history/voided_payment.html', $cust_pay_void),
'void_payment' => $cust_pay_void->paid,
};
}
#credits (some false laziness w/payments)
foreach my $cust_credit ($cust_main->cust_credit) {
push @history, {
'date' => $cust_credit->_date,
'desc' => include('payment_history/credit.html', $cust_credit),
'credit' => $cust_credit->amount,
};
}
#refunds
foreach my $cust_refund ($cust_main->cust_refund) {
push @history, {
'date' => $cust_refund->_date,
'desc' => include('payment_history/refund.html', $cust_refund),
'refund' => $cust_refund->refund,
};
}
%init>