<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
|
<%Session.CodePage=65001%>
|
<!--#include virtual="/inc/chkadmin.gds"-->
|
<!--#include virtual="/inc/function.gds"-->
|
<script language=javascript>
|
var EntourageListArray=new Array()
|
<%
|
EntourageSearchTXT=trim(Request("EntourageSearchTXT"))
|
OA_CompetencyID=trim(Request("OA_CompetencyID"))
|
DateDay=trim(Request("DateDay"))
|
OrdClass=trim(Request("OrdClass"))
|
HospID=trim(Request("HospID"))
|
acc1=trim(Request("page"))
|
Response.Write "11"
|
if acc1="" then acc1=1
|
'if admin_OrderClass<>"" And (OrdClass="" or Not IsNumeric(OA_CompetencyID)) then
|
if admin_OrderClass<>"" then
|
if OA_CompetencyID="ServiceOrdIntroducer" then
|
ClassSql=" and ("
|
UnitClassSql=" and ("
|
else
|
ClassSql=" and (OA_Power like '%,020114,%' or "
|
UnitClassSql=" and (OA_Power like '%,020114,%' or "
|
end if
|
admin_OrderClassPS = SPLIT(admin_OrderClass,",")
|
for s = 0 to UBOUND(admin_OrderClassPS)
|
if admin_OrderClassPS(s)<>"" then
|
if InStr(ClassSql,"OA_OrderClass")<=0 then
|
ClassSql=ClassSql&" OA_OrderClass like '%"&admin_OrderClassPS(s)&"%' "
|
UnitClassSql=UnitClassSql&" IntroducerOrdClass like '%"&admin_OrderClassPS(s)&"%' "
|
else
|
ClassSql=ClassSql&" or OA_OrderClass like '%"&admin_OrderClassPS(s)&"%' "
|
UnitClassSql=UnitClassSql&" or IntroducerOrdClass like '%"&admin_OrderClassPS(s)&"%' "
|
end if
|
end if
|
Next
|
ClassSql=ClassSql&")"
|
UnitClassSql=UnitClassSql&")"
|
ElseIf OrdClass<>"" Then '排序优化方案B 只显示当前地区人员(22.11.19)
|
ClassSql=" and (OA_OrderClass like '%"&OrdClass&"%')"
|
UnitClassSql=" and (IntroducerOrdClass like '%"&OrdClass&"%')"
|
end If
|
if OrdClass="" then OrdClass="SA"
|
acc2=1
|
i=0
|
|
Set rs = Server.CreateObject("ADODB.Recordset")
|
Set rsDt = Server.CreateObject("ADODB.Recordset")
|
if OA_CompetencyID="ServiceOrdIntroducer" then
|
if len(EntourageSearchTXT)>0 and EntourageSearchTXT<>"Schedules" then SQLSearch=" and (IntroducerName like '%"&EntourageSearchTXT&"%' or IntroducerTEL='"&EntourageSearchTXT&"')"
|
sql="select OA_User_ID=IntroducerID,OA_Name=IntroducerName,OA_mobile=IntroducerTEL,OA_weixinAvatar='',OA_Img='',OA_Img_64='',OA_UserRemark='',SchedulesTypeManeuver=0,aa=10002,IntroducerUnitID from IntroducerData where IntroducerState=1"&UnitClassSql&SQLSearch
|
elseif len(EntourageSearchTXT)>0 and EntourageSearchTXT<>"Schedules" then
|
sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=10002,SchedulesTypeManeuver=0 from OA_User where (OA_Name like '%"&EntourageSearchTXT&"%' or OA_mobile='"&EntourageSearchTXT&"') and OA_execLevel>=0 and OA_execLevel<=2"&ClassSql&" order by OA_User_ID"
|
elseif OA_CompetencyID="me" then
|
sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=10002,SchedulesTypeManeuver=0 from OA_User where OA_User_ID="&session("adminID")&" and OA_execLevel>=0 and OA_execLevel<=2 order by OA_User_ID"
|
elseif OA_CompetencyID="OrdSendOA" then
|
HospOAIDs=""
|
if HospID<>"" then
|
sql="select HospOAID from HospData where HospOAID<>'' and HospID in ("&HospID&")"
|
rs.open Sql,objConn,1,1
|
do while not rs.Eof
|
HospOAID = rs("HospOAID")
|
if Left(HospOAID,1)="," then HospOAID=mid(HospOAID,2)
|
if Right(HospOAID,1)="," then HospOAID=mid(HospOAID,1,len(HospOAID)-1)
|
HospOAIDs=HospOAIDs&","&HospOAID
|
rs.movenext
|
loop
|
rs.close()
|
end if
|
if HospOAIDs<>"" then
|
HospOAIDs=mid(HospOAIDs,2)
|
HospOASql=" or OA_User_ID in ("&HospOAIDs&") "
|
elseif instr(admin_OrderClass,"BF")>0 or instr(admin_OrderClass,"SA")>0 then
|
HospOASql=" or OA_Position like '%外联部领导%' "
|
end if
|
sql="select OA_User_ID,OA_Name=OA_Name+'('+vtext+')',OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=10002,SchedulesTypeManeuver=0 from OA_User,dictionary where vtitle='OA_Department' and vID=OA_DepartmentID and ((OA_Power like '%,020113,%' and OA_OrderClass like '%"&OrdClass&"%')"&HospOASql&") and OA_execLevel>=0 and OA_weixinStatus=1 order by OA_User_ID"
|
elseif OA_CompetencyID<0 then
|
departmentID=Abs(OA_CompetencyID)
|
'if departmentID="10" then departmentID="10,18"
|
sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=10002,SchedulesTypeManeuver=0 from OA_User where OA_DepartmentID in ("&departmentID&") and OA_execLevel>=0 and OA_execLevel<=2"&ClassSql&" order by OA_User_ID"
|
else
|
'sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark from OA_User,OA_Competency where OA_User_ID=OA_CompetencyUserID and OA_CompetencyID="&OA_CompetencyID&" and OA_execLevel>=0 and OA_execLevel<=2"&ClassSql&" order by OA_User_ID"
|
'if DateDay="" then DateDay=now()
|
DateDay=now()
|
TimeDay=CDate(DateDay)
|
DateDay=CDate(year(DateDay)&"-"&month(DateDay)&"-"&day(DateDay))
|
SameDay=DateDiff("n",CDate(year(TimeDay)&"-"&month(TimeDay)&"-"&day(TimeDay)&" 8:30:00"),TimeDay)
|
'早夜班而17:30为界到明天8:30
|
If SameDay>=0 And SameDay<=540 Then
|
SchedulesShiftID=1
|
ElseIf SameDay<0 Then
|
SchedulesShiftID=2
|
DateDay=DateAdd("d",-1,DateDay)
|
Else
|
SchedulesShiftID=2
|
End If
|
'休上午下午,13:00为界
|
If SameDay>=0 And SameDay<=270 Then
|
SqlAMPM=" and SchedulesTypeAM=0 "
|
elseif SameDay>270 And SameDay<=540 Then
|
SqlAMPM=" and SchedulesTypePM=0 "
|
end if
|
if EntourageSearchTXT="Schedules" then
|
sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=(isnull(SchedulesShiftTOP,10000)+1+isnull((select top 1 5000 from DispatchOrd_Entourage,DispatchOrd where DispatchOrdID=DispatchOrdIDDt and EntourageState<>4 and DispatchOrdState not in (10,14) and EntourageEnd_Time is null and DATEDIFF(d,EntourageState_Time,GETDATE())<3 and EntourageOAid=OA_User_ID),0)+isnull((select top 1 DateDiff(n,'"&DateDay&" 8:30:00',EntourageEnd_Time) from DispatchOrd_Entourage,DispatchOrd where DispatchOrdID=DispatchOrdIDDt and EntourageState<>4 and DispatchOrdState not in (10,14) and EntourageEnd_Time between '"&DateDay&" 8:30:00' and '"&DateAdd("d",1,DateDay)&" 8:29:59' and EntourageOAid=OA_User_ID),0)),SchedulesTypeManeuver=isnull(SchedulesTypeManeuver,0) from OA_User LEFT JOIN OA_Schedules on OAid=OA_User_ID and SchedulesDate='"&DateDay&"' and CompetencyID="&OA_CompetencyID&" and SchedulesShiftID="&SchedulesShiftID&" ,OA_Competency where OA_User_ID=OA_CompetencyUserID and OA_CompetencyID="&OA_CompetencyID&" and OA_execLevel in (0,1,2)"&ClassSql&" and SchedulesShiftTOP is not null order by SchedulesTypeManeuver desc,aa,OA_User_ID"
|
'取消部分排序算法(22.11.19) 排序优化方案A
|
sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=(isnull(SchedulesShiftTOP,10000)+1),SchedulesTypeManeuver=isnull(SchedulesTypeManeuver,0) from OA_User LEFT JOIN OA_Schedules on OAid=OA_User_ID and SchedulesDate='"&DateDay&"' and CompetencyID="&OA_CompetencyID&" and SchedulesShiftID="&SchedulesShiftID&" ,OA_Competency where OA_User_ID=OA_CompetencyUserID and OA_CompetencyID="&OA_CompetencyID&" and OA_execLevel in (0,1,2)"&ClassSql&" and SchedulesShiftTOP is not null order by SchedulesTypeManeuver desc,aa,OA_User_ID"
|
else
|
sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=(isnull(SchedulesShiftTOP,10000)+1+isnull((select top 1 5000 from DispatchOrd_Entourage,DispatchOrd where DispatchOrdID=DispatchOrdIDDt and EntourageState<>4 and DispatchOrdState not in (10,14) and EntourageEnd_Time is null and DATEDIFF(d,EntourageState_Time,GETDATE())<3 and EntourageOAid=OA_User_ID),0)+isnull((select top 1 DateDiff(n,'"&DateDay&" 8:30:00',EntourageEnd_Time) from DispatchOrd_Entourage,DispatchOrd where DispatchOrdID=DispatchOrdIDDt and EntourageState<>4 and DispatchOrdState not in (10,14) and EntourageEnd_Time between '"&DateDay&" 8:30:00' and '"&DateAdd("d",1,DateDay)&" 8:29:59' and EntourageOAid=OA_User_ID),0)),SchedulesTypeManeuver=isnull(SchedulesTypeManeuver,0) from OA_User LEFT JOIN OA_Schedules on OAid=OA_User_ID and SchedulesDate='"&DateDay&"' and CompetencyID="&OA_CompetencyID&" and SchedulesShiftID="&SchedulesShiftID&" ,OA_Competency where OA_User_ID=OA_CompetencyUserID and OA_CompetencyID="&OA_CompetencyID&" and OA_execLevel in (0,1,2)"&ClassSql&" order by SchedulesTypeManeuver desc,aa,OA_User_ID"
|
'取消部分排序算法(22.11.19) 排序优化方案A
|
sql="select OA_User_ID,OA_Name,OA_mobile,OA_weixinAvatar,OA_Img,OA_Img_64,OA_UserRemark,aa=(isnull(SchedulesShiftTOP,10000)+1),SchedulesTypeManeuver=isnull(SchedulesTypeManeuver,0) from OA_User LEFT JOIN OA_Schedules on OAid=OA_User_ID and SchedulesDate='"&DateDay&"' and CompetencyID="&OA_CompetencyID&" and SchedulesShiftID="&SchedulesShiftID&" ,OA_Competency where OA_User_ID=OA_CompetencyUserID and OA_CompetencyID="&OA_CompetencyID&" and OA_execLevel in (0,1,2)"&ClassSql&" order by SchedulesTypeManeuver desc,aa,OA_User_ID"
|
end If
|
'Response.Write sql
|
|
end if
|
|
rs.open Sql,objConn,1,1
|
if not rs.eof then
|
if EntourageSearchTXT="Schedules" then
|
j=100
|
else
|
j=10
|
end if
|
rs.pagesize=j
|
rs.absolutepage=acc1
|
acc2=rs.pagecount
|
end if
|
do while not rs.Eof and i<j
|
OA_UserID = rs("OA_User_ID")
|
OA_Name = rs("OA_Name")
|
OA_mobile = rs("OA_mobile")
|
OA_weixinAvatar = rs("OA_weixinAvatar")
|
OA_Img = rs("OA_Img")
|
OA_Img = rs("OA_Img_64")
|
OA_UserRemark = rs("OA_UserRemark")
|
If OA_Img="" Or isnull(OA_Img) Then
|
If OA_weixinAvatar<>"" Then
|
'OA_weixinAvatar=OA_weixinAvatar&"64"
|
Else
|
OA_weixinAvatar="/resources/images/icon_avatar_default.png"
|
End if
|
Else
|
OA_weixinAvatar = OAImgURL&OA_Img
|
End If
|
|
OA_weixinAvatar=replace(OA_weixinAvatar,"\","\\")
|
|
'if rs("aa")<10001 then OA_Name=OA_Name&" "&rs("aa")
|
if rs("SchedulesTypeManeuver")="1" then
|
if OA_CompetencyID="2" then
|
OA_Name=OA_Name&"[加班]"
|
else
|
OA_Name=OA_Name&"[机动]"
|
end if
|
|
elseif rs("SchedulesTypeManeuver")="-1" then
|
OA_Name=OA_Name&"[不加班]"
|
end if
|
if rs("aa")<10001 then
|
sql="select top 1 DispatchOrdIDDt from DispatchOrd_Entourage,DispatchOrd where DispatchOrdID=DispatchOrdIDDt and EntourageState<>4 and DispatchOrdState not in (8,9,10,14) and EntourageEnd_Time is null and DATEDIFF(d,EntourageState_Time,GETDATE())<3 and EntourageOAid="&OA_UserID
|
rsDt.open Sql,objConn,1,1
|
if not rsDt.Eof then
|
OA_Name="<img src=/resources/images/2016090802.png>"&OA_Name
|
elseif rs("SchedulesTypeManeuver")<>"-1" then
|
OA_Name="<img src=/resources/images/2016090803.png>"&OA_Name
|
end if
|
rsDt.close()
|
end if
|
if OA_UserRemark<>"" then OA_Name=OA_Name&"("&OA_UserRemark&")"
|
if instr(OA_Name,"--")>0 and instr(OA_Name,")")>0 then OA_Name=mid(OA_Name,1,instr(OA_Name,"--")-1)& mid(OA_Name,instr(OA_Name,")"))
|
%>
|
EntourageListArray[<%=i%>]=new Array("<%=OA_UserID%>","<%=OA_Name%>","<%=OA_mobile%>","<%=OA_weixinAvatar%>")
|
<%i=i+1
|
rs.movenext
|
loop
|
rs.close()
|
if OA_CompetencyID="ServiceOrdIntroducer" then
|
OA_CompetencyName="ServiceOrdIntroducer"
|
elseif OA_CompetencyID="OrdSendOA" then
|
OA_CompetencyName="OrdSendOA"
|
elseif OA_CompetencyID="me" then
|
OA_CompetencyName="me"
|
else
|
OA_CompetencyName=OACompetency(OA_CompetencyID,"CompetencyName")
|
end if
|
%>
|
parent.JS_EntourageList(EntourageListArray,<%=acc1%>,<%=acc2%>,'<%=EntourageSearchTXT%>','<%=OA_CompetencyID%>','<%=OA_CompetencyName%>');
|
</script>
|
<%Response.End%>
|