% title 'Bank statement'; % my ($total_credit, $total_debit); % while ( my $record = $records->next ) { % $total_credit += $record->credit; % $total_debit += $record->debit; % $total_credit -= $total_debit; % if ( $total_credit > 0 ) { % $total_debit = 0; % } % if ( $total_credit < 0 ) { % $total_debit = abs $total_credit; % $total_credit = 0; % } % }
DatePurposeAccountDebitCredit
<%= $record->date %><%== nl2br $record->purpose %><%= $record->account %><%== money $record->debit %><%== money $record->credit %>
Current balance:<%== $total_debit ? money $total_debit : '' %><%== $total_credit ? money $total_credit : '' %>
%= include 'filter-widget'