Revert "Fehler beim Schreiben von tax_id"
authorSven Schöling <s.schoeling@linet-services.de>
Fri, 11 Jan 2013 12:40:24 +0000 (13:40 +0100)
committerSven Schöling <s.schoeling@linet-services.de>
Fri, 11 Jan 2013 12:40:24 +0000 (13:40 +0100)
This reverts commit 94915eda8e84805b5745b81fefc67be9ecde55f8.

SL/AP.pm

index 9e3888c..804c9b4 100644 (file)
--- a/SL/AP.pm
+++ b/SL/AP.pm
@@ -211,10 +211,10 @@ sub post_transaction {
           qq|INSERT INTO acc_trans | .
           qq|  (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id)| .
           qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), | .
-          qq|  ?, ?, ?, ?, ?)|;
+          qq|  ?, ?, ?, ?, (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id  FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|;
         @values = ($form->{id}, $form->{AP_amounts}{"amount_$i"},
                    $form->{"amount_$i"}, conv_date($form->{transdate}),
-                   $project_id, $form->{"taxkey_$i"}, conv_i($form->{"tax_id_$i"}));
+                   $project_id, $form->{"taxkey_$i"}, $form->{AP_amounts}{"amount_$i"}, conv_date($form->{transdate}));
         do_query($form, $dbh, $query, @values);
 
         if ($form->{"tax_$i"} != 0) {
@@ -223,10 +223,10 @@ sub post_transaction {
             qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, | .
             qq|  project_id, taxkey, tax_id) | .
             qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), | .
-            qq|  ?, ?, ?, ?, ?)|;
+            qq|  ?, ?, ?, ?, (SELECT tax_id FROM taxkeys WHERE taxkey_id= (SELECT taxkey_id  FROM chart WHERE accno = ?) AND startdate <= ? ORDER BY startdate DESC LIMIT 1))|;
           @values = ($form->{id}, $form->{AP_amounts}{"tax_$i"},
                      $form->{"tax_$i"}, conv_date($form->{transdate}),
-                     $project_id, $form->{"taxkey_$i"}, conv_i($form->{"tax_id_$i"}));
+                     $project_id, $form->{"taxkey_$i"}, $form->{AP_amounts}{"tax_$i"}, conv_date($form->{transdate}));
           do_query($form, $dbh, $query, @values);
         }