-- 在费用可关联单据上更新预设核算成本记录,存在多语言的外键关联，先删除多语言表对应记录 谢聪 2020-07-01
DELETE FROM T_ER_BILLTYPE_L WHERE FPKID = '0LAS88G6V7I7';
DELETE FROM T_ER_BILLTYPE WHERE FID = 833202210870652928;

--当有用户手动新增数据时，直接更新为预设数据，否则才进行新增
IF EXISTS (SELECT 1 FROM T_ER_BILLTYPE WHERE FNUMBER = 'cal_costrecord_subentity') 
UPDATE T_ER_BILLTYPE SET FISPRESET = '1' WHERE FNUMBER = 'cal_costrecord_subentity';

IF NOT EXISTS (SELECT 1 FROM T_ER_BILLTYPE WHERE FNUMBER = 'cal_costrecord_subentity') 
INSERT INTO T_ER_BILLTYPE_L(FID,FPKID,FLOCALEID,FNAME) VALUES (833202210870652928,'0LAS88G6V7I7','zh_CN','核算成本记录');

IF NOT EXISTS (SELECT 1 FROM T_ER_BILLTYPE WHERE FNUMBER = 'cal_costrecord_subentity') 
INSERT INTO T_ER_BILLTYPE(FID,FCREATETIME,FNAME,FENABLE,FCREATEORGID,FISPRESET,FMODIFYTIME,FORGID,FMASTERID,FSTATUS,FBILLNUMBER,FNUMBER) 
VALUES (833202210870652928,{ts'2020-02-24  14:22:30'},'核算成本记录','1',0,'1',{ts'2020-02-24  14:24:03'},0,833202210870652928,'C','cal_costrecord_subentity','cal_costrecord_subentity'); 


