package GL;
use Data::Dumper;
+use SL::DBUtils;
sub delete_transaction {
my ($self, $myconfig, $form) = @_;
$posted = 0;
}
+ $project_id = conv_i($form->{"project_id_$i"});
+
# if there is an amount, add the record
if ($amount != 0) {
- $project_id =
- ($form->{"project_id_$i"}) ? $form->{"project_id_$i"} : 'NULL';
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
source, memo, project_id, taxkey)
VALUES
$amount, '$form->{transdate}', |
. $dbh->quote($form->{"source_$i"}) . qq|, |
. $dbh->quote($form->{"memo_$i"}) . qq|,
- $project_id, $taxkey)|;
+ ?, $taxkey)|;
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, $query, $project_id);
}
if ($tax != 0) {
-
# add taxentry
- $amount = $tax;
-
- $project_id =
- ($form->{"project_id_$i"}) ? $form->{"project_id_$i"} : 'NULL';
$query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
- source, memo, project_id, taxkey)
+ source, memo, taxkey)
VALUES
($form->{id}, (SELECT t.chart_id
FROM tax t
WHERE t.id = $form->{"tax_id_$i"}),
- $amount, '$form->{transdate}', |
+ $tax, '$form->{transdate}', |
. $dbh->quote($form->{"source_$i"}) . qq|, |
- . $dbh->quote($form->{"memo_$i"}) . qq|,
- $project_id, $taxkey)|;
+ . $dbh->quote($form->{"memo_$i"}) . qq|, ?, $taxkey)|;
- $dbh->do($query) || $form->dberror($query);
+ do_query($form, $dbh, $query, $project_id);
}
}
use SL::PE;
require "$form->{path}/arap.pl";
+require "bin/mozilla/common.pl";
1;
my $tax = 0;
my $taxaccno = "";
foreach $ref (@{ $form->{GL} }) {
- $form->{"projectnumber_$i"} = "$ref->{projectnumber}--$ref->{project_id}";
-
$j = $i - 1;
if ($tax && ($ref->{accno} eq $taxaccno)) {
$form->{"tax_$j"} = abs($ref->{amount});
sub update {
$lxdebug->enter_sub();
- if ($form->{transdate} ne $form->{oldtransdate}) {
- if ($form->{selectprojectnumber}) {
- $form->all_projects(\%myconfig, undef, $form->{transdate});
- if (@{ $form->{all_project} }) {
- $form->{selectprojectnumber} = "<option>\n";
- for (@{ $form->{all_project} }) {
- $form->{selectprojectnumber} .=
- qq|<option value="$_->{projectnumber}--$_->{id}">$_->{projectnumber}\n|;
- }
- $form->{selectprojectnumber} =
- $form->escape($form->{selectprojectnumber}, 1);
- }
- }
- $form->{oldtransdate} = $form->{transdate};
- }
+ $form->{oldtransdate} = $form->{transdate};
my @a = ();
my $count = 0;
my ($init) = @_;
$lxdebug->enter_sub();
- $form->{selectprojectnumber} = $form->unescape($form->{selectprojectnumber})
- if $form->{selectprojectnumber};
-
$form->{totaldebit} = 0;
$form->{totalcredit} = 0;
my $chart = $form->{chart};
$chart = $form->unquote($chart);
$form->{taxchart} = $form->unquote($form->{taxchart});
$taxchart = $form->{taxchart};
+
+ 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 });
+
+ my %project_labels = ();
+ my @project_values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@project_values, $item->{"id"});
+ $project_labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+
for $i (1 .. $form->{rowcount}) {
$source = qq|
. ($i + 10 + (($i - 1) * 8))
. qq|>$form->{taxchart}</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))
. ($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->{transfer}) {
$checked = ($form->{"fx_transaction_$i"}) ? "1" : "";
$x = ($checked) ? "x" : "";
<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>|;
- # }
$korrektur =
qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=|
. ($i + 9 + (($i - 1) * 8))
}
}
+ my $projectnumber =
+ NTI($cgi->popup_menu('-name' => "project_id_$i",
+ '-values' => \@project_values,
+ '-labels' => \%project_labels,
+ '-default' => $form->{"project_id_$i"} ));
+
print qq|<tr valign=top>
$accno
$fx_transaction
$tax
$source
$memo
+ <td>$projectnumber</td>
</tr>
|;
$form->hide_form(qw(rowcount selectaccno));
- # print qq|
- # <input type=hidden name=selectprojectnumber value="|
- # . $form->escape($form->{selectprojectnumber}, 1) . qq|">|;
$lxdebug->leave_sub();
}
<th class=listheading style="width:20%">|
. $locale->text('Source') . qq|</th>
<th class=listheading style="width:20%">| . $locale->text('Memo') . qq|</th>
- $project
+ <th class=listheading style="width:20%">|
+ . $locale->text('Project Number') . qq|</th>
</tr>
$jsscript
<td></td>
<th align=right class=listtotal> $form->{totaldebit}</th>
<th align=right class=listtotal> $form->{totalcredit}</th>
- <td colspan=5></td>
+ <td colspan=6></td>
</tr>
</table>
</td>
$transdate = $form->datetonum($form->{transdate}, \%myconfig);
$closedto = $form->datetonum($form->{closedto}, \%myconfig);
- # check project
- &check_project;
-
my @a = ();
my $count = 0;
my $debittax = 0;