-
-
-
-|;
-
- map { print "\n$column_header{$_}" } @column_index;
-
- print qq|
-
-|;
-
- my $ml = ($form->{category} eq 'A') ? -1 : 1;
- $form->{beginningbalance} *= $ml;
- my $balance = $form->{beginningbalance};
- my $clearedbalance = $balance;
- my $i = 0;
- my $id = 0;
-
- my %column_data;
- map { $column_data{$_} = " | " }
- qw(cleared transdate source name debit credit);
- $column_data{balance} =
- ""
- . $form->format_amount(\%myconfig, $balance, 2, 0) . " | ";
- my $j = 0;
- print qq|
-
-|;
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
-
-|;
-
- my $cleared;
- my $totaldebits;
- my $totalcredits;
- my $fx_transaction;
- my $fx;
- foreach my $ref (@{ $form->{PR} }) {
-
- $balance += $ref->{amount} * $ml;
- $cleared += $ref->{amount} * $ml if $ref->{cleared};
-
- $column_data{name} = "$ref->{name} | ";
- $column_data{source} = qq|$ref->{source}
- | |;
- $column_data{transdate} = "$ref->{transdate} | ";
-
- $column_data{debit} = " | ";
- $column_data{credit} = " | ";
-
- if ($ref->{amount} < 0) {
- $totaldebits += $ref->{amount} * -1;
- $column_data{debit} =
- ""
- . $form->format_amount(\%myconfig, $ref->{amount} * -1, 2, " ")
- . " | ";
- } else {
- $totalcredits += $ref->{amount};
- $column_data{credit} =
- ""
- . $form->format_amount(\%myconfig, $ref->{amount}, 2, " ")
- . " | ";
- }
-
- $column_data{balance} =
- ""
- . $form->format_amount(\%myconfig, $balance, 2, 0) . " | ";
-
- if ($ref->{fx_transaction}) {
- $i++ unless $id == $ref->{id};
- $fx_transaction = 1;
- $fx += $ref->{amount} * $ml;
- $column_data{cleared} = qq|
- {oid}>
- | |;
- } else {
- $i++ unless ($fx_transaction && $id == $ref->{id});
- $fx_transaction = 0;
- $column_data{cleared} = qq|
- {cleared}>
- {oid}>
- | |;
- }
- $id = $ref->{id};
-
- $j++;
- $j %= 2;
- print qq|
-
-|;
-
- map { print "\n$column_data{$_}" } @column_index;
-
- print qq|
-
-|;
- }
+ my $statementbalance = $::form->parse_amount(\%::myconfig, $::form->{statementbalance});
+ my $difference = $statementbalance - $clearedbalance - $cleared;
- # print totals
- map { $column_data{$_} = " | " } @column_index;
-
- $column_data{debit} =
- ""
- . $form->format_amount(\%myconfig, $totaldebits, 2, " ") . " | ";
- $column_data{credit} =
- ""
- . $form->format_amount(\%myconfig, $totalcredits, 2, " ") . " | ";
-
- print qq|
-
-|;
-
- map { print "\n$column_data{$_}" } @column_index;
-
- $form->{statementbalance} =
- $form->parse_amount(\%myconfig, $form->{statementbalance});
- my $difference =
- $form->format_amount(\%myconfig,
- $form->{statementbalance} - $clearedbalance - $cleared,
- 2, 0);
-
- $form->{statementbalance} =
- $form->format_amount(\%myconfig, $form->{statementbalance}, 2, 0);
-
- $clearedbalance = $form->format_amount(\%myconfig, $clearedbalance, 2, 0);
-
- my $exchdiff;
- if ($fx) {
- $fx = $form->format_amount(\%myconfig, $fx, 2, 0);
- $exchdiff = qq|
- | . $locale->text('Exchangerate Difference') . qq| |
- |
- $fx |
-|;
- }
+ $::form->header;
+ print $::form->parse_html_template('rc/step2', {
+ is_asset => $::form->{category} eq 'A',
+ option => \@options,
+ DATA => \@rows,
+ total => {
+ credit => $totalcredits,
+ debit => $totaldebits,
+ },
+ balance => {
+ beginning => $beginningbalance,
+ cleared => $clearedbalance,
+ statement => $statementbalance,
+ },
+ difference => $difference,
+ rowcount => $i,
+ fx => $fx,
+ });
- print qq|
-
-
- |
-
-