-# if ($form->{accno} eq ''){ # flo & udo: if general report,
- # then check balance
-# while (abs($balance) >= 0.015) {
-# my $ref2 = $sth->fetchrow_hashref(NAME_lc)
-# || $form->error("Unbalanced ledger!");
-#
- $balance =
- (int($balance * 100000) + int(100000 * $ref2->{amount})) / 100000;
- if ($ref2->{amount} < 0) {
- if ($ref2->{chart_id} > 0) {
- if ($ref->{debit_tax_accno}{$i} ne "") {
- $i++;
- }
- $ref->{debit_tax}{$i} = $ref2->{amount} * -1;
- $ref->{debit_tax_accno}{$i} = $ref2->{accno};
- } else {
- if ($ref->{debit_accno}{$k} ne "") {
- $k++;
- }
- $ref->{debit}{$k} = $ref2->{amount} * -1;
- $ref->{debit_accno}{$k} = $ref2->{accno};
- $ref->{debit_taxkey}{$k} = $ref2->{taxkey};
+
+ $balance =
+ (int($balance * 100000) + int(100000 * $ref2->{amount})) / 100000;
+
+
+ if ($ref2->{chart_id} > 0) { # all tax accounts, following lines
+ if ($ref2->{amount} < 0) {
+ if ($ref2->{link} =~ /AR_tax/) {
+ if ($ref->{credit_tax_accno}{$j} ne "") {
+ $j++;
+ }
+ $ref->{credit_tax}{$j} = $ref2->{amount};
+ $ref->{credit_tax_accno}{$j} = $ref2->{accno};
+ }
+ if ($ref2->{link} =~ /AP_tax/) {
+ if ($ref->{debit_tax_accno}{$i} ne "") {
+ $i++;