$ref->{credit_taxkey}{$l} = $ref->{taxkey};
}
}
-
- 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;
- print(STDERR $balance, " BAlance\n");
- 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};
- }
- } else {
- if ($ref2->{chart_id} > 0) {
- if ($ref->{credit_tax_accno}{$j} ne "") {
- $j++;
- }
- $ref->{credit_tax}{$j} = $ref2->{amount};
- $ref->{credit_tax_accno}{$j} = $ref2->{accno};
- } else {
- if ($ref->{credit_accno}{$l} ne "") {
- $l++;
- }
- $ref->{credit}{$l} = $ref2->{amount};
- $ref->{credit_accno}{$l} = $ref2->{accno};
- $ref->{credit_taxkey}{$l} = $ref2->{taxkey};
- }
- }
- }
-
+# 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;
+# print(STDERR $balance, " BAlance\n");
+# print(STDERR $ref2->{amount}, " Ref2->amount\n");
+# 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};
+# }
+# } else {
+# if ($ref2->{chart_id} > 0) {
+# if ($ref->{credit_tax_accno}{$j} ne "") {
+# $j++;
+# }
+# $ref->{credit_tax}{$j} = $ref2->{amount};
+# $ref->{credit_tax_accno}{$j} = $ref2->{accno};
+# } else {
+# if ($ref->{credit_accno}{$l} ne "") {
+# $l++;
+# }
+# $ref->{credit}{$l} = $ref2->{amount};
+# $ref->{credit_accno}{$l} = $ref2->{accno};
+# $ref->{credit_taxkey}{$l} = $ref2->{taxkey};
+# }
+# }
+# }
+# } else {
+# # if account-report, then calculate the Balance?!
+# # ToDo: Calculate the Balance
+# 1;
+# }
+
# print(STDERR Dumper($ref));
push @{ $form->{GL} }, $ref;
$balance = 0;
$form->{title} = $locale->text('General Ledger');
- $ml = ($form->{ml} =~ /(A|E)/) ? -1 : 1;
+ $ml = ($form->{ml} =~ /(A|E|Q)/) ? -1 : 1;
unless ($form->{category} eq 'X') {
$form->{title} .= " : " . $locale->text($acctype{ $form->{category} });
</tr>
|;
}
-
+ $form->{balance} *= $ml;
foreach $ref (@{ $form->{GL} }) {
-
+ $form->{balance} *= $ml;
# if item ne sort print subtotal
if ($form->{l_subtotal} eq 'Y') {
if ($sameitem ne $ref->{ $form->{sort} }) {
&gl_subtotal;
}
}
- foreach $key (sort keys(%{ $ref->{amount} })) {
- $form->{balance} += $ref->{amount}{$key};
- }
+ #foreach $key (sort keys(%{ $ref->{amount} })) {
+ # $form->{balance} += $ref->{amount}{$key};
+ #}
$debit = "";
foreach $key (sort keys(%{ $ref->{debit} })) {
$debit .=
"<br>" . $form->format_amount(\%myconfig, $ref->{debit}{$key}, 2, 0);
}
+ $form->{balance} = abs($form->{balance}) - abs($ref->{debit}{$key});
}
$credit = "";
$credit .= "<br>"
. $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0);
}
+ $form->{balance} = abs($form->{balance}) - abs( $ref->{credit}{$key});
}
$debittax = "";
$debittax .= "<br>"
. $form->format_amount(\%myconfig, $ref->{debit_tax}{$key}, 2, 0);
}
+ $form->{balance} = abs($form->{balance}) - abs($ref->{debit_tax}{$key});
}
$credittax = "";
$credittax .= "<br>"
. $form->format_amount(\%myconfig, $ref->{credit_tax}{$key}, 2, 0);
}
+ $form->{balance} = abs($form->{balance}) - abs($ref->{credit_tax}{$key});
}
$debitaccno = "";
"<td><a href=$href&gifi_accno=$ref->{gifi_accno}&callback=$callback>$ref->{gifi_accno}</a> </td>";
$column_data{balance} =
"<td align=right>"
- . $form->format_amount(\%myconfig, $form->{balance} * $ml, 2, 0)
+ . $form->format_amount(\%myconfig, $form->{balance}, 2, 0)
. "</td>";
$i++;