Beim Buchen von Kreditoren- und Debitorenbuchungen immer die richtigen Steuerschlüsse...
authorMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 8 Jan 2009 10:29:04 +0000 (10:29 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 8 Jan 2009 10:29:04 +0000 (10:29 +0000)
SL/AP.pm
SL/AR.pm

index 1b7c1d8..5143245 100644 (file)
--- a/SL/AP.pm
+++ b/SL/AP.pm
@@ -96,10 +96,7 @@ sub post_transaction {
       qq|ORDER BY c.accno|;
     $sth = $dbh->prepare($query);
     $sth->execute($form->{"tax_id_$i"}) || $form->dberror($query . " (" . $form->{"tax_id_$i"} . ")");
-    ($form->{AP_amounts}{"tax_$i"}, $form->{"taxkey_$i"}, $form->{"taxrate_$i"}) =
-      $sth->fetchrow_array;
-    $form->{AP_amounts}{"tax_$i"}{taxkey}    = $form->{"taxkey_$i"};
-    $form->{AP_amounts}{"amount_$i"}{taxkey} = $form->{"taxkey_$i"};
+    ($form->{AP_amounts}{"tax_$i"}, $form->{"taxkey_$i"}, $form->{"taxrate_$i"}) = $sth->fetchrow_array();
 
     $sth->finish;
     if ($form->{taxincluded} *= 1) {
@@ -212,7 +209,6 @@ sub post_transaction {
       if ($form->{"amount_$i"} != 0) {
         my $project_id;
         $project_id = conv_i($form->{"project_id_$i"});
-        $taxkey = $form->{AP_amounts}{"amount_$i"}{taxkey};
 
         # insert detail records in acc_trans
         $query =
@@ -222,7 +218,7 @@ sub post_transaction {
           qq|  ?, ?, ?, ?)|;
         @values = ($form->{id}, $form->{AP_amounts}{"amount_$i"},
                    $form->{"amount_$i"}, conv_date($form->{transdate}),
-                   $project_id, $taxkey);
+                   $project_id, $form->{"taxkey_$i"});
         do_query($form, $dbh, $query, @values);
 
         if ($form->{"tax_$i"} != 0) {
@@ -234,7 +230,7 @@ sub post_transaction {
             qq|  ?, ?, ?, ?)|;
           @values = ($form->{id}, $form->{AP_amounts}{"tax_$i"},
                      $form->{"tax_$i"}, conv_date($form->{transdate}),
-                     $project_id, $taxkey);
+                     $project_id, $form->{"taxkey_$i"});
           do_query($form, $dbh, $query, @values);
         }
 
index c7965f8..14fa809 100644 (file)
--- a/SL/AR.pm
+++ b/SL/AR.pm
@@ -86,9 +86,6 @@ sub post_transaction {
     $query = qq|SELECT c.accno, t.taxkey, t.rate FROM tax t LEFT JOIN chart c ON (c.id = t.chart_id) WHERE t.id = ? ORDER BY c.accno|;
     ($form->{AR_amounts}{"tax_$i"}, $form->{"taxkey_$i"}, $form->{"taxrate_$i"}) = selectrow_query($form, $dbh, $query, $form->{"tax_id_$i"});
 
-    $form->{AR_amounts}{"tax_$i"}{taxkey}     = $form->{"taxkey_$i"};
-    $form->{AR_amounts}{"amounts_$i"}{taxkey} = $form->{"taxkey_$i"};
-
     if ($form->{taxincluded} *= 1) {
       $tax = $form->{"korrektur_$i"}
         ? $form->{"tax_$i"}
@@ -172,19 +169,20 @@ sub post_transaction {
     for $i (1 .. $form->{rowcount}) {
       if ($form->{"amount_$i"} != 0) {
         my $project_id = conv_i($form->{"project_id_$i"});
-        $taxkey = $form->{AR_amounts}{"amounts_$i"}{taxkey};
 
         # insert detail records in acc_trans
         $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey)
                      VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?)|;
-        @values = (conv_i($form->{id}), conv_i($form->{AR_amounts}{"amount_$i"}), conv_i($form->{"amount_$i"}), conv_date($form->{transdate}), $project_id, conv_i($taxkey));
+        @values = (conv_i($form->{id}), conv_i($form->{AR_amounts}{"amount_$i"}), conv_i($form->{"amount_$i"}), conv_date($form->{transdate}), $project_id,
+                   conv_i($form->{"taxkey_$i"}));
         do_query($form, $dbh, $query, @values);
 
         if ($form->{"tax_$i"} != 0) {
           # insert detail records in acc_trans
           $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey)
                        VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?)|;
-          @values = (conv_i($form->{id}), conv_i($form->{AR_amounts}{"tax_$i"}), conv_i($form->{"tax_$i"}), conv_date($form->{transdate}), $project_id, conv_i($taxkey));
+          @values = (conv_i($form->{id}), conv_i($form->{AR_amounts}{"tax_$i"}), conv_i($form->{"tax_$i"}), conv_date($form->{transdate}), $project_id,
+                     conv_i($form->{"taxkey_$i"}));
           do_query($form, $dbh, $query, @values);
         }
       }