-- 对公报销单
UPDATE T_ER_PUBREIMEXPDET_A SET FCURCONTROLAMT = FCONTROLAMT,FCUROTHERFEEAMOUNT = FOTHERFEEAMOUNT, FCUROTHERCONTROLAMT = FOTHERCONTROLAMT WHERE fcontrolamt > 0;
UPDATE T_ER_PUBREIMEXPDET_A BILL SET (FFEECURRENCY,FFEEEXCHANGERATE,FFEEQUOTETYPE) =  (SELECT FENTRYCURRENCY,FEXCHANGERATE,FQUOTETYPE FROM T_ER_PUBREIMEXPDET TI WHERE TI.FDETAILID = BILL.FDETAILID) WHERE EXISTS (SELECT 1 FROM T_ER_PUBREIMEXPDET TI2 WHERE BILL.FDETAILID = TI2.FDETAILID AND BILL.FFEECURRENCY = 0);

--费用报销单
UPDATE T_ER_EXPENSEDETAIL_A SET FCUROTHERCONTROLAMT = FOTHERCONTROLAMT WHERE FOTHERCONTROLAMT > 0 and FCUROTHERCONTROLAMT = 0;
UPDATE T_ER_EXPENSEDETAIL_A BILL SET (FFEECURRENCY,FFEEEXCHANGERATE,FFEEQUOTETYPE,FCURCONTROLAMT,FCUROTHERFEEAMOUNT) =  (SELECT FENTRYCURRENCY,FEXCHANGERATE,FQUOTETYPE,FCONTROLAMT,FOTHERFEEAMOUNT FROM T_ER_EXPENSEDETAIL TI WHERE TI.FDETAILID = BILL.FDETAILID) WHERE EXISTS (SELECT 1 FROM T_ER_EXPENSEDETAIL TI2 WHERE BILL.FDETAILID = TI2.FDETAILID  AND BILL.FFEECURRENCY = 0);

--费用申请单
UPDATE T_ER_DAILYAPPLYDETAIL SET FFEECURRENCY = FENTRYCURRENCY, FFEEEXCHANGERATE = FEXCHANGERATE, FFEEQUOTETYPE = FQUOTETYPE, FCURCONTROLAMT = FCONTROLAMT, FCUROTHERFEEAMOUNT = FOTHERFEEAMOUNT, FCUROTHERCONTROLAMT = FOTHERCONTROLAMT  WHERE FFEECURRENCY = 0;

-- 预置全局参数
DELETE FROM T_ER_STDCONFIG WHERE FID=1982603132832043008;
INSERT INTO T_ER_STDCONFIG (FID, FVALUE, FDESC, FKEY) VALUES(1982603132832043008, '1', '设置费用标准控制模式. 1按原币控制；2按本位币控制', 'BaseCurrencyControl');