From: Udo Spallek Date: Tue, 20 Jun 2006 11:06:10 +0000 (+0000) Subject: Solved Bug 365: Falsche UStVA bei negativem Vorsteuer-Betrag (Teil 2) X-Git-Tag: release-2.4.0^2~268 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=311a645bc3b3a74052c7c0565afaad77961102a8;p=kivitendo-erp.git Solved Bug 365: Falsche UStVA bei negativem Vorsteuer-Betrag (Teil 2) --- diff --git a/SL/USTVA.pm b/SL/USTVA.pm index f1bd2a034..3cb7ff816 100644 --- a/SL/USTVA.pm +++ b/SL/USTVA.pm @@ -724,14 +724,17 @@ sub get_accounts_ustva { UNION - SELECT sum(ac.amount) AS amount, + SELECT sum( + CASE WHEN c.link LIKE '%AR%' THEN ac.amount * -1 + WHEN c.link LIKE '%AP%' THEN ac.amount * 1 + END + ) AS amount, c.$category FROM acc_trans ac JOIN chart c ON (c.id = ac.chart_id) JOIN gl a ON (a.id = ac.trans_id) $dpt_join WHERE $where - $glwhere $dpt_from AND NOT (c.link = 'AR' OR c.link = 'AP') $project