update  T_ER_ReimburseEntry  set ftrip2startdate = (select  FStartDate from   T_ER_ReimburseTripEntry where fentryid = T_ER_ReimburseEntry.fentryid )
where FSettlementtype <> '2' and T_ER_ReimburseEntry.ftrip2startdate is null  and exists (select 1 from T_ER_ReimburseBill where fid = (select  fid from   T_ER_ReimburseTripEntry where fentryid = T_ER_ReimburseEntry.fentryid)
and fbillkind = '0' );



update  T_ER_ReimburseEntry  set ftrip2enddate = (select  Fenddate from   T_ER_ReimburseTripEntry where fentryid = T_ER_ReimburseEntry.fentryid )
where FSettlementtype <> '2' and T_ER_ReimburseEntry.ftrip2enddate is null  and exists (select 1 from T_ER_ReimburseBill where fid = (select  fid from   T_ER_ReimburseTripEntry where fentryid = T_ER_ReimburseEntry.fentryid)
and fbillkind = '0' );


update  T_ER_ReimburseEntry  set ftrip2startdate = (select  fcheckindate from   t_er_hotelbill  where forderNum = T_ER_ReimburseEntry.fordernum)
where  FSettlementtype = '2' and FOrderFormID = 'er_hotelbill'   and exists (select 1 from T_ER_ReimburseBill where fid = (select  fid from   T_ER_ReimburseTripEntry where fentryid = T_ER_ReimburseEntry.fentryid)
and fbillkind = '0' );


update  T_ER_ReimburseEntry  set ftrip2enddate = (select  fcheckOutDate from   t_er_hotelbill  where forderNum = T_ER_ReimburseEntry.fordernum )
where  FSettlementtype = '2' and FOrderFormID = 'er_hotelbill'    and exists (select 1 from T_ER_ReimburseBill where fid = (select  fid from   T_ER_ReimburseTripEntry where fentryid = T_ER_ReimburseEntry.fentryid)
and fbillkind = '0' );
