- # sort the whole thing by account numbers and display
- foreach $ref (sort { $a->{accno} cmp $b->{accno} } @{ $form->{TB} }) {
-
- $description = $form->escape($ref->{description});
-
- $href =
- qq|ca.pl?action=list_transactions&accounttype=$form->{accounttype}&login=$form->{login}&password=$form->{password}&fromdate=$form->{fromdate}&todate=$form->{todate}&sort=transdate&l_heading=$form->{l_heading}&l_subtotal=$form->{l_subtotal}&department=$department&eur=$form->{eur}&projectnumber=$projectnumber&project_id=$form->{project_id}&title=$title&nextsub=$form->{nextsub}&accno=$ref->{accno}&description=$description|;
-
- $ml = ($ref->{category} =~ /(A|C|E)/) ? -1 : 1;
-
- $debit = ($ref->{debit} != 0) ? $form->format_amount(\%myconfig, $ref->{debit}, 2, " ") : " ";
- $credit = ($ref->{credit} != 0) ? $form->format_amount(\%myconfig, $ref->{credit}, 2, " ") : " ";
- $begbalance =
- $form->format_amount(\%myconfig, $ref->{balance} * $ml, 2, " ");
- $endbalance =
- $form->format_amount(\%myconfig,
- ($ref->{balance} + $ref->{amount}) * $ml,
- 2, " ");
-
- # next if ($ref->{debit} == 0 && $ref->{credit} == 0);
-
- if ($ref->{charttype} eq "H" && $subtotal && $form->{l_subtotal}) {
- map { $column_data{$_} = "<th> </th>" }
- qw(accno begbalance endbalance);
-
- $subtotalbegbalance =
- $form->format_amount(\%myconfig, $subtotalbegbalance, 2, " ");
- $subtotalendbalance =
- $form->format_amount(\%myconfig, $subtotalendbalance, 2, " ");
- $subtotaldebit =
- $form->format_amount(\%myconfig, $subtotaldebit, 2, " ");
- $subtotalcredit =
- $form->format_amount(\%myconfig, $subtotalcredit, 2, " ");
-
- $column_data{description} = "<th>$subtotaldescription</th>";
- $column_data{begbalance} = "<th align=right>$subtotalbegbalance</th>";
- $column_data{endbalance} = "<th align=right>$subtotalendbalance</th>";
- $column_data{debit} = "<th align=right>$subtotaldebit</th>";
- $column_data{credit} = "<th align=right>$subtotalcredit</th>";
-
- print qq|
- <tr class=listsubtotal>
-|;
- map { print "$column_data{$_}\n" } @column_index;