$form->{totaldebit} = 0;
$form->{totalcredit} = 0;
- my @old_project_ids = ();
- map({ push(@old_project_ids, $form->{"project_id_$_"})
- if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
-
- $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
- "all" => 0,
- "old_id" => \@old_project_ids },
- "charts" => { "key" => "ALL_CHARTS",
- "transdate" => $form->{transdate} },
- "taxcharts" => "ALL_TAXCHARTS");
-
my %project_labels = ();
my @project_values = ("");
foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
my $taxchart_init;
foreach my $item (@{ $form->{ALL_CHARTS} }) {
my $key = $item->{accno} . "--" . $item->{tax_id};
- $taxchart_init = $item->{taxkey_id} unless (@chart_values);
+ $taxchart_init = $item->{tax_id} unless (@chart_values);
push(@chart_values, $key);
$chart_labels{$key} = $item->{accno} . "--" . $item->{description};
$charts{$item->{accno}} = $item;
my %taxcharts = ();
foreach my $item (@{ $form->{ALL_TAXCHARTS} }) {
my $key = $item->{id} . "--" . $item->{rate};
- $taxchart_init = $key if ($taxchart_init eq $item->{taxkey});
+ $taxchart_init = $key if ($taxchart_init == $item->{id});
push(@taxchart_values, $key);
$taxchart_labels{$key} = $item->{taxdescription} . " " . $item->{rate} * 100 . ' %';
$taxcharts{$item->{id}} = $item;
}
for $i (1 .. $form->{rowcount}) {
-
if ($form->{show_details}) {
$source = qq|
<td><input name="source_$i" value="$form->{"source_$i"}" size="16"></td>|;
$selected_taxchart = "$item->{id}--$item->{rate}";
}
- $selected_accno = '' if ($init);
- $selected_taxchart = $taxchart_init unless ($selected_taxchart ne "");
+ $selected_accno = '' if ($init);
+ $selected_taxchart ||= $taxchart_init;
$accno = qq|<td>| .
NTI($cgi->popup_menu('-name' => "accno_$i",
'-id' => "accno_$i",
- '-onChange' => "setTaxkey(this, $i)",
+ '-onChange' => "setTaxkey($i)",
'-style' => 'width:200px',
'-values' => \@chart_values,
'-labels' => \%chart_labels,
print qq|<tr valign=top>
$accno
+ <td id="chart_balance_$i" align="right"> </td>
$fx_transaction
<td><input name="debit_$i" size="8" value="$form->{"debit_$i"}" accesskey=$i $copy2credit $debitreadonly></td>
<td><input name="credit_$i" size=8 value="$form->{"credit_$i"}" $creditreadonly></td>
$auth->assert('general_ledger');
+ my @old_project_ids = ();
+ map({ push(@old_project_ids, $form->{"project_id_$_"})
+ if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
+
+ $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
+ "all" => 0,
+ "old_id" => \@old_project_ids },
+ "charts" => { "key" => "ALL_CHARTS",
+ "transdate" => $form->{transdate} },
+ "taxcharts" => "ALL_TAXCHARTS");
+
+ GL->get_chart_balances('charts' => $form->{ALL_CHARTS});
+
$title = $form->{title};
$form->{title} = $locale->text("$title General Ledger Transaction");
$readonly = ($form->{id}) ? "readonly" : "";
$form->{javascript} = qq|<script type="text/javascript">
<!--
- function setTaxkey(accno, row) {
+ function setTaxkey(row) {
+ var accno = document.getElementById('accno_' + row);
var taxkey = accno.options[accno.selectedIndex].value;
var reg = /--([0-9]*)/;
var found = reg.exec(taxkey);
var txt = document.getElementsByName('debit_1')[0].value;
document.getElementsByName('credit_2')[0].value = txt;
};
-
//-->
- </script>|;
- $form->{javascript} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
+ </script>
+ <script type="text/javascript" src="js/show_form_details.js"></script>
+ <script type="text/javascript" src="js/jquery.js"></script>
+|;
$form->{selectdepartment} =~ s/ selected//;
$form->{selectdepartment} =~
$form->{previous_id} ||= "--";
$form->{previous_gldate} ||= "--";
+ $jsscript .= $form->parse_html_template('gl/form_header_chart_balances_js');
+
$form->header;
print qq|
<tr class=listheading>
<th class=listheading style="width:15%">|
. $locale->text('Account') . qq|</th>
+ <th class=listheading style="width:10%">| . $locale->text('Chart balance') . qq|</th>
<th class=listheading style="width:10%">|
. $locale->text('Debit') . qq|</th>
<th class=listheading style="width:10%">|
print qq|
<tr class=listtotal>
- <td></td>
- <th align=right class=listtotal> $form->{totaldebit}</th>
+ <th colspan="3" align=right class=listtotal> $form->{totaldebit}</th>
<th align=right class=listtotal> $form->{totalcredit}</th>
<td colspan=6></td>
</tr>
. qq|"> |;
} else {
- print qq|
+ print qq|
<input class=submit type=submit name=action id=update_button value="| . $locale->text('Update') . qq|">
<input class=submit type=submit name=action value="| . $locale->text('Post') . qq|">|;
}