%# and now the table
<& /elements/table-grid.html &>
% my $bgcolor1 = '#eeeeee';
% my $bgcolor2 = '#ffffff';
% my $bgcolor = '';
<% mt('Date') |h %> |
<% mt('Description') |h %> |
<% mt('Invoice') |h %> |
<% mt('Payment') |h %> |
<% mt('In-house Credit') |h %> |
<% mt('Refund') |h %> |
<% mt('Balance') |h %> |
%#display payment history
%my %target = ();
%
%my $hidden = 0;
%my $seen = 0;
%my $old_history = 0;
%my $lastdate = 0;
%
%foreach my $item ( @history ) {
%
% $lastdate = $item->{'date'};
%
% my $display = '';
% if ( $item->{'hide'} ) {
% $display = ' STYLE="display:none" ';
% }
%
% if ( $bgcolor eq $bgcolor1 ) {
% $bgcolor = $bgcolor2;
% } else {
% $bgcolor = $bgcolor1;
% }
%
% my $charge = exists($item->{'charge'})
% ? sprintf("$money_char\%.2f", $item->{'charge'})
% : exists($item->{'charge_nobal'})
% ? sprintf("$money_char\%.2f", $item->{'charge_nobal'})
% : exists($item->{'void_charge'})
% ? sprintf("$money_char\%.2f", $item->{'void_charge'})
% : '';
%
% my $payment = exists($item->{'payment'})
% ? sprintf("- $money_char\%.2f", $item->{'payment'})
% : '';
%
% $payment ||= sprintf( "- $money_char\%.2f",
% $item->{'void_payment'}
% )
% if exists($item->{'void_payment'});
%
% my $credit = exists($item->{'credit'})
% ? sprintf("- $money_char\%.2f", $item->{'credit'})
% : '';
%
% $credit ||= sprintf( "- $money_char\%.2f",
% $item->{'void_credit'}
% )
% if exists($item->{'void_credit'});
%
% my $refund = exists($item->{'refund'})
% ? sprintf("$money_char\%.2f", $item->{'refund'})
% : '';
%
% my $target = exists($item->{'target'}) ? $item->{'target'} : '';
%
% my $showbalance = $money_char . $item->{'balance'};
% $showbalance =~ s/^\$\-/- \$/;
|
>
% unless ( !$target || $target{$target}++ ) {
% }
<% time2str($date_format, $item->{'date'}) %>
% if ( $target && $target{$target} == 1 ) {
% }
|
<% $item->{'desc'} %>
|
<% $charge %>
|
<% $payment %>
|
<% $credit %>
|
<% $refund %>
|
<% $showbalance %>
|
% if ( $item->{'balance_forward'} ) {
<& .balance_forward_row, $item->{'balance'}, $item->{'date'} &>
% }
%} # foreach $item