X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/d319704a66e9be64da837ccea10af6774c2b0838..a5f55e6fe23ee776e90567d3e5ee6cdf116c3f9c:/SL/IR.pm diff --git a/SL/IR.pm b/SL/IR.pm index a02f4fbd9..5c243a468 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -235,17 +235,17 @@ sub post_invoice { # add entry for inventory, this one is for the sold item if ($linetotal != 0) { - $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, + $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate) VALUES ($ref->{trans_id}, $ref->{inventory_accno_id}, $linetotal, '$ref->{transdate}')|; $dbh->do($query) || $form->dberror($query); # add expense - $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, + $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey) VALUES ($ref->{trans_id}, $ref->{expense_accno_id}, - | . ($linetotal * -1) . qq|, '$ref->{transdate}', + | . ($linetotal * -1) . qq|, '$ref->{transdate}', (SELECT taxkey from tax WHERE chart_id = $ref->{expense_accno_id}))|; $dbh->do($query) || $form->dberror($query); } @@ -337,7 +337,6 @@ sub post_invoice { if ($form->{"projectnumber_$i"}) { $project_id = $form->{"projectnumber_$i"}; } - print(STDERR $project_id, " Project_id\n"); $deliverydate = ($form->{"deliverydate_$i"}) ? qq|'$form->{"deliverydate_$i"}'| @@ -353,7 +352,6 @@ sub post_invoice { '$form->{"unit_$i"}', $deliverydate, (SELECT id FROM project WHERE projectnumber = '$project_id'), '$form->{"serialnumber_$i"}')|; $dbh->do($query) || $form->dberror($query); - print(STDERR $query, "\n\n"); } } @@ -443,7 +441,7 @@ sub post_invoice { $form->round_amount($form->{amount}{$trans_id}{$accno}, 2) ) != 0 ) { - $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, + $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, taxkey) VALUES ($trans_id, (SELECT c.id FROM chart c WHERE c.accno = '$accno'), @@ -1135,8 +1133,6 @@ sub vendor_details { $contact = "and cp.cp_id = $form->{cp_id}"; } - $taxincluded = $form->{taxincluded}; - # get rest for the vendor # fax and phone and email as vendor* my $query = @@ -1148,9 +1144,10 @@ sub vendor_details { $sth->execute || $form->dberror($query); $ref = $sth->fetchrow_hashref(NAME_lc); - map { $form->{$_} = $ref->{$_} } keys %$ref; - $form->{taxincluded} = $taxincluded; + # remove id and taxincluded before copy back + delete @$ref{qw(id taxincluded)}; + map { $form->{$_} = $ref->{$_} } keys %$ref; $sth->finish; $dbh->disconnect; @@ -1220,4 +1217,3 @@ SWITCH: { } 1; -