From e1b0bda5b93e17bc5c06a6fecde41f537cb20c99 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Mon, 21 Sep 2020 10:41:10 +0200 Subject: [PATCH] USTVA: Fall IST-Versteuerung aggregat an der richtigen Stellen MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit und nicht im Subselect für die Abfrage bezahlter Beleg oder nicht. --- SL/USTVA.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/SL/USTVA.pm b/SL/USTVA.pm index 22d12cecf..122a17a16 100644 --- a/SL/USTVA.pm +++ b/SL/USTVA.pm @@ -691,7 +691,7 @@ sub get_accounts_ustva { SUM( ac.amount * -- Bezahlt / Rechnungssumme ( - SELECT SUM(acc.amount), t.rate, c.accno + SELECT SUM(acc.amount) FROM acc_trans acc INNER JOIN chart c ON (acc.chart_id = c.id AND c.link like '%AR_paid%') @@ -699,13 +699,12 @@ sub get_accounts_ustva { 1=1 $ARwhere AND acc.trans_id = ac.trans_id - ) - / + ) / ( SELECT amount FROM ar WHERE id = ac.trans_id ) ) AS amount, - tk.pos_ustva + tk.pos_ustva, t.rate, c.accno FROM acc_trans ac LEFT JOIN chart c ON (c.id = ac.chart_id) LEFT JOIN ar ON (ar.id = ac.trans_id) -- 2.20.1