年假不小心結轉到下一年,反結轉修復腳本:

1.修改編碼爲0001的年假規則人員的2009年的年假數據爲未結轉狀態
update t_hr_yvbalance set fstatus = 0 where  
fpersonid in  
(  
select fpersonid from T_HR_YVPerson yperson  
inner join T_HR_YVRule yrule on yrule.fid = yperson.FYvRuleID  
where yrule.Fnumber='1004'  
)  
and fyear=2012  

2.刪除編碼爲00001的年假規則的年假人員2010年的年假數據
delete from t_hr_yvbalance  
where fpersonid in  
(  
select fpersonid from T_HR_YVPerson yperson  
inner join T_HR_YVRule yrule on yrule.fid = yperson.FYvRuleID  
where yrule.Fnumber='1004'  
)  
and fyear = 2013  

說明:  
1.以上兩段腳本的執行順序是可以任意的。  
2.yrule.Fnumber 年假規則編碼  
3.修改的這段腳本,這裏的fyear填寫的是需要恢復的當前年假  
4.刪除的這段腳本,這裏的fyear填寫的是需要刪除的年假  
5.例如不小心結轉到了2010年,需要返回2009年,且年假規則的編碼是00001,則使用以上的腳本進行處理。


找出數據爲0的人員,

select * from t_hr_yvbalance where fyear=2012 and
select fid,fname_l2 from t_bd_person where fnumber = 'DJ20110201292'
or fnumber = 'DJ20110801705'
然後刪除這些人員的年假數據。

delete  t_hr_yvbalance
where fyear=2012 and fpersonid in   (select fid from t_bd_person where fnumber = 'DJ20110201292'
or fnumber = 'DJ20110801705')

發佈了24 篇原創文章 · 獲贊 3 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章