-- 坏账账龄分组预置一个默认的账龄分组
-- 应收表头
DELETE FROM t_ar_accrualaging WHERE FID = 1530657671860979712;
INSERT INTO t_ar_accrualaging(FID,FBITINDEX,FGROUPBASIS,FGROUPTYPE,FCREATEORGID,FISDEFAULT,FSOURCEDATAID,FORGID,FMASTERID,FSTATUS,FCTRLSTRATEGY,FNAME,FNUMBER,FCREATETIME,FSOURCEBITINDEX,FMODIFIERID,FENABLE,FISPRESET,FMODIFYTIME,FDAYSOFYEAR,FCREATORID) VALUES (1530657671860979712,0,'1',',0,',100000,'1',0,100000,1530657671860979712,'C','5','坏账账龄分组-预置','0001',{ts'2018-08-08 18:08:08'},0,1,'1','1',{ts'2018-03-03  00:00:00'},365,1);

-- 应收分录
DELETE FROM t_ar_accrualagingentry WHERE FENTRYID = 1530657671936477184;
INSERT INTO t_ar_accrualagingentry(FID,FSECTION,FENDYEAR,FISDAYMORE,FENTRYID,FSEQ,FSTARTDAY,FENDDAY) VALUES (1530657671860979712,'0-1年',1,'0',1530657671936477184,1,0,365);
DELETE FROM t_ar_accrualagingentry WHERE FENTRYID = 1530657671936477185;
INSERT INTO t_ar_accrualagingentry(FID,FSECTION,FENDYEAR,FISDAYMORE,FENTRYID,FSEQ,FSTARTDAY,FENDDAY) VALUES (1530657671860979712,'1-2年',2,'0',1530657671936477185,2,366,730);
DELETE FROM t_ar_accrualagingentry WHERE FENTRYID = 1530657671936477186;
INSERT INTO t_ar_accrualagingentry(FID,FSECTION,FENDYEAR,FISDAYMORE,FENTRYID,FSEQ,FSTARTDAY,FENDDAY) VALUES (1530657671860979712,'2-3年',3,'0',1530657671936477186,3,731,1095);
DELETE FROM t_ar_accrualagingentry WHERE FENTRYID = 1530657671936477187;
INSERT INTO t_ar_accrualagingentry(FID,FSECTION,FENDYEAR,FISDAYMORE,FENTRYID,FSEQ,FSTARTDAY,FENDDAY) VALUES (1530657671860979712,'3年以上',0,'1',1530657671936477187,4,1096,0);

-- 应收多语言
DELETE FROM t_ar_accrualaging_L WHERE FPKID = '2T/7T9C8EVZG';
INSERT INTO t_ar_accrualaging_L(FID,FPKID,FLOCALEID,FNAME) VALUES (1530657671860979712,'2T/7T9C8EVZG','zh_CN','坏账账龄分组-预置');
DELETE FROM t_ar_accrualaging_L WHERE FPKID = '2T/7T9C8EVZH';
INSERT INTO t_ar_accrualaging_L(FID,FPKID,FLOCALEID,FNAME) VALUES (1530657671860979712,'2T/7T9C8EVZH','zh_TW','壞賬賬齡分組-預置');

-- 坏账准备单DAP关系
DELETE FROM t_ai_dapconfig WHERE FID = 1543621764389560320;
INSERT INTO t_ai_dapconfig(FID,FWRITEBACKPLUGIN,FISDAP,FBILLENTITY) VALUES (1543621764389560320,'kd.fi.ar.writeback.DapVoucherWriteBackFinAr','1','ar_baddebtpreparebill');


-- 方案表头
DELETE FROM t_ar_baddebtaccrualplan WHERE FID = 1544107390520048640;
INSERT INTO t_ar_baddebtaccrualplan(FID,FCREATORID,FSOURCEDATAID,FMODIFYTIME,FOFFSET,FSOURCEBITINDEX,FACCRUALMETHOD,FNAME,FBITINDEX,FCTRLSTRATEGY,FACCRUALAGINGID,FCREATETIME,FACCRUALFREQUENCY,FNUMBER,FSTATUS,FORGID,FMODIFIERID,FENABLE,FCREATEORGID,FMASTERID,FISPRESET) VALUES (1544107390520048640,1,0,{ts'2022-11-01  00:00:00'},' ',0,'0','坏账计提方案-预置',0,'5',0,{ts'2018-08-08 18:08:08'},'year','0001','C',100000,1,'1',100000,1544107390520048640,'1');

-- 多语言
DELETE FROM T_AR_BaddebtAccrualPlan_L WHERE FPKID = '2UNNU49QF8Z8';
INSERT INTO T_AR_BaddebtAccrualPlan_L(FID,FPKID,FLOCALEID,FNAME) VALUES (1544107390520048640,'2UNNU49QF8Z8','zh_CN','坏账计提方案-预置');
DELETE FROM T_AR_BaddebtAccrualPlan_L WHERE FPKID = '2UNNU49QF8Z9';
INSERT INTO T_AR_BaddebtAccrualPlan_L(FID,FPKID,FLOCALEID,FNAME) VALUES (1544107390520048640,'2UNNU49QF8Z9','zh_TW','壞賬計提方案-預置');

-- 分录
DELETE FROM T_AR_AccrualPlanEntry WHERE FENTRYID = 1544107390528437248;
INSERT INTO T_AR_AccrualPlanEntry(FID,FAGINGSTARTDATEFIELD,FREMARK,FCONDITION_TAG,FOFFSET,FACCRUALRATE,FENTRYID,FNAME,FACCRUALENTITYOBJID,FACCRUALRATE_TAG,FINCLUDEPERIOD,FSEQ,FNUMBER,FOFFSET_TAG,FACCRUALCONTEXT,FAGINGGROUPID,FOFFSETREMARK,FCONDITION) VALUES (1544107390520048640,'acctagecalcdate','对存在余额的应收款进行坏账计提，无论是否启用合同资产核算均适用，需注意为保证计提数据准确，请及时对财务应收单进行结算（包括但不限于应收预收结算、应收收款结算、应收冲应付）','{"exprTran":"","description":{"zh_CN":""},"filterCondition":{"filterRow":[],"forList":false},"filterString":"{\"filterRow\":[],\"forList\":false}","initialized":false,"localeExprTran":{"zh_CN":""}}',' ',' ',1544107390528437248,'应收款计提坏账',1405616784618318848,'[{"seq":0,"section":"0-1年","daymore":false,"startdays":0,"enddays":365,"accrualrate":5.00,"endyear":1},{"seq":1,"section":"1-2年","daymore":false,"startdays":366,"enddays":730,"accrualrate":20.00,"endyear":2},{"seq":2,"section":"2-3年","daymore":false,"startdays":731,"enddays":1095,"accrualrate":50.00,"endyear":3},{"seq":3,"section":"3年以上","daymore":true,"startdays":1096,"enddays":0,"accrualrate":100.00,"endyear":0}]','1',1,'0001','[]','0',1530657671860979712,'预收若需要冲抵应收建议通过应收结算减少应收余额，而不是在此处配置抵消。',' ');
DELETE FROM T_AR_AccrualPlanEntry WHERE FENTRYID = 1544107390528437249;
INSERT INTO T_AR_AccrualPlanEntry(FID,FAGINGSTARTDATEFIELD,FREMARK,FCONDITION_TAG,FOFFSET,FACCRUALRATE,FENTRYID,FNAME,FACCRUALENTITYOBJID,FACCRUALRATE_TAG,FINCLUDEPERIOD,FSEQ,FNUMBER,FOFFSET_TAG,FACCRUALCONTEXT,FAGINGGROUPID,FOFFSETREMARK,FCONDITION) VALUES (1544107390520048640,'bizdate','在应收与收入确认时点存在差异，启用合同资产核算时适用，需注意为保证计提数据准确，需启用收入确认单与财务应收单的核销功能，记录被核减的合同资产以及合同资产余额。注意当存在同一合同的预收为合同负债时，可以进行合同资产的抵消，此时需要配置抵消规则。','{"exprTran":"","description":{"zh_CN":""},"filterCondition":{"filterRow":[],"forList":false},"filterString":"{\"filterRow\":[],\"forList\":false}","initialized":false,"localeExprTran":{"zh_CN":""}}','0',' ',1544107390528437249,'合同资产计提坏账',1405628022861622272,'[{"seq":0,"section":"0-1年","daymore":false,"startdays":0,"enddays":365,"accrualrate":5.00,"endyear":1},{"seq":1,"section":"1-2年","daymore":false,"startdays":366,"enddays":730,"accrualrate":20.00,"endyear":2},{"seq":2,"section":"2-3年","daymore":false,"startdays":731,"enddays":1095,"accrualrate":50.00,"endyear":3},{"seq":3,"section":"3年以上","daymore":true,"startdays":1096,"enddays":0,"accrualrate":100.00,"endyear":0}]','1',2,'0002','[{"receivedfield":"entry.e_corebillno","receivedsite":"entry","recbillfield":"entry.e_corebillno","recbillsite":"entry","matchrelation":"0","offsetbillfield":"entry.e_corebillno","offsetbillsite":"entry","offsetedObj":"ar_revcfmbill","nullmatch":false},{"receivedfield":"asstact","receivedsite":"","recbillfield":"itempayer","recbillsite":"","matchrelation":"0","offsetbillfield":"asstact","offsetbillsite":"","offsetedObj":"ar_revcfmbill","nullmatch":false}]','1',1530657671860979712,'默认相同合同下的合同负债可冲抵合同资产，冲抵后余额进行坏账计提；若现场存在非相同合同或无合同的预收要冲抵合同资产，可按需配置匹配信息。',' ');
DELETE FROM T_AR_AccrualPlanEntry WHERE FENTRYID = 1544107390528437250;
INSERT INTO T_AR_AccrualPlanEntry(FID,FAGINGSTARTDATEFIELD,FREMARK,FCONDITION_TAG,FOFFSET,FACCRUALRATE,FENTRYID,FNAME,FACCRUALENTITYOBJID,FACCRUALRATE_TAG,FINCLUDEPERIOD,FSEQ,FNUMBER,FOFFSET_TAG,FACCRUALCONTEXT,FAGINGGROUPID,FOFFSETREMARK,FCONDITION) VALUES (1544107390520048640,'bizdate','对存在余额的未票应收款进行坏账计提，适用于启用预估应收款的模式适，需注意为保证计提数据准确，请启用应收暂估的单到冲回；为保证业务连续性，请把应收参数“显示坏账账龄起算日”打开。','{"exprTran":"","description":{"zh_CN":""},"filterCondition":{"filterRow":[],"forList":false},"filterString":"{\"filterRow\":[],\"forList\":false}","initialized":false,"localeExprTran":{"zh_CN":""}}','1',' ',1544107390528437250,'未票应收计提坏账',1405617211313253376,'[{"seq":0,"section":"0-1年","daymore":false,"startdays":0,"enddays":365,"accrualrate":5.00,"endyear":1},{"seq":1,"section":"1-2年","daymore":false,"startdays":366,"enddays":730,"accrualrate":20.00,"endyear":2},{"seq":2,"section":"2-3年","daymore":false,"startdays":731,"enddays":1095,"accrualrate":50.00,"endyear":3},{"seq":3,"section":"3年以上","daymore":true,"startdays":1096,"enddays":0,"accrualrate":100.00,"endyear":0}]','1',3,'0003','[{"receivedfield":"entry.e_corebillno","receivedsite":"entry","recbillfield":"entry.e_corebillno","recbillsite":"entry","matchrelation":"0","offsetbillfield":"entry.e_corebillno","offsetbillsite":"entry","offsetedObj":"ar_busbill","nullmatch":false},{"receivedfield":"asstact","receivedsite":"","recbillfield":"itempayer","recbillsite":"","matchrelation":"0","offsetbillfield":"asstact","offsetbillsite":"","offsetedObj":"ar_busbill","nullmatch":false}]','0',1530657671860979712,'当使用暂估应收业务模式时可用，可用未结算的预收抵消未票应收的未冲回的余额的坏账风险。注意：一般暂估应收与应收收入分离的模式互斥，不会同时存在。在启用暂估应收业务模式下为保证坏账计提的业务连续性，请把应收参数“显示坏账账龄起算日”打开，并且财务应收单的账龄起算日字段为暂估应收单的单据日期。',' ');
DELETE FROM T_AR_AccrualPlanEntry WHERE FENTRYID = 1544107390528437251;
INSERT INTO T_AR_AccrualPlanEntry(FID,FAGINGSTARTDATEFIELD,FREMARK,FCONDITION_TAG,FOFFSET,FACCRUALRATE,FENTRYID,FNAME,FACCRUALENTITYOBJID,FACCRUALRATE_TAG,FINCLUDEPERIOD,FSEQ,FNUMBER,FOFFSET_TAG,FACCRUALCONTEXT,FAGINGGROUPID,FOFFSETREMARK,FCONDITION) VALUES (1544107390520048640,'bizdate','对没有参与应付结算的预付余额进行坏账计提，注意为保证计提数据准确请及时对付款单进行结算。','{"exprTran":"","description":{"zh_CN":""},"filterCondition":{"filterRow":[],"forList":false},"filterString":"{\"filterRow\":[],\"forList\":false}","initialized":false,"localeExprTran":{"zh_CN":""}}',' ',' ',1544107390528437251,'预付及合同资产计提坏账（期初）',1405617982025001984,'[{"seq":0,"section":"0-1年","daymore":false,"startdays":0,"enddays":365,"accrualrate":5.00,"endyear":1},{"seq":1,"section":"1-2年","daymore":false,"startdays":366,"enddays":730,"accrualrate":20.00,"endyear":2},{"seq":2,"section":"2-3年","daymore":false,"startdays":731,"enddays":1095,"accrualrate":50.00,"endyear":3},{"seq":3,"section":"3年以上","daymore":true,"startdays":1096,"enddays":0,"accrualrate":100.00,"endyear":0}]','1',4,'0004','[]','2',1530657671860979712,' ',' ');
DELETE FROM T_AR_AccrualPlanEntry WHERE FENTRYID = 1544107390528437252;
INSERT INTO T_AR_AccrualPlanEntry(FID,FAGINGSTARTDATEFIELD,FREMARK,FCONDITION_TAG,FOFFSET,FACCRUALRATE,FENTRYID,FNAME,FACCRUALENTITYOBJID,FACCRUALRATE_TAG,FINCLUDEPERIOD,FSEQ,FNUMBER,FOFFSET_TAG,FACCRUALCONTEXT,FAGINGGROUPID,FOFFSETREMARK,FCONDITION) VALUES (1544107390520048640,'bizdate','对没有参与应付结算的预付余额进行坏账计提，注意为保证计提数据准确请及时对付款单进行结算。','{"exprTran":"","description":{"zh_CN":""},"filterCondition":{"filterRow":[],"forList":false},"filterString":"{\"filterRow\":[],\"forList\":false}","initialized":false,"localeExprTran":{"zh_CN":""}}',' ',' ',1544107390528437252,'预付及合同资产计提坏账',1405618372346932224,'[{"seq":0,"section":"0-1年","daymore":false,"startdays":0,"enddays":365,"accrualrate":5.00,"endyear":1},{"seq":1,"section":"1-2年","daymore":false,"startdays":366,"enddays":730,"accrualrate":20.00,"endyear":2},{"seq":2,"section":"2-3年","daymore":false,"startdays":731,"enddays":1095,"accrualrate":50.00,"endyear":3},{"seq":3,"section":"3年以上","daymore":true,"startdays":1096,"enddays":0,"accrualrate":100.00,"endyear":0}]','1',5,'0005','[]','2',1530657671860979712,' ',' ');

-- 分录多语言
DELETE FROM T_AR_AccrualPlanEntry_L WHERE FPKID = '2UNNU49U1O4W';
INSERT INTO T_AR_AccrualPlanEntry_L(FID,FPKID,FENTRYID,FLOCALEID,FNAME) VALUES (0,'2UNNU49U1O4W',1544107390528437250,'zh_CN','未票应收计提坏账');
DELETE FROM T_AR_AccrualPlanEntry_L WHERE FPKID = '2UNNU49U1O4V';
INSERT INTO T_AR_AccrualPlanEntry_L(FID,FPKID,FENTRYID,FLOCALEID,FNAME) VALUES (0,'2UNNU49U1O4V',1544107390528437250,'zh_TW','未票應收計提壞賬');
DELETE FROM T_AR_AccrualPlanEntry_L WHERE FPKID = '2UNNU49U1O4X';
INSERT INTO T_AR_AccrualPlanEntry_L(FID,FPKID,FENTRYID,FLOCALEID,FNAME) VALUES (0,'2UNNU49U1O4X',1544107390528437251,'zh_TW','預付及合同資產計提壞賬（期初）');
DELETE FROM T_AR_AccrualPlanEntry_L WHERE FPKID = '2UNNU49U1O4Y';
INSERT INTO T_AR_AccrualPlanEntry_L(FID,FPKID,FENTRYID,FLOCALEID,FNAME) VALUES (0,'2UNNU49U1O4Y',1544107390528437251,'zh_CN','预付及合同资产计提坏账（期初）');
DELETE FROM T_AR_AccrualPlanEntry_L WHERE FPKID = '2UNNU49U1O4Z';
INSERT INTO T_AR_AccrualPlanEntry_L(FID,FPKID,FENTRYID,FLOCALEID,FNAME) VALUES (0,'2UNNU49U1O4Z',1544107390528437252,'zh_TW','預付及合同資產計提壞賬');
DELETE FROM T_AR_AccrualPlanEntry_L WHERE FPKID = '2UNNU49U1O5+';
INSERT INTO T_AR_AccrualPlanEntry_L(FID,FPKID,FENTRYID,FLOCALEID,FNAME) VALUES (0,'2UNNU49U1O5+',1544107390528437252,'zh_CN','预付及合同资产计提坏账');
DELETE FROM T_AR_AccrualPlanEntry_L WHERE FPKID = '2UQW+H82ZA/M';
INSERT INTO T_AR_AccrualPlanEntry_L(FID,FPKID,FENTRYID,FLOCALEID,FNAME) VALUES (0,'2UQW+H82ZA/M',1544107390528437248,'zh_TW','應收款計提壞賬');
DELETE FROM T_AR_AccrualPlanEntry_L WHERE FPKID = '2UQW+H82ZA/N';
INSERT INTO T_AR_AccrualPlanEntry_L(FID,FPKID,FENTRYID,FLOCALEID,FNAME) VALUES (0,'2UQW+H82ZA/N',1544107390528437248,'zh_CN','应收款计提坏账');
DELETE FROM T_AR_AccrualPlanEntry_L WHERE FPKID = '2UQW+H82ZA/O';
INSERT INTO T_AR_AccrualPlanEntry_L(FID,FPKID,FENTRYID,FLOCALEID,FNAME) VALUES (0,'2UQW+H82ZA/O',1544107390528437249,'zh_TW','合同資產計提壞賬');
DELETE FROM T_AR_AccrualPlanEntry_L WHERE FPKID = '2UQW+H82ZA/P';
INSERT INTO T_AR_AccrualPlanEntry_L(FID,FPKID,FENTRYID,FLOCALEID,FNAME) VALUES (0,'2UQW+H82ZA/P',1544107390528437249,'zh_CN','合同资产计提坏账');
