From 30b4a78c4100ebdcd6e6917fbcbf1d12f4f7b4d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Wed, 16 Mar 2022 08:07:19 +0100 Subject: [PATCH] =?utf8?q?Steuerschl=C3=BCssel=2018=20und=2019=20mit=20rev?= =?utf8?q?erse=5Fcharge=20Funktion=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- sql/Pg-upgrade2/tax_reverse_charge_key_18.sql | 48 ++++++++++++++ sql/Pg-upgrade2/tax_reverse_charge_key_19.sql | 63 +++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 sql/Pg-upgrade2/tax_reverse_charge_key_18.sql create mode 100644 sql/Pg-upgrade2/tax_reverse_charge_key_19.sql diff --git a/sql/Pg-upgrade2/tax_reverse_charge_key_18.sql b/sql/Pg-upgrade2/tax_reverse_charge_key_18.sql new file mode 100644 index 000000000..024e7c48d --- /dev/null +++ b/sql/Pg-upgrade2/tax_reverse_charge_key_18.sql @@ -0,0 +1,48 @@ +-- @tag: tax_reverse_charge_key_18 +-- @description: Reverse Charge für Kreditorenbelege Steuerschlüssel 18 +-- @depends: release_3_6_0 +-- @ignore: 0 + +INSERT INTO tax ( + chart_id, + reverse_charge_chart_id, + rate, + taxkey, + taxdescription, + chart_categories + ) + SELECT + (SELECT id FROM chart WHERE accno = '1572'), + (SELECT id FROM chart WHERE accno = '1772'), 0.07, + '18', 'Stpf. innergemeinschaftlicher Erwerb zum verminderten Vor- und Ust.-satz', 'EI' +WHERE EXISTS ( -- update only for SKR03 + SELECT coa FROM defaults + WHERE defaults.coa='Germany-DATEV-SKR03EU' +); + + +INSERT INTO tax ( + chart_id, + reverse_charge_chart_id, + rate, + taxkey, + taxdescription, + chart_categories + ) + SELECT + (SELECT id FROM chart WHERE accno = '1402'), + (SELECT id FROM chart WHERE accno = '3802'), 0.07, + '18', 'Stpf. innergemeinschaftlicher Erwerb zum verminderten Vor- und Ust.-satz', 'EI' +WHERE EXISTS ( -- update only for SKR04 + SELECT coa FROM defaults + WHERE defaults.coa='Germany-DATEV-SKR04EU' +); + + +-- if not defined +insert into taxkeys(chart_id,tax_id,taxkey_id,startdate) SELECT (SELECT reverse_charge_chart_id FROM tax WHERE taxkey = '18' and rate = 0.07 and reverse_charge_chart_id is not null),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 = '18' and rate = 0.07 and reverse_charge_chart_id is not null)); +-- if not defined +insert into taxkeys(chart_id,tax_id,taxkey_id,startdate) SELECT (SELECT chart_id FROM tax WHERE taxkey = '18' and rate = 0.07 and reverse_charge_chart_id is not null),0,0,'1970-01-01' WHERE NOT EXISTS + (SELECT chart_id from taxkeys where chart_id = ( SELECT chart_id FROM tax WHERE taxkey = '18' and rate = 0.07 and reverse_charge_chart_id is not null)); + diff --git a/sql/Pg-upgrade2/tax_reverse_charge_key_19.sql b/sql/Pg-upgrade2/tax_reverse_charge_key_19.sql new file mode 100644 index 000000000..33d65048c --- /dev/null +++ b/sql/Pg-upgrade2/tax_reverse_charge_key_19.sql @@ -0,0 +1,63 @@ +-- @tag: tax_reverse_charge_key_19 +-- @description: Reverse Charge für Kreditorenbelege Steuerschlüssel 19 +-- @depends: release_3_6_0 +-- @ignore: 0 + +UPDATE tax set rate=0.19 where taxkey=94 AND reverse_charge_chart_id is not NULL; + +INSERT INTO chart ( + accno, description, + charttype, category, link, + taxkey_id + ) +SELECT + '1774','Umsatzsteuer aus innergemeinschftl. Erwerb 19%', + 'A', 'I', 'AR_tax:IC_taxpart:IC_taxservice', + 0 +WHERE EXISTS ( -- update only for SKR03 + SELECT coa FROM defaults + WHERE defaults.coa='Germany-DATEV-SKR03EU' AND NOT EXISTS (SELECT id from chart where accno='1774') +); + +INSERT INTO tax ( + chart_id, + reverse_charge_chart_id, + rate, + taxkey, + taxdescription, + chart_categories + ) + SELECT + (SELECT id FROM chart WHERE accno = '1574'), + (SELECT id FROM chart WHERE accno = '1774'), 0.19, + '19', 'Stpf. innergemeinschaftlicher Erwerb zum vollem Vor- und Ust.-satz', 'EI' +WHERE EXISTS ( -- update only for SKR03 + SELECT coa FROM defaults + WHERE defaults.coa='Germany-DATEV-SKR03EU' +); + + +INSERT INTO tax ( + chart_id, + reverse_charge_chart_id, + rate, + taxkey, + taxdescription, + chart_categories + ) + SELECT + (SELECT id FROM chart WHERE accno = '1404'), + (SELECT id FROM chart WHERE accno = '3804'), 0.19, + '19', 'Stpf. innergemeinschaftlicher Erwerb zum vollem Vor- und Ust.-satz', 'EI' +WHERE EXISTS ( -- update only for SKR04 + SELECT coa FROM defaults + WHERE defaults.coa='Germany-DATEV-SKR04EU' +); + +-- if not defined +insert into taxkeys(chart_id,tax_id,taxkey_id,startdate) SELECT (SELECT reverse_charge_chart_id FROM tax WHERE taxkey = '19' and rate = 0.19 and reverse_charge_chart_id is not null),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 = '19' and rate = 0.19 and reverse_charge_chart_id is not null)); +-- if not defined +insert into taxkeys(chart_id,tax_id,taxkey_id,startdate) SELECT (SELECT chart_id FROM tax WHERE taxkey = '19' and rate = 0.19 and reverse_charge_chart_id is not null),0,0,'1970-01-01' WHERE NOT EXISTS + (SELECT chart_id from taxkeys where chart_id = ( SELECT chart_id FROM tax WHERE taxkey = '19' and rate = 0.19 and reverse_charge_chart_id is not null)); + -- 2.20.1