sqlWhere+=" and a.subcompanyid1 in("+subCompanyId+") ";
}
if(departmentId.length()>0){
sqlWhere+=" and a.departmentid in("+departmentId+") ";
}
if(resourceId.length()>0){
sqlWhere+=" and b.resourceid in("+resourceId+") ";
}
if(viewScope.equals("4")){//我的下属
if(allLevel.equals("1")){//所有下属
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
}else{
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
}
}
if(!"1".equals(isNoAccount)){
sqlWhere+=" and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
}
sql=" select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) "+
"and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND groupid = "+
"(select top 1 groupid from kq_shiftschedule where resourceid = b.resourceid and serialid = b.serialid and kqdate = b.belongdate)) "+sqlWhere+
" group by resourceid, newleavetype, durationrule ";
@ -379,7 +472,10 @@ public class KQReportBiz extends BaseBean {
}
sql=" select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) "+sqlWhere+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and "+
"(DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 "+
"AND groupid = (select top 1 groupid from kq_shiftschedule where resourceid = b.resourceid "+
" and serialid = b.serialid and kqdate = b.belongdate)) "+sqlWhere+
" group by resourceid, newleavetype, durationrule ";
rs.execute(sql);
while(rs.next()){
@ -416,6 +512,100 @@ public class KQReportBiz extends BaseBean {
sqlWhere+=" and a.subcompanyid1 in("+subCompanyId+") ";
}
if(departmentId.length()>0){
sqlWhere+=" and a.departmentid in("+departmentId+") ";
}
if(resourceId.length()>0){
sqlWhere+=" and b.resourceid in("+resourceId+") ";
}
if(viewScope.equals("4")){//我的下属
if(allLevel.equals("1")){//所有下属
sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'";
}else{
sqlWhere+=" and a.managerid="+user.getUID();//直接下属
}
}
if(!"1".equals(isNoAccount)){
sqlWhere+=" and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' ");
}
sql=" select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) "+
"and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND groupid = "+
"(select top 1 groupid from kq_shiftschedule where resourceid = b.resourceid and serialid = b.serialid and kqdate = b.belongdate)) "+sqlWhere+
" group by resourceid, newleavetype, durationrule,belongdate ";
@ -473,7 +663,9 @@ public class KQReportBiz extends BaseBean {
}
sql=" select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) "+sqlWhere+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) "+
"and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND groupid = "+
"(select top 1 groupid from kq_shiftschedule where resourceid = b.resourceid and serialid = b.serialid and kqdate = b.belongdate)) "+sqlWhere+
" group by resourceid, newleavetype, durationrule,belongdate ";
StringbackFields=" (select sum(workdays) from kq_format_total where resourceid = a.id and kqdate >='" +fromDate+"' and kqdate <='" +toDate+"' and (DATEPART(dw, kqdate) = 7 or DATEPART(dw, kqdate) = 1)) as saturdayworkdays," +
StringbackFields=" (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" +fromDate+"' and zma.kqdate <='" +toDate+"' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayworkdays," +
" (select count(0) from kq_shiftschedule where resourceid = a.id and kqdate >='"+fromDate+"' and kqdate <='"+toDate+"' and serialid="+supportSerId+" )as supportTotal,"+
" (select sum(attendancedays) from kq_format_total where resourceid = a.id and kqdate >='" +fromDate+"' and kqdate <='" +toDate+"' and (DATEPART(dw, kqdate) = 7 or DATEPART(dw, kqdate) = 1)) as saturdayattendancedays," +
" (select sum(workdays) from kq_format_total where resourceid = a.id and kqdate >='" +fromDate+"' and kqdate <='" +toDate+"' and DATEPART(dw, kqdate) != 7 and DATEPART(dw, kqdate) != 1) as weekdayworkdays," +
" (select sum(attendancedays) from kq_format_total where resourceid = a.id and kqdate >='" +fromDate+"' and kqdate <='" +toDate+"' and DATEPART(dw, kqdate) != 7 and DATEPART(dw, kqdate) != 1) as weekdayattendancedays," +
" (select sum(zma.attendancedays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" +fromDate+"' and zma.kqdate <='" +toDate+"' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayattendancedays," +
" (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" +fromDate+"' and zma.kqdate <='" +toDate+"' and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayworkdays," +
" (select sum(zma.attendancedays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" +fromDate+"' and zma.kqdate <='" +toDate+"' and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayattendancedays," +
"a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle,"+
" sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays,"+
" sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, "+
@ -329,6 +329,10 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {