Probleme bei Mwst-Wechsel
[kivitendo-erp.git] / SL / GL.pm
index 80c5fda..3154063 100644 (file)
--- a/SL/GL.pm
+++ b/SL/GL.pm
@@ -664,26 +664,12 @@ sub transaction {
            (SELECT c1.accno
             FROM chart c1, tax t1
             WHERE (t1.id = t.id) AND (c1.id = t.chart_id)) AS taxaccno,
-           (SELECT tk.tax_id
-            FROM taxkeys tk
-            WHERE (tk.chart_id = a.chart_id) AND (tk.startdate <= a.transdate)
-            ORDER BY tk.startdate desc LIMIT 1) AS tax_id
+            a.tax_id AS tax_id
          FROM acc_trans a
          JOIN chart c ON (c.id = a.chart_id)
          LEFT JOIN project p ON (p.id = a.project_id)
          LEFT JOIN tax t ON
-           (t.id =
-             (SELECT tk.tax_id
-              FROM taxkeys tk
-              WHERE (tk.taxkey_id = a.taxkey) AND
-                ((CASE WHEN a.chart_id IN
-                    (SELECT chart_id FROM taxkeys WHERE taxkey_id = a.taxkey)
-                  THEN tk.chart_id = a.chart_id
-                  ELSE 1 = 1
-                  END)
-                 OR (c.link LIKE '%tax%'))
-                AND (startdate <= a.transdate)
-              ORDER BY startdate DESC LIMIT 1))
+           (t.id = a.tax_id)
          WHERE (a.trans_id = ?)
            AND (a.fx_transaction = '0')
          ORDER BY a.acc_trans_id, a.transdate|;