From: Bernd Bleßmann Date: Fri, 25 Mar 2022 11:28:30 +0000 (+0100) Subject: reverse Charge Upgrade Skript: taxkeys nur bei Germany-DATEV-SKR03EU/04EU X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~88 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=672464a162d6b33533dafa96aa8e405964f92e85;p=kivitendo-erp.git reverse Charge Upgrade Skript: taxkeys nur bei Germany-DATEV-SKR03EU/04EU --- diff --git a/sql/Pg-upgrade2/tax_reverse_charge.sql b/sql/Pg-upgrade2/tax_reverse_charge.sql index fd1e7551d..91ba9c111 100644 --- a/sql/Pg-upgrade2/tax_reverse_charge.sql +++ b/sql/Pg-upgrade2/tax_reverse_charge.sql @@ -101,8 +101,9 @@ WHERE EXISTS ( -- update only for SKR03 -- if not defined insert into taxkeys(chart_id,tax_id,taxkey_id,startdate) SELECT (SELECT chart_id FROM tax WHERE taxkey = '94'),0,0,'1970-01-01' WHERE NOT EXISTS - (SELECT chart_id from taxkeys where chart_id = ( SELECT chart_id FROM tax WHERE taxkey = '94')); + (SELECT chart_id from taxkeys where chart_id = ( SELECT chart_id FROM tax WHERE taxkey = '94')) + AND (EXISTS (SELECT coa FROM defaults WHERE defaults.coa='Germany-DATEV-SKR04EU') OR EXISTS (SELECT coa FROM defaults WHERE defaults.coa='Germany-DATEV-SKR03EU')); insert into taxkeys(chart_id,tax_id,taxkey_id,startdate) SELECT (SELECT reverse_charge_chart_id FROM tax WHERE taxkey = '94'),0,0,'1970-01-01' WHERE NOT EXISTS - (SELECT chart_id from taxkeys where chart_id = ( SELECT reverse_charge_chart_id FROM tax WHERE taxkey = '94')); - + (SELECT chart_id from taxkeys where chart_id = ( SELECT reverse_charge_chart_id FROM tax WHERE taxkey = '94')) + AND (EXISTS (SELECT coa FROM defaults WHERE defaults.coa='Germany-DATEV-SKR04EU') OR EXISTS (SELECT coa FROM defaults WHERE defaults.coa='Germany-DATEV-SKR03EU'));