map {
$chart .=
- "<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}</option>"
+ "<option value=\"$_->{accno}--$_->{tax_id}\">$_->{accno}--$_->{description}</option>"
} @{ $form->{chart} };
map {
$tax .=
- qq|<option value="$_->{taxkey}--$_->{rate}">$_->{taxdescription} |
+ qq|<option value="$_->{id}--$_->{rate}">$_->{taxdescription} |
. ($_->{rate} * 100) . qq| %|
} @{ $form->{TAX} };
GL->transaction(\%myconfig, \%$form);
map {
$chart .=
- "<option value=\"$_->{accno}--$_->{taxkey_id}\">$_->{accno}--$_->{description}</option>"
+ "<option value=\"$_->{accno}--$_->{tax_id}\">$_->{accno}--$_->{description}</option>"
} @{ $form->{chart} };
map {
$tax .=
- qq|<option value="$_->{taxkey}--$_->{rate}">$_->{taxdescription} |
+ qq|<option value="$_->{id}--$_->{rate}">$_->{taxdescription} |
. ($_->{rate} * 100) . qq| %|
} @{ $form->{TAX} };
$j = $i - 1;
if ($tax && ($ref->{accno} eq $taxaccno)) {
$form->{"tax_$j"} = abs($ref->{amount});
- $form->{"taxchart_$j"} = $ref->{taxkey} . "--" . $ref->{taxrate};
+ $form->{"taxchart_$j"} = $ref->{id} . "--" . $ref->{taxrate};
if ($form->{taxincluded}) {
if ($ref->{amount} < 0) {
$form->{"debit_$j"} += $form->{"tax_$j"};
}
}
} else {
- $form->{"accno_$i"} = "$ref->{accno}--$ref->{accnotaxkey}";
+ $form->{"accno_$i"} = "$ref->{accno}--$ref->{tax_id}";
for (qw(fx_transaction source memo)) { $form->{"${_}_$i"} = $ref->{$_} }
if ($ref->{amount} < 0) {
$form->{totaldebit} -= $ref->{amount};
$form->{totalcredit} += $ref->{amount};
$form->{"credit_$i"} = $ref->{amount};
}
- $form->{"taxchart_$i"} = "0--";
+ $form->{"taxchart_$i"} = "0--0.00";
$i++;
}
if ($ref->{taxaccno} && !$tax) {
<tr>
<th align=right>| . $locale->text('From') . qq|</th>
$button1
+ <th align=right>| . $locale->text('To (time)') . qq|</th>
$button2
</tr>
<tr>
</tr>
|;
}
- $form->{balance} *= $ml;
+ $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};
#}
$credit .= "<br>"
. $form->format_amount(\%myconfig, $ref->{credit}{$key}, 2, 0);
}
- $form->{balance} = abs($form->{balance}) - abs( $ref->{credit}{$key});
+ $form->{balance} = abs($form->{balance}) - abs($ref->{credit}{$key});
}
$debittax = "";
$debitaccno .=
"<br><a href=$href&accno=$ref->{debit_accno}{$key}&callback=$callback>$ref->{debit_accno}{$key}</a>";
}
-# if ($ref->{debit_taxkey}{$key} eq $debittaxkey) {
-# $ref->{debit_tax_accno}{$key} = $taxaccno;
-# }
+
+ # if ($ref->{debit_taxkey}{$key} eq $debittaxkey) {
+ # $ref->{debit_tax_accno}{$key} = $taxaccno;
+ # }
$taxaccno = $ref->{debit_tax_accno}{$key};
$debittaxkey = $ref->{debit_taxkey}{$key};
}
$creditaccno .=
"<br><a href=$href&accno=$ref->{credit_accno}{$key}&callback=$callback>$ref->{credit_accno}{$key}</a>";
}
-# if ($ref->{credit_taxkey}{$key} eq $credittaxkey) {
-# $ref->{credit_tax_accno}{$key} = $taxaccno;
-# }
+
+ # if ($ref->{credit_taxkey}{$key} eq $credittaxkey) {
+ # $ref->{credit_tax_accno}{$key} = $taxaccno;
+ # }
$taxaccno = $ref->{credit_tax_accno}{$key};
$credittaxkey = $ref->{credit_taxkey}{$key};
}
$column_data{gifi_accno} =
"<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}, 2, 0)
- . "</td>";
+ "<td align=right>"
+ . $form->format_amount(\%myconfig, $form->{balance}, 2, 0) . "</td>";
$i++;
$i %= 2;
<input class=submit type=submit name=action value="|
. $locale->text('Sales Invoice') . qq|">
<input class=submit type=submit name=action value="|
- . $locale->text('Vendor Invoice') . qq|">|;
-
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
- print qq|
+ . $locale->text('Vendor Invoice') . qq|">
</form>
: $form->{"debit_$i"};
$j = $#a;
if (($debitcredit && $credittax) || (!$debitcredit && $debittax)) {
- $form->{"taxchart_$i"} = "0--";
+ $form->{"taxchart_$i"} = "0--0.00";
$form->{"tax_$i"} = 0;
}
if (!$form->{"korrektur_$i"}) {
<td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:200px" tabindex=|
. ($i + 5 + (($i - 1) * 8)) . qq|>$form->{chartinit}</select></td>|;
$tax =
- qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px" tabindex=|
+ qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px" tabindex=|
. ($i + 10 + (($i - 1) * 8))
. qq|>$form->{taxchart}</select></td>|;
-# if ($form->{selectprojectnumber}) {
-# $project = qq|
-# <td><select name="projectnumber_$i">$form->{selectprojectnumber}</select></td>|;
-# }
+
+ # if ($form->{selectprojectnumber}) {
+ # $project = qq|
+ # <td><select name="projectnumber_$i">$form->{selectprojectnumber}</select></td>|;
+ # }
$korrektur =
qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=|
. ($i + 9 + (($i - 1) * 8))
. qq|>$accno</select></td>|;
$tax = $taxchart;
$tax_selected = $form->{"taxchart_$i"};
+ print(STDERR "TAX_SELCTED $tax_selected\n");
$tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
$tax =
qq|<td><select id="taxchart_$i" name="taxchart_$i" tabindex=|
. ($i + 10 + (($i - 1) * 8))
. qq|>$tax</select></td>|;
-# if ($form->{selectprojectnumber}) {
-# $form->{"projectnumber_$i"} = ""
-# if $form->{selectprojectnumber} !~ /$form->{"projectnumber_$i"}/;
-#
-# $project = $form->{"projectnumber_$i"};
-# $project =~ s/--.*//;
-# $project = qq|<td>$project</td>|;
-# }
+ # if ($form->{selectprojectnumber}) {
+ # $form->{"projectnumber_$i"} = ""
+ # if $form->{selectprojectnumber} !~ /$form->{"projectnumber_$i"}/;
+ #
+ # $project = $form->{"projectnumber_$i"};
+ # $project =~ s/--.*//;
+ # $project = qq|<td>$project</td>|;
+ # }
if ($form->{transfer}) {
$checked = ($form->{"fx_transaction_$i"}) ? "1" : "";
$tax = qq|
<td><select id="taxchart_$i" name="taxchart_$i" tabindex=|
. ($i + 10 + (($i - 1) * 8)) . qq|>$taxchart</select></td>|;
-# if ($form->{selectprojectnumber}) {
-# $project = qq|
-# <td><select name="projectnumber_$i">$form->{selectprojectnumber}</select></td>|;
-# }
+
+ # if ($form->{selectprojectnumber}) {
+ # $project = qq|
+ # <td><select name="projectnumber_$i">$form->{selectprojectnumber}</select></td>|;
+ # }
$korrektur =
qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=|
. ($i + 9 + (($i - 1) * 8))
}
$form->hide_form(qw(rowcount selectaccno));
-# print qq|
-# <input type=hidden name=selectprojectnumber value="|
-# . $form->escape($form->{selectprojectnumber}, 1) . qq|">|;
+
+ # print qq|
+ # <input type=hidden name=selectprojectnumber value="|
+ # . $form->escape($form->{selectprojectnumber}, 1) . qq|">|;
$lxdebug->leave_sub();
}
<!--
function setTaxkey(accno, row) {
var taxkey = accno.options[accno.selectedIndex].value;
- var reg = /--([0-9])*/;
+ var reg = /--([0-9]*)/;
var found = reg.exec(taxkey);
var index = found[1];
index = parseInt(index);
#write Trigger
$jsscript =
- Form->write_trigger(\%myconfig, "1", "transdate", "BL", "trigger1", "",
- "", "");
+ Form->write_trigger(\%myconfig, "1", "transdate", "BL", "trigger1");
} else {
# without JavaScript Calendar
}
}
- if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
- &menubar;
- }
-
print "
</form>
<form method=post action=$form->{script}>
|;
- map { $form->{$_} =~ s/\"/"/g } qw(reference description chart);
+ map { $form->{$_} =~ s/\"/"/g } qw(reference description chart taxchart);
delete $form->{header};
foreach $key (keys %$form) {
- print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
+ print qq|<input type="hidden" name="$key" value="$form->{$key}">\n|;
}
print qq|
unless (($form->{"debit_$i"} eq "") && ($form->{"credit_$i"} eq "")) {
if ($form->{"debit_$i"} ne "") {
$form->{"credit_$i"} = $form->{"debit_$i"};
- $form->{"debit_$i"} = "";
+ $form->{"debit_$i"} = "";
} elsif ($form->{"credit_$i"} ne "") {
- $form->{"debit_$i"} = $form->{"credit_$i"};
+ $form->{"debit_$i"} = $form->{"credit_$i"};
$form->{"credit_$i"} = "";
}
}
: $form->{"debit_$i"};
$j = $#a;
if (($debitcredit && $credittax) || (!$debitcredit && $debittax)) {
- $form->{"taxchart_$i"} = "0--";
+ $form->{"taxchart_$i"} = "0--0.00";
$form->{"tax_$i"} = 0;
}
if (!$form->{"korrektur_$i"}) {
if ($form->round_amount($debit, 2) != $form->round_amount($credit, 2)) {
$form->error($locale->text('Out of balance transaction!'));
}
+
+ if ($form->round_amount($debit, 2) + $form->round_amount($credit, 2) == 0) {
+ $form->error($locale->text('Empty transaction!'));
+ }
+
if (($errno = GL->post_transaction(\%myconfig, \%$form)) <= -1) {
$errno *= -1;
$err[1] = $locale->text('Cannot have a value in both Debit and Credit!');