INSERT INTO EMPLOYEE_GROUPS
SELECT TENANT_NO, COMPANY_NO, 'Karten','Karten'
FROM companies
WHERE NOT EXISTS (
	SELECT * 
     FROM EMPLOYEE_GROUPS 
     WHERE employee_group_cd = 'Karten'
);

INSERT INTO EMPLOYEE_GROUP_PERMISSIONS
SELECT TENANT_NO, COMPANY_NO, 'Karten','P_CENTRAL_CARDS','Karten'
FROM companies
WHERE NOT EXISTS (
	SELECT * 
     FROM EMPLOYEE_GROUP_PERMISSIONS 
     WHERE employee_group_cd = 'Karten'
);


INSERT INTO EMPLOYEE_GROUPS
SELECT TENANT_NO, COMPANY_NO, 'Kassenlade öffnen','Kassenlade öffnen'
FROM companies
WHERE NOT EXISTS (
	SELECT * 
     FROM EMPLOYEE_GROUPS 
     WHERE employee_group_cd = 'Kassenlade öffnen'
);

INSERT INTO EMPLOYEE_GROUP_PERMISSIONS
SELECT TENANT_NO, COMPANY_NO, 'Kassenlade öffnen','P_OPEN_CASH_DRAWER','Kassenlade öffnen'
FROM companies
WHERE NOT EXISTS (
	SELECT * 
     FROM EMPLOYEE_GROUP_PERMISSIONS 
     WHERE employee_group_cd = 'Kassenlade öffnen'
);
insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'CRS_Client_Id','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'CRS_Client_Id'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'Disable_Central_Contact_Search','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'Disable_Central_Contact_Search'
);
insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'CRS_Direct_Url','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'CRS_Direct_Url'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'Enable_Item_Tree_Reload','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'Enable_Item_Tree_Reload'
);
insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'Uses_Voucher_Cards','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'Uses_Voucher_Cards'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'CRS_Saloon_No','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'CRS_Saloon_No'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'Disable_CheckIn_CheckOut','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'Disable_CheckIn_CheckOut'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'Hide_Customer_Export','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'Hide_Customer_Export'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'Protocol_For_DayClosure_Required','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'Protocol_For_DayClosure_Required'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'Sales_Payment_Transfer_Deactivated','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'Sales_Payment_Transfer_Deactivated'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'Book_On_Credit_Deactivated','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'Book_On_Credit_Deactivated'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'SALES_PRINT_OPTION','IMMEDIATE_PRINT'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'SALES_PRINT_OPTION'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'SORT_ITEMS','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'SORT_ITEMS'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'Scanable_FastInputs','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'Scanable_FastInputs'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'Search_Items','NON_STRICT'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'Search_Items'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'Enable_Voucher_For_Voucher_Overpay','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'Enable_Voucher_For_Voucher_Overpay'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'Disable_Immediate_CashDifference','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'Disable_Immediate_CashDifference'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'Focus_Card_On_Note_Search','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'Focus_Card_On_Note_Search'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'Disable_Ec_Payment_Overpay','0'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'Disable_Ec_Payment_Overpay'
);

insert into businessunit_properties 
SELECT tenant_no,company_no,department_no,businessunit_no,'Requires_No_Parked_SalesInvs_On_DayClosure','1'
FROM businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM businessunit_properties 
     WHERE property = 'Requires_No_Parked_SalesInvs_On_DayClosure'
);

insert into simple_accounts
SELECT tenant_no,company_no,department_no,'K+New',19,0,0,'','',CAST(NULL AS DECIMAL),'Kassendifferenz +','',''
from businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM simple_accounts 
     WHERE simple_acct_type = 19
);

insert into simple_accounts
SELECT tenant_no,company_no,department_no,'K-New',20,0,0,'','',CAST(NULL AS DECIMAL),'Kassendifferenz -','',''
from businessunits
WHERE NOT EXISTS (
	SELECT * 
     FROM simple_accounts 
     WHERE simple_acct_type = 20
);


update businessunits set pos_cd_hint = (Select pos_cd from points_of_sale);

INSERT INTO CANCEL_PAYMENT_REASONS
SELECT TENANT_NO, COMPANY_NO, DEPARTMENT_NO, BUSINESSUNIT_NO, '1', 'falsche Zahlart'
FROM BUSINESSUNITS
WHERE NOT EXISTS (
	SELECT * 
     FROM CANCEL_PAYMENT_REASONS 
     WHERE payment_cancel_cd = '1'
);
INSERT INTO CANCEL_PAYMENT_REASONS
SELECT TENANT_NO, COMPANY_NO, DEPARTMENT_NO, BUSINESSUNIT_NO, '2', 'falscher Betrag'
FROM BUSINESSUNITS
WHERE NOT EXISTS (
	SELECT * 
     FROM CANCEL_PAYMENT_REASONS 
     WHERE payment_cancel_cd = '2'
);

INSERT INTO CANCEL_NOTE_REASONS
SELECT TENANT_NO, COMPANY_NO, DEPARTMENT_NO, BUSINESSUNIT_NO, '1', 'Reklamation'
FROM BUSINESSUNITS
WHERE NOT EXISTS (
	SELECT * 
     FROM CANCEL_NOTE_REASONS 
     WHERE note_cancel_cd = '1'
);
INSERT INTO CANCEL_NOTE_REASONS
SELECT TENANT_NO, COMPANY_NO, DEPARTMENT_NO, BUSINESSUNIT_NO, '2', 'falscher Mitarbeiter'
FROM BUSINESSUNITS
WHERE NOT EXISTS (
	SELECT * 
     FROM CANCEL_NOTE_REASONS 
     WHERE note_cancel_cd = '2'
);
INSERT INTO CANCEL_NOTE_REASONS
SELECT TENANT_NO, COMPANY_NO, DEPARTMENT_NO, BUSINESSUNIT_NO, '3', 'falsches Produkt'
FROM BUSINESSUNITS
WHERE NOT EXISTS (
	SELECT * 
     FROM CANCEL_NOTE_REASONS 
     WHERE note_cancel_cd = '3'
);

INSERT INTO EMPLOYEE_GROUPS
SELECT TENANT_NO, COMPANY_NO, 'Umsatzbarometer','Umsatzbarometer'
FROM BUSINESSUNITS
WHERE NOT EXISTS (
	SELECT * 
     FROM EMPLOYEE_GROUPS 
     WHERE employee_group_cd = 'Umsatzbarometer'
);
INSERT INTO EMPLOYEE_GROUPS
SELECT TENANT_NO, COMPANY_NO, 'Statistiken','Statistiken'
FROM BUSINESSUNITS
WHERE NOT EXISTS (
	SELECT * 
     FROM EMPLOYEE_GROUPS 
     WHERE employee_group_cd = 'Statistiken'
);

INSERT INTO EMPLOYEE_GROUP_PERMISSIONS
SELECT TENANT_NO, COMPANY_NO, 'Umsatzbarometer','P_REV_DASHBOARD','Umsatzbarometer'
FROM BUSINESSUNITS
WHERE NOT EXISTS (
	SELECT * 
     FROM EMPLOYEE_GROUP_PERMISSIONS 
     WHERE employee_group_cd = 'Umsatzbarometer'
);
INSERT INTO EMPLOYEE_GROUP_PERMISSIONS
SELECT TENANT_NO, COMPANY_NO, 'Statistiken','P_STATISTICS','Statistiken'
FROM BUSINESSUNITS
WHERE NOT EXISTS (
	SELECT * 
     FROM EMPLOYEE_GROUP_PERMISSIONS 
     WHERE employee_group_cd = 'Statistiken'
);

INSERT INTO item_report_categories select tenant_no,company_no, department_no, 'damen', 'Damen' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_categories      WHERE item_report_category_cd = 'damen');
INSERT INTO item_report_categories select tenant_no,company_no, department_no, 'herren', 'Herren' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_categories      WHERE item_report_category_cd = 'herren');
INSERT INTO item_report_categories select tenant_no,company_no, department_no, 'kinder', 'Kinder' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_categories      WHERE item_report_category_cd = 'kinder');
INSERT INTO item_report_categories select tenant_no,company_no, department_no, 'kosmetik', 'Kosmetik' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_categories      WHERE item_report_category_cd = 'kosmetik');
INSERT INTO item_report_categories select tenant_no,company_no, department_no, 'laser', 'Laser' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_categories      WHERE item_report_category_cd = 'laser');

INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'damen','waschenlegen','Dwaschenlegen' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'damen' and  item_report_group_cd = 'waschenlegen');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'damen','waschenfoenen','Dwaschenfoenen' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'damen' and  item_report_group_cd = 'waschenfoenen');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'damen','dauerwelle','Ddauerwelle' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'damen' and  item_report_group_cd = 'dauerwelle');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'damen','faerben','Dfaerben' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'damen' and  item_report_group_cd = 'faerben');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'damen','straehnen','Dstraehnen' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'damen' and  item_report_group_cd = 'straehnen');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'damen','toenen','Dtoenen' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'damen' and  item_report_group_cd = 'toenen');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'damen','faerben','Dfaerben' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'damen' and  item_report_group_cd = 'faerben');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'damen','haarschnitt','Dhaarschnitt' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'damen' and  item_report_group_cd = 'haarschnitt');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'damen','haarpflege','Dhaarpflege' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'damen' and  item_report_group_cd = 'haarpflege');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'damen','kopfhaut','Dkopfhaut' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'damen' and  item_report_group_cd = 'kopfhaut');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'kosmetik','augen','Kaugen' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'kosmetik' and  item_report_group_cd = 'augen');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'kosmetik','hand','Khand' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'kosmetik' and  item_report_group_cd = 'hand');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'kosmetik','makeup','Kmakeup' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'kosmetik' and  item_report_group_cd = 'makeup');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'herren','waschenfoenen','Hwaschenfoenen' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'herren' and  item_report_group_cd = 'waschenfoenen');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'herren','dauerwelle','Hdauerwelle' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'herren' and  item_report_group_cd = 'dauerwelle');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'herren','faerben','Hfaerben' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'herren' and  item_report_group_cd = 'faerben');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'herren','haarschnitt1','Hhaarschnitt1' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'herren' and  item_report_group_cd = 'haarschnitt1');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'herren','haarpflege','Hhaarpflege' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'herren' and  item_report_group_cd = 'haarpflege');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'herren','kopfhaut','Hkopfhaut' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'herren' and  item_report_group_cd = 'kopfhaut');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'kinder','waschenfoenen','Kwaschenfoenen' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'kinder' and  item_report_group_cd = 'waschenfoenen');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'kinder','dauerwelle','Kdauerwelle' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'kinder' and  item_report_group_cd = 'dauerwelle');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'kinder','faerben','Kfaerben' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'kinder' and  item_report_group_cd = 'faerben');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'kinder','haarschnitt1','Khaarschnitt1' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'kinder' and  item_report_group_cd = 'haarschnitt1');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'kinder','haarpflege','Khaarpflege' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'kinder' and  item_report_group_cd = 'haarpflege');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'kinder','kopfhaut','Kkopfhaut' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'kinder' and  item_report_group_cd = 'kopfhaut');
INSERT INTO item_report_groups select tenant_no,company_no, department_no, 'laser','laser','Laser' FROM BUSINESSUNITS WHERE NOT EXISTS (SELECT * FROM item_report_groups      WHERE item_report_category_cd = 'laser' and  item_report_group_cd = 'laser');


insert into treatment_groups SELECT tenant_no,pos_cd,1,'Farbe',1 from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,1,1,'Farbe / Nuance' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,1,2,'Menge' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,1,3,'Ansatz, Länge, Vorbehandlung' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,1,4,'Mischverhältnis' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,1,5,'H2O2 in %' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,1,6,'Einwirkzeit' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,1,7,'Finish' from points_of_sale;

insert into treatment_groups SELECT tenant_no,pos_cd,11,'Strähnen',1 from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,11,1,'Farbe / Nuance' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,11,2,'OK, GK, Seite' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,11,3,'Menge' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,11,4,'H2O2 in %' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,11,5,'Einwirkzeit' from points_of_sale;


insert into treatment_groups SELECT tenant_no,pos_cd,12,'Dauerwelle',1 from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,12,1,'Vorbehandlung' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,12,2,'Fixierung' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,12,3,'Vorderkopf' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,12,4,'Seitlich' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,12,5,'Hinten' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,12,6,'Nacken' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,12,7,'Einwirkzeit' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,12,8,'Nachbehandlung' from points_of_sale;



insert into treatment_groups SELECT tenant_no,pos_cd,13,'Haarschnitt',1 from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,13,1,'Form' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,13,2,'Länge' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,13,3,'Styling / Finish' from points_of_sale;


insert into treatment_groups SELECT tenant_no,pos_cd,14,'Haarpflege',1 from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,14,1,'Serviceleistung' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,14,2,'Haarwäsche' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,14,3,'Shampoo' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,14,4,'Kopfhautpflege' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,14,5,'Massage' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,14,6,'Haarschnitt' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,14,7,'Umformung' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,14,8,'Finish' from points_of_sale;

insert into treatment_groups SELECT tenant_no,pos_cd,15,'Kosmetik',1 from points_of_sale; 
insert into treatment_group_fields SELECT tenant_no,pos_cd,15,1,'Reinigung' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,15,2,'Gesichtslotion' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,15,3,'Visarome' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,15,4,'Pflegebehandlung' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,15,5,'Massage' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,15,6,'Creme' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,15,7,'Spezialpflege' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,15,8,'Depilation' from points_of_sale;

insert into treatment_groups SELECT tenant_no,pos_cd,16,'Make-Up',1 from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,16,1,'Teint' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,16,2,'Puder' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,16,3,'Rouge' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,16,4,'Augenkontur' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,16,5,'Lidschatten' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,16,6,'Mascara' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,16,7,'Brauenstift' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,16,8,'Lippenkontur' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,16,9,'Lippenstift' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,16,10,'Gloss' from points_of_sale;

insert into treatment_groups SELECT tenant_no,pos_cd,19,'Augenpflege',1 from points_of_sale; 
insert into treatment_group_fields SELECT tenant_no,pos_cd,19,1,'Brauen formen' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,19,2,'Farbe - Augenbrauen' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,19,3,'Wimpernfarbe' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,19,4,'Massage' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,19,5,'Augenpflege' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,19,6,'Kompresse' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,19,7,'care & Fix Mascara' from points_of_sale;



insert into treatment_groups SELECT tenant_no,pos_cd,20,'Handpflege',1 from points_of_sale; 
insert into treatment_group_fields SELECT tenant_no,pos_cd,20,1,'Maniküre' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,20,2,'Handbad' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,20,3,'Peeling' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,20,4,'Handpackung' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,20,5,'Massage' from points_of_sale;
insert into treatment_group_fields SELECT tenant_no,pos_cd,20,6,'Nägel' from points_of_sale;

insert into treatment_groups SELECT tenant_no,pos_cd,21,'Sonstiges',1 from points_of_sale; 
insert into treatment_group_fields SELECT tenant_no,pos_cd,21,1,'Information' from points_of_sale;




insert into customer_treatments SELECT tenant_no,pos_cd,customer_remark_id,contact_no,company_no,customer_no,remark_ts from customer_remarks;
insert into customer_treatment_groups SELECT tenant_no,pos_cd,customer_remark_id,21,company_no,employee_no,employee_nm,operating_employee_no,operating_employee_nm,'' from customer_remarks;
insert into customer_treatment_group_fields SELECT tenant_no,pos_cd,customer_remark_id,21,1,remark_txt from customer_remarks;

INSERT INTO customer_groups select tenant_no,company_no,3,'Kinder','',0 from companies c 
WHERE NOT EXISTS (
SELECT * 
     FROM customer_groups c2
     WHERE c2.customer_group_no = 3
     AND c2.company_no = c.company_no 
);

update taxes set tax_desc = 'Mehrwertsteuer';
  