From 311a645bc3b3a74052c7c0565afaad77961102a8 Mon Sep 17 00:00:00 2001 From: Udo Spallek Date: Tue, 20 Jun 2006 11:06:10 +0000 Subject: [PATCH] Solved Bug 365: Falsche UStVA bei negativem Vorsteuer-Betrag (Teil 2) --- SL/USTVA.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 -- 2.20.1