--- /dev/null
+-- @tag: defaults_advance_payment_transfer_charts
+-- @description: Standardkonten für erhaltene versteuerte Anzahlungen 7% und 19% setzen
+-- @depends:new_chart_3260_1711 new_chart_3272_1718
+
+
+ALTER TABLE defaults ADD COLUMN advance_payment_taxable_19_id INTEGER;
+ALTER TABLE defaults ADD COLUMN advance_payment_taxable_7_id INTEGER;
+
+DO $$
+BEGIN
+
+ IF ( SELECT coa FROM defaults ) = 'Germany-DATEV-SKR03EU' THEN
+ DECLARE
+ clearing_accno text := '1718';
+
+ BEGIN
+ IF ( SELECT COUNT(accno) FROM chart WHERE accno LIKE clearing_accno ) = 1 THEN
+ UPDATE defaults SET advance_payment_taxable_19_id = (SELECT id FROM chart WHERE accno LIKE clearing_accno);
+ END IF;
+ END;
+ END IF;
+
+ IF ( SELECT coa FROM defaults ) = 'Germany-DATEV-SKR04EU' THEN
+ DECLARE
+ clearing_accno text := '3272';
+
+ BEGIN
+ IF ( SELECT COUNT(accno) FROM chart WHERE accno LIKE clearing_accno ) = 1 THEN
+ UPDATE defaults SET advance_payment_taxable_19_id = (SELECT id FROM chart WHERE accno LIKE clearing_accno);
+ END IF;
+ END;
+ END IF;
+
+ IF ( SELECT coa FROM defaults ) = 'Germany-DATEV-SKR03EU' THEN
+ DECLARE
+ clearing_accno text := '1711';
+
+ BEGIN
+ IF ( SELECT COUNT(accno) FROM chart WHERE accno LIKE clearing_accno ) = 1 THEN
+ UPDATE defaults SET advance_payment_taxable_7_id = (SELECT id FROM chart WHERE accno LIKE clearing_accno);
+ END IF;
+ END;
+ END IF;
+
+ IF ( SELECT coa FROM defaults ) = 'Germany-DATEV-SKR04EU' THEN
+ DECLARE
+ clearing_accno text := '3260';
+
+ BEGIN
+ IF ( SELECT COUNT(accno) FROM chart WHERE accno LIKE clearing_accno ) = 1 THEN
+ UPDATE defaults SET advance_payment_taxable_7_id = (SELECT id FROM chart WHERE accno LIKE clearing_accno);
+ END IF;
+ END;
+ END IF;
+
+
+END $$;
--- /dev/null
+-- @tag: new_chart_3260_1711
+-- @description: Neues Konto "Erhaltene, versteuerte Anzahlungen 7 % USt (Verbindlichkeiten)"
+-- @depends: release_3_5_8
+
+
+DO $$
+BEGIN
+
+ IF ( SELECT coa FROM defaults ) = 'Germany-DATEV-SKR03EU' THEN
+ DECLARE
+ new_accno text := '1711';
+
+ BEGIN
+ IF ( SELECT COUNT(accno) FROM chart WHERE accno LIKE new_accno ) = 0 THEN
+ INSERT INTO chart (accno, description, charttype, category, link, taxkey_id)
+ VALUES (new_accno, 'Erhaltene, versteuerte Anzahlungen 7 % USt (Verbindlichkeiten)','A', 'L', 'AR_amount', 0);
+ INSERT INTO taxkeys (chart_id, tax_id, taxkey_id, startdate)
+ VALUES ((SELECT id FROM chart WHERE accno LIKE new_accno), 0, 0, '1970-01-01');
+ END IF;
+ END;
+ END IF;
+
+ IF ( SELECT coa FROM defaults ) = 'Germany-DATEV-SKR04EU' THEN
+ DECLARE
+ new_accno text := '3260';
+
+ BEGIN
+ IF ( SELECT COUNT(accno) FROM chart WHERE accno LIKE new_accno ) = 0 THEN
+ INSERT INTO chart (accno, description, charttype, category, link, taxkey_id)
+ VALUES (new_accno, 'Erhaltene, versteuerte Anzahlungen 7 % USt (Verbindlichkeiten)','A', 'L', 'AR_amount', 0);
+ INSERT INTO taxkeys (chart_id, tax_id, taxkey_id, startdate)
+ VALUES ((SELECT id FROM chart WHERE accno LIKE new_accno), 0, 0, '1970-01-01');
+ END IF;
+ END;
+ END IF;
+
+END $$;
--- /dev/null
+-- @tag: new_chart_3272_1718
+-- @description: Neues Konto "Erhaltene, versteuerte Anzahlungen 19 % USt (Verbindlichkeiten)"
+-- @depends: release_3_5_8
+
+
+DO $$
+BEGIN
+
+ IF ( SELECT coa FROM defaults ) = 'Germany-DATEV-SKR03EU' THEN
+ DECLARE
+ new_accno text := '1718';
+
+ BEGIN
+ IF ( SELECT COUNT(accno) FROM chart WHERE accno LIKE new_accno ) = 0 THEN
+ INSERT INTO chart (accno, description, charttype, category, link, taxkey_id)
+ VALUES (new_accno, 'Erhaltene, versteuerte Anzahlungen 19 % USt (Verbindlichkeiten)','A', 'L', 'AR_amount', 0);
+ INSERT INTO taxkeys (chart_id, tax_id, taxkey_id, startdate)
+ VALUES ((SELECT id FROM chart WHERE accno LIKE new_accno), 0, 0, '1970-01-01');
+ END IF;
+ END;
+ END IF;
+
+ IF ( SELECT coa FROM defaults ) = 'Germany-DATEV-SKR04EU' THEN
+ DECLARE
+ new_accno text := '3272';
+
+ BEGIN
+ IF ( SELECT COUNT(accno) FROM chart WHERE accno LIKE new_accno ) = 0 THEN
+ INSERT INTO chart (accno, description, charttype, category, link, taxkey_id)
+ VALUES (new_accno, 'Erhaltene, versteuerte Anzahlungen 19 % USt (Verbindlichkeiten)','A', 'L', 'AR_amount', 0);
+ INSERT INTO taxkeys (chart_id, tax_id, taxkey_id, startdate)
+ VALUES ((SELECT id FROM chart WHERE accno LIKE new_accno), 0, 0, '1970-01-01');
+ END IF;
+ END;
+ END IF;
+
+END $$;