From 80ec19fe41dfa899593655963628334ab656ae54 Mon Sep 17 00:00:00 2001
From: Moritz Bunkus <m.bunkus@linet-services.de>
Date: Tue, 5 Dec 2006 12:12:20 +0000
Subject: [PATCH] =?utf8?q?Die=20Steuers=C3=A4tze=20richten=20sich=20nach?=
 =?utf8?q?=20dem=20Ertrags-=20bzw.=20dem=20Aufwands-=20und=20nicht=20nach?=
 =?utf8?q?=20dem=20Bestandskonto,=20weil=20beim=20Bestandskonto=20ja=20nic?=
 =?utf8?q?ht=20danach=20unterschieden=20wird,=20woher=20man=20etwas=20bezo?=
 =?utf8?q?gen=20hat.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

---
 SL/IR.pm | 26 ++------------------------
 SL/IS.pm | 18 ++----------------
 SL/OE.pm |  8 +-------
 3 files changed, 5 insertions(+), 47 deletions(-)

diff --git a/SL/IR.pm b/SL/IR.pm
index 702c9f5e9..025c65f2e 100644
--- a/SL/IR.pm
+++ b/SL/IR.pm
@@ -925,21 +925,9 @@ sub retrieve_invoice {
         $stw->finish;
       }
 
-
-
-      #set expense_accno=inventory_accno if they are different => bilanz
-      $vendor_accno =
-        ($ref->{expense_accno} != $ref->{inventory_accno})
-        ? $ref->{inventory_accno}
-        : $ref->{expense_accno};
-      $vendor_accno =
-        ($ref->{inventory_accno})
-        ? $ref->{inventory_accno}
-        : $ref->{expense_accno};
-
       # get tax rates and description
       $accno_id =
-        ($form->{vc} eq "customer") ? $ref->{income_accno} : $vendor_accno;
+        ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno};
       $query = qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
 	         FROM tax t LEFT join chart c ON (c.id=t.chart_id)
 	         WHERE t.taxkey in (SELECT taxkey_id from chart where accno = '$accno_id')
@@ -1190,19 +1178,9 @@ sub retrieve_item {
     }
     delete($ref->{inventory_accno_id});
 
-    #set expense_accno=inventory_accno if they are different => bilanz
-    $vendor_accno =
-      ($ref->{expense_accno} != $ref->{inventory_accno})
-      ? $ref->{inventory_accno}
-      : $ref->{expense_accno};
-    $vendor_accno =
-      ($ref->{inventory_accno})
-      ? $ref->{inventory_accno}
-      : $ref->{expense_accno};
-
     # get tax rates and description
     $accno_id =
-      ($form->{vc} eq "customer") ? $ref->{income_accno} : $vendor_accno;
+      ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno};
     $query = qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
 	      FROM tax t LEFT JOIN chart c ON (c.id=t.chart_id)
 	      WHERE t.taxkey in (SELECT taxkey_id from chart where accno = '$accno_id')
diff --git a/SL/IS.pm b/SL/IS.pm
index 67a1fe5e2..f9b95ec8b 100644
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -1570,9 +1570,6 @@ sub retrieve_invoice {
       }
       delete($ref->{"part_inventory_accno_id"});
 
-      #set expense_accno=inventory_accno if they are different => bilanz
-
-
     while ($ref->{inventory_new_chart} && ($ref->{inventory_valid} >=0)) {
       my $query = qq| SELECT accno AS inventory_accno, new_chart_id AS inventory_new_chart, date($transdate) - valid_from AS inventory_valid FROM chart WHERE id = $ref->{inventory_new_chart}|;
       my $stw = $dbh->prepare($query);
@@ -1597,14 +1594,9 @@ sub retrieve_invoice {
       $stw->finish;
     }
 
-      $vendor_accno =
-        ($ref->{expense_accno} != $ref->{inventory_accno})
-        ? $ref->{inventory_accno}
-        : $ref->{expense_accno};
-
       # get tax rates and description
       $accno_id =
-        ($form->{vc} eq "customer") ? $ref->{income_accno} : $vendor_accno;
+        ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno};
       $query = qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
 	         FROM tax t LEFT join chart c ON (c.id=t.chart_id)
 	         WHERE t.taxkey in (SELECT taxkey_id from chart where accno = '$accno_id')
@@ -1961,15 +1953,9 @@ sub retrieve_item {
       }
     }
 
-
-    $vendor_accno =
-      ($ref->{expense_accno} != $ref->{inventory_accno})
-      ? $ref->{inventory_accno}
-      : $ref->{expense_accno};
-
     # get tax rates and description
     $accno_id =
-      ($form->{vc} eq "customer") ? $ref->{income_accno} : $vendor_accno;
+      ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno};
     $query = qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
 	      FROM tax t LEFT JOIN chart c on (c.id=t.chart_id)
 	      WHERE t.taxkey in (SELECT c2.taxkey_id from chart c2 where c2.accno = '$accno_id')
diff --git a/SL/OE.pm b/SL/OE.pm
index 888f422be..18e48bdd6 100644
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -869,15 +869,9 @@ sub retrieve {
       # delete orderitems_id in collective orders, so that they get cloned no matter what
       delete $ref->{orderitems_id} if (@ids);
 
-      #set expense_accno=inventory_accno if they are different => bilanz
-      $vendor_accno =
-        ($ref->{expense_accno} != $ref->{inventory_accno})
-        ? $ref->{inventory_accno}
-        : $ref->{expense_accno};
-
       # get tax rates and description
       $accno_id =
-        ($form->{vc} eq "customer") ? $ref->{income_accno} : $vendor_accno;
+        ($form->{vc} eq "customer") ? $ref->{income_accno} : $ref->{expense_accno};
       $query = qq|SELECT c.accno, t.taxdescription, t.rate, t.taxnumber
 	         FROM tax t LEFT JOIN chart c ON (c.id=t.chart_id)
 	         WHERE t.taxkey in (SELECT taxkey_id from chart where accno = '$accno_id')
-- 
2.20.1