From 5dd59becc5c8a9adb9457754c0ebe564aa94e029 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 19 Mar 2007 15:09:35 +0000 Subject: [PATCH] =?utf8?q?Einkaufs-=20und=20Verkaufsrechnungen:=20Beim=20E?= =?utf8?q?rstellen=20der=20Eintr=C3=A4ge=20in=20acc=5Ftrans=20keine=20leer?= =?utf8?q?en=20Felder=20f=C3=BCr=20taxkey=20erzeugen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/IR.pm | 53 +++++++++++++++++++++++++++++------------------------ SL/IS.pm | 27 +++++++++++++++------------ 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/SL/IR.pm b/SL/IR.pm index 9ddc48634..5ea2404ed 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -276,9 +276,9 @@ 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, - transdate) + transdate, taxkey) VALUES ($ref->{trans_id}, $ref->{inventory_accno_id}, - $linetotal, '$ref->{transdate}')|; + $linetotal, '$ref->{transdate}', (SELECT taxkey_id FROM chart WHERE id = $ref->{inventory_accno_id}))|; $dbh->do($query) || $form->dberror($query); # add expense @@ -522,22 +522,24 @@ sub post_invoice { if ($form->{amount}{ $form->{id} }{ $form->{AP} } != 0) { $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, - transdate, project_id) + transdate, taxkey, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c - WHERE c.accno = '$form->{AP}'), - $amount, '$form->{"datepaid_$i"}', ?)|; - do_query($form, $dbh, $query, $project_id); + WHERE c.accno = ?), + $amount, '$form->{"datepaid_$i"}', + (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|; + do_query($form, $dbh, $query, $form->{AP}, $form->{AP}, $project_id); } # record payment $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, - source, memo, project_id) + source, memo, taxkey, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c - WHERE c.accno = '$accno'), + WHERE c.accno = ?), $form->{"paid_$i"}, '$form->{"datepaid_$i"}', - '$form->{"source_$i"}', '$form->{"memo_$i"}', ?)|; - do_query($form, $dbh, $query, $project_id); + '$form->{"source_$i"}', '$form->{"memo_$i"}', + (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|; + do_query($form, $dbh, $query, $accno, $accno, $project_id); $exchangerate = 0; @@ -591,10 +593,10 @@ sub post_invoice { ) { $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, - transdate, cleared, fx_transaction, project_id) + transdate, cleared, fx_transaction, taxkey, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c WHERE c.accno = '$accno'), - $form->{fx}{$accno}{$transdate}, '$transdate', '0', '1', ?)|; + $form->{fx}{$accno}{$transdate}, '$transdate', '0', '1', 0, ?)|; do_query($form, $dbh, $query, $project_id); } } @@ -1355,11 +1357,12 @@ sub post_payment { $dbh->do($query) || $form->dberror($query); $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, - transdate, project_id) + transdate, taxkey, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c - WHERE c.accno = '$form->{AP}'), - $amount, '$form->{"datepaid_$i"}', ?)|; - do_query($form, $dbh, $query, $project_id); + WHERE c.accno = ?), + $amount, '$form->{"datepaid_$i"}', + (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|; + do_query($form, $dbh, $query, $form->{AP}, $form->{AP}, $project_id); @@ -1368,12 +1371,13 @@ sub post_payment { $dbh->do($query) || $form->dberror($query); $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, - source, memo, project_id) + source, memo, taxkey, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c - WHERE c.accno = '$accno'), + WHERE c.accno = ?), $form->{"paid_$i"}, '$form->{"datepaid_$i"}', - '$form->{"source_$i"}', '$form->{"memo_$i"}', ?)|; - do_query($form, $dbh, $query, $project_id); + '$form->{"source_$i"}', '$form->{"memo_$i"}', + (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|; + do_query($form, $dbh, $query, $accno, $accno, $project_id); # gain/loss @@ -1411,12 +1415,13 @@ sub post_payment { WHERE c.accno = '$accno') AND amount=$form->{fx}{$accno}{$transdate} AND transdate='$transdate' AND cleared='0' AND fx_transaction='1'|; $dbh->do($query) || $form->dberror($query); $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, - transdate, cleared, fx_transaction, project_id) + transdate, cleared, fx_transaction, taxkey, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c - WHERE c.accno = '$accno'), - $form->{fx}{$accno}{$transdate}, '$transdate', '0', '1', ?)|; - do_query($form, $dbh, $query, $project_id); + WHERE c.accno = ?), + $form->{fx}{$accno}{$transdate}, '$transdate', '0', '1', + (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|; + do_query($form, $dbh, $query, $accno, $accno, $project_id); } } } diff --git a/SL/IS.pm b/SL/IS.pm index 4a151d8f2..cd860ae31 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -920,23 +920,25 @@ sub post_invoice { if ($form->{amount}{ $form->{id} }{ $form->{AR} } != 0) { $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, - transdate, project_id) + transdate, taxkey, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c - WHERE c.accno = '$form->{AR}'), - $amount, '$form->{"datepaid_$i"}', ?)|; - do_query($form, $dbh, $query, $project_id); + WHERE c.accno = ?), + $amount, '$form->{"datepaid_$i"}', + (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|; + do_query($form, $dbh, $query, $form->{AR}, $form->{AR}, $project_id); } # record payment $form->{"paid_$i"} *= -1; $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, - source, memo, project_id) + source, memo, taxkey, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c - WHERE c.accno = '$accno'), + WHERE c.accno = ?), $form->{"paid_$i"}, '$form->{"datepaid_$i"}', - '$form->{"source_$i"}', '$form->{"memo_$i"}', ?)|; - do_query($form, $dbh, $query, $project_id); + '$form->{"source_$i"}', '$form->{"memo_$i"}', + (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|; + do_query($form, $dbh, $query, $accno, $accno, $project_id); # exchangerate difference $form->{fx}{$accno}{ $form->{"datepaid_$i"} } += @@ -976,12 +978,13 @@ sub post_invoice { ) { $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, - transdate, cleared, fx_transaction, project_id) + transdate, cleared, fx_transaction, taxkey, project_id) VALUES ($form->{id}, (SELECT c.id FROM chart c - WHERE c.accno = '$accno'), - $form->{fx}{$accno}{$transdate}, '$transdate', '0', '1', ?)|; - do_query($form, $dbh, $query, $project_id); + WHERE c.accno = ?), + $form->{fx}{$accno}{$transdate}, '$transdate', '0', '1', + (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|; + do_query($form, $dbh, $query, $accno, $accno, $project_id); } } } -- 2.20.1