- # 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};
- #}
-
- $debit = "";
- foreach $key (sort keys(%{ $ref->{debit} })) {
- $subtotaldebit += $ref->{debit}{$key};
- $totaldebit += $ref->{debit}{$key};
- if ($key == 0) {
- $debit = $form->format_amount(\%myconfig, $ref->{debit}{$key}, 2, 0);
- } else {
- $debit .=
- "<br>" . $form->format_amount(\%myconfig, $ref->{debit}{$key}, 2, 0);
- }
- $form->{balance} = abs($form->{balance}) - abs($ref->{debit}{$key});
- }
-
- $credit = "";
- foreach $key (sort keys(%{ $ref->{credit} })) {
- $subtotalcredit += $ref->{credit}{$key};
- $totalcredit += $ref->{credit}{$key};
- if ($key == 0) {
- $credit = $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0);
- } else {
- $credit .= "<br>"
- . $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0);
- }
- $form->{balance} = abs($form->{balance}) - abs( $ref->{credit}{$key});
- }
-
- $debittax = "";
- foreach $key (sort keys(%{ $ref->{debit_tax} })) {
- $subtotaldebittax += $ref->{debit_tax}{$key};
- $totaldebittax += $ref->{debit_tax}{$key};
- if ($key == 0) {
- $debittax =
- $form->format_amount(\%myconfig, $ref->{debit_tax}{$key}, 2, 0);
- } else {
- $debittax .= "<br>"
- . $form->format_amount(\%myconfig, $ref->{debit_tax}{$key}, 2, 0);
- }
- $form->{balance} = abs($form->{balance}) - abs($ref->{debit_tax}{$key});
- }
-
- $credittax = "";
- foreach $key (sort keys(%{ $ref->{credit_tax} })) {
- $subtotalcredittax += $ref->{credit_tax}{$key};
- $totalcredittax += $ref->{credit_tax}{$key};
- if ($key == 0) {
- $credittax =
- $form->format_amount(\%myconfig, $ref->{credit_tax}{$key}, 2, 0);
- } else {
- $credittax .= "<br>"
- . $form->format_amount(\%myconfig, $ref->{credit_tax}{$key}, 2, 0);
- }
- $form->{balance} = abs($form->{balance}) - abs($ref->{credit_tax}{$key});
- }
-
- $debitaccno = "";
- $debittaxkey = "";
- $taxaccno = "";
- foreach $key (sort keys(%{ $ref->{debit_accno} })) {
- if ($key == 0) {
- $debitaccno =
- "<a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{debit_accno}{$key}</a>";
- } else {
- $debitaccno .=
- "<br><a href=$href&accno=$ref->{accno}&callback=$callback>$ref->{debit_accno}{$key}</a>";
- }
- if ($ref->{debit_taxkey}{$key} eq $debittaxkey) {
- $ref->{debit_tax_accno}{$key} = $taxaccno;
- }
- $taxaccno = $ref->{debit_tax_accno}{$key};
- $debittaxkey = $ref->{debit_taxkey}{$key};
- }