|
1 |
-- @tag: tax_reverse_charge
|
|
2 |
-- @description: Reverse Charge für Kreditorenbelege
|
|
3 |
-- @depends: release_3_6_0
|
|
4 |
-- @ignore: 1
|
|
5 |
|
|
6 |
ALTER TABLE tax add column reverse_charge_chart_id integer;
|
|
7 |
|
|
8 |
INSERT INTO chart (
|
|
9 |
accno, description,
|
|
10 |
charttype, category, link,
|
|
11 |
taxkey_id
|
|
12 |
)
|
|
13 |
SELECT
|
|
14 |
'1577','Abziehbare Vorst. nach §13b UstG 19%',
|
|
15 |
'A', 'E', 'AP_tax:IC_taxpart:IC_taxservice',
|
|
16 |
0
|
|
17 |
WHERE EXISTS ( -- update only for SKR03
|
|
18 |
SELECT coa FROM defaults
|
|
19 |
WHERE defaults.coa='Germany-DATEV-SKR03EU' AND NOT EXISTS (SELECT id from chart where accno='1577')
|
|
20 |
);
|
|
21 |
|
|
22 |
INSERT INTO chart (
|
|
23 |
accno, description,
|
|
24 |
charttype, category, link,
|
|
25 |
taxkey_id
|
|
26 |
)
|
|
27 |
SELECT
|
|
28 |
'1787','Umsatzsteuer nach §13b UStG 19%',
|
|
29 |
'A', 'I', 'AR_tax:IC_taxpart:IC_taxservice',
|
|
30 |
0
|
|
31 |
WHERE EXISTS ( -- update only for SKR03
|
|
32 |
SELECT coa FROM defaults
|
|
33 |
WHERE defaults.coa='Germany-DATEV-SKR03EU' AND NOT EXISTS (SELECT id from chart where accno='1787')
|
|
34 |
);
|
|
35 |
|
|
36 |
|
|
37 |
INSERT INTO chart (
|
|
38 |
accno, description,
|
|
39 |
charttype, category, link,
|
|
40 |
taxkey_id
|
|
41 |
)
|
|
42 |
SELECT
|
|
43 |
'1407','Abziehbare Vorst. nach §13b UstG 19%',
|
|
44 |
'A', 'E', 'AP_tax:IC_taxpart:IC_taxservice',
|
|
45 |
0
|
|
46 |
WHERE EXISTS ( -- update only for SKR04
|
|
47 |
SELECT coa FROM defaults
|
|
48 |
WHERE defaults.coa='Germany-DATEV-SKR04EU' AND NOT EXISTS (SELECT id from chart where accno='1407')
|
|
49 |
);
|
|
50 |
|
|
51 |
INSERT INTO chart (
|
|
52 |
accno, description,
|
|
53 |
charttype, category, link,
|
|
54 |
taxkey_id
|
|
55 |
)
|
|
56 |
SELECT
|
|
57 |
'3837','Umsatzsteuer nach §13b UStG 19%',
|
|
58 |
'A', 'I', 'AR_tax:IC_taxpart:IC_taxservice',
|
|
59 |
0
|
|
60 |
WHERE EXISTS ( -- update only for SKR04
|
|
61 |
SELECT coa FROM defaults
|
|
62 |
WHERE defaults.coa='Germany-DATEV-SKR04EU' AND NOT EXISTS (SELECT id from chart where accno='3837')
|
|
63 |
);
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
INSERT INTO tax (
|
|
68 |
chart_id,
|
|
69 |
reverse_charge_chart_id,
|
|
70 |
rate,
|
|
71 |
taxkey,
|
|
72 |
taxdescription,
|
|
73 |
chart_categories
|
|
74 |
)
|
|
75 |
SELECT
|
|
76 |
(SELECT id FROM chart WHERE accno = '1577'),
|
|
77 |
(SELECT id FROM chart WHERE accno = '1787'), 0,
|
|
78 |
'94', '19% Vorsteuer und 19% Umsatzsteuer', 'EI'
|
|
79 |
WHERE EXISTS ( -- update only for SKR03
|
|
80 |
SELECT coa FROM defaults
|
|
81 |
WHERE defaults.coa='Germany-DATEV-SKR03EU'
|
|
82 |
);
|
|
83 |
|
|
84 |
|
|
85 |
INSERT INTO tax (
|
|
86 |
chart_id,
|
|
87 |
reverse_charge_chart_id,
|
|
88 |
rate,
|
|
89 |
taxkey,
|
|
90 |
taxdescription,
|
|
91 |
chart_categories
|
|
92 |
)
|
|
93 |
SELECT
|
|
94 |
(SELECT id FROM chart WHERE accno = '1407'),
|
|
95 |
(SELECT id FROM chart WHERE accno = '3837'), 0,
|
|
96 |
'94', '19% Vorsteuer und 19% Umsatzsteuer', 'EI'
|
|
97 |
WHERE EXISTS ( -- update only for SKR03
|
|
98 |
SELECT coa FROM defaults
|
|
99 |
WHERE defaults.coa='Germany-DATEV-SKR04EU'
|
|
100 |
);
|
|
101 |
|
|
102 |
;
|
|
103 |
-- if not defined
|
|
104 |
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
|
|
105 |
(SELECT chart_id from taxkeys where chart_id = ( SELECT chart_id FROM tax WHERE taxkey = '94') ;
|
|
106 |
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
|
|
107 |
(SELECT chart_id from taxkeys where chart_id = ( SELECT reverse_charge_chart_id FROM tax WHERE taxkey = '94');
|
|
108 |
|
DB-Skript: Reverse Charge für Kreditorenbelege