X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=sql%2FPg-upgrade2%2Fkonjunkturpaket_2020.sql;h=50a014c8918939c9d186ecfd10ab2b0bab943303;hb=622319e0a67971ef076bd39dca18622907aca055;hp=71a7421ec3238fea04e1fd25bf3920aaf62241c5;hpb=9a14696176033f03c97244f420d93f9c15efed61;p=kivitendo-erp.git diff --git a/sql/Pg-upgrade2/konjunkturpaket_2020.sql b/sql/Pg-upgrade2/konjunkturpaket_2020.sql index 71a7421ec..50a014c89 100644 --- a/sql/Pg-upgrade2/konjunkturpaket_2020.sql +++ b/sql/Pg-upgrade2/konjunkturpaket_2020.sql @@ -49,14 +49,14 @@ IF ( select coa from defaults ) ~ 'DATEV' THEN -- (13, 0.19, 0.16, null, null); -create temp table temp_taxkey_conversions (taxkey int, old_rate numeric, old_chart text, new_rate numeric, new_chart text); - -IF ( select coa from defaults ) = 'Germany-DATEV-SKR03EU' THEN - insert into temp_taxkey_conversions (taxkey, old_rate, old_chart, new_rate, new_chart) - values (9, 0.19, '1576', 0.16, '1575'), - (8, 0.07, '1571', 0.05, '1568'), - (3, 0.19, '1776', 0.16, '1575'), - (2, 0.07, '1771', 0.05, '1775'); + create temp table temp_taxkey_conversions (taxkey int, old_rate numeric, old_chart text, new_rate numeric, new_chart text); + + IF ( select coa from defaults ) = 'Germany-DATEV-SKR03EU' THEN + insert into temp_taxkey_conversions (taxkey, old_rate, old_chart, new_rate, new_chart) + values (9, 0.19, '1576', 0.16, '1575'), + (8, 0.07, '1571', 0.05, '1568'), + (3, 0.19, '1776', 0.16, '1575'), + (2, 0.07, '1771', 0.05, '1775'); --1776 => 19% --1775 => 16% --1775 => 5% @@ -164,7 +164,7 @@ IF ( select coa from defaults ) = 'Germany-DATEV-SKR03EU' THEN END IF; -- RAISE NOTICE 'current_taxkey.rate = %, desired rate = %, looking for taxkey_id %', current_taxkey.rate, _rate, _taxkey_ids[1]; - -- if a chart was created way after 2007 and only ever configured for + -- if a chart was created way after 2007 and only ever configured for -- 19%, never 16%, which is the case for SKR04 and taxkey 13, there will only be 3 -- taxkeys per chart after adding the two new ones @@ -199,11 +199,12 @@ IF ( select coa from defaults ) = 'Germany-DATEV-SKR03EU' THEN -- RAISE NOTICE 'inserted 2 taxkeys for chart % with taxkey %', (select accno from chart where id = current_taxkey.chart_id), current_taxkey.taxkey_id; END LOOP; -- -END IF; -- DATEV coa -END $$; + drop table temp_taxkey_conversions; -drop table temp_taxkey_conversions; +END IF; + +END $$; -- select * from taxkeys where startdate >= '2020-01-01'; -- rollback;