日期:2014-05-17 浏览次数:20502 次
select NEWID()
,SBI.StaffCode --座席编号
,SBI.StaffName --座席姓名
,tas.AmtSor*@SreOfTra --话务数量
,aqt.ActualScore * @SreOfQua --话务质量
,sp.PecScr * @SreOfPer --员工表现
,(tas.AmtSor * @SreOfTra + aqt.ActualScore * @SreOfQua + sp.PecScr * @SreOfPer) --汇总后总分
,convert(varchar(7),@MonthDate,20)
,GETDATE()
,@GroupNo
,(CASE WHEN (tas.AmtSor * @SreOfTra + aqt.ActualScore * @SreOfQua + sp.PecScr * @SreOfPer) >= @SceOfPas THEN '是' ELSE '否' END)
from (select * from StaffBaseInfo where AgtGrpCode = @GroupNo) SBI
left join (select StaffCode, ActualScore from AgtQuaTimes where QuaDate = convert(varchar(7),@MonthDate,20)) aqt
on SBI.StaffCode = aqt.StaffCode and (select AgtGrpCode from StaffBaseInfo sbi where sbi.StaffCode = aqt.StaffCode) = @GroupNo
left join (select StaffCode, AmtSor from TraAmtScore where TraDate= convert(varchar(7),@MonthDate,20)) tas
on SBI.StaffCode = tas.StaffCode and AgtGrpCode = @GroupNo
left join (select AgtCode, PecScr from StaffPec where convert(varchar(7),PecDate,20) = convert(varchar(7),@MonthDate,20)) sp
on SBI.DKCode = sp.AgtCode and AgtGrpCode = @GroupNo
select NEWID()
,SBI.StaffCode --座席编号
,SBI.StaffName --座席姓名
,tas.AmtSor*@SreOfTra --话务数量
,aqt.ActualScore * @SreOfQua --话务质量
,sp.PecScr * @SreOfPer --员工表现
,(tas.AmtSor * @SreOfTra + aqt.ActualScore * @SreOfQua + sp.PecScr * @SreOfPer) --汇总后总分
,convert(varchar(7),@MonthDate,20)
,GETDATE()
,@GroupNo
,(CASE WHEN (tas.AmtSor * @SreOfTra + aqt.ActualScore * @SreOfQua + sp.PecScr * @SreOfPer) >= @SceOfPas THEN '是' ELSE '否' END)
from StaffBaseInfo SBI
left join AgtQuaTimes aqt
on QuaDate = convert(varchar(7),@MonthDate,20)
and SBI.StaffCode = aqt.StaffCode
--and AgtGrpCode = @GroupNo
left j