工作流中如何取请假开始时间所处年度的当年病假总时长、当年事假总时长、当月事假总时长、工龄和职务族
问题:如何取请假开始时间所处年度的当年病假总时长、当年事假总时长、当月事假总时长、工龄和职务族
处理方案:工作流脚本处理
操作步骤如下:
1、定义流程变量
2、在提交节点后置脚本,贴入如下脚本
//输出参数:bjzsc 当年病假总时长
//输出参数:sjzsc 当年事假总时长
//输出参数:dysjzsc 当月事假总时长
SimpleDateFormat sdf = new java . text . SimpleDateFormat ( "yyyy-MM-dd" ) ;
String sd = sdf . format ( bizObj.entries.beginTime) ; //基准日期为请假开始时间
java . sql . Connection con = com . kingdee . bos . framework . ejb . EJBFactory . getConnection ( __bosContext ) ;
java . sql . Statement st = con . createStatement ( ) ;
java . sql . ResultSet rs = null ;
String tsql = "select sum(case when b.fname_l2='病假' then a.FLEAVELENGTH else 0 end ) bjzsc, " ;
tsql = tsql + "sum(case when b.fname_l2='事假' then a.FLEAVELENGTH else 0 end ) sjzsc, " ;
tsql = tsql + "sum(case when b.fname_l2='事假' and (month(a.FBeginTIME)=month({ts '"+sd+"'}) or month(a.FEndTIME)=month({ts '"+sd+"'})) then a.FLEAVELENGTH else 0 end ) dysjzsc " ;
tsql = tsql + "from t_hr_Ats_leavebillentry a " ;
tsql = tsql + "inner join t_hr_atS_holidaypolicy b on a.fpolicyid=b.fid and a.fpersonid='" + bizObj.entries.person.id+ "' " ;
tsql = tsql + "inner join t_hr_AtS_leavebill c on a.fbillid=c.fid and fbillstate in(1,2,3) " ;
tsql = tsql + "where year(a.FBeginTIME)=year({ts '"+sd+"'}) or year(a.FEndTIME)=year({ts '"+sd+"'}) " ;
fsql=tsql;
rs = st . executeQuery ( tsql ) ;
if ( rs . next ) {
bjzsc = rs . getDouble ( "bjzsc" ) ;
sjzsc = rs . getDouble ( "sjzsc" ) ;
dysjzsc = rs . getDouble ( "dysjzsc" ) ;
}
//输出参数gl 工龄
String tsql1=" select FSocialServiceYears from T_HR_PERSONOTHERINFO where fpersonid='" + bizObj.entries.person.id+ "' ";
fsql=fslq+tsql1;
rs = st . executeQuery ( tsql1 ) ;
if ( rs . next ) {
gl = rs . getString ( 1 ) ;
}
//输出参数zwz 职务族
String tsql2="select fname_l2 from T_HR_HRJobFamily where fid in(select FHRJOBFAMILYID from T_HR_HRJob where fid in(select FHRJobID from t_hr_positionextend where FPOSITIONID ='"+bizObj.entries.position.id+"')) ";
fsql=fslq+tsql2;
rs = st . executeQuery ( tsql2 ) ;
if ( rs . next ) {
zwz = rs . getString ( 1 ) ;
}
com . kingdee . util . db . SQLUtils . cleanup ( st , con ) ;
com . kingdee . util . db . SQLUtils . cleanup ( con ) ;
3、执行效果如下
工作流中如何取请假开始时间所处年度的当年病假总时长、当年事假总时长、当月事假总时长、工龄和职务族
本文2024-09-22 21:36:30发表“s-hr cloud知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-shr-121165.html