<!--#include file="../Inc/Conn.asp" -->
<!--#include file="../Inc/SK.Session.asp" -->
<!--#include file="../Inc/SK.Funtion.asp" -->
<%if Not (Getconfig("SK_Sales")="0" AND (Session("Manager")="1" OR (JudgePopedomTF(Session("UserName"),"SK300000000") AND JudgePopedomTF(Session("UserName"),"SK300000804")))) then Call ReturnError()%>
<%
Dim i,str2

'导出客户服务信息到Excel开始
Response.Buffer = True 
Response.ContentType = "application/vnd.ms-excel" 
SaveFilename=replace(replace(replace(now,":","")," ",""),"/","")
Thead="SK_Services_"
Response.AddHeader "content-disposition", "inline; filename = "&Thead&SaveFilename&".xls"

Response.Write("<table width=""100%"" align=""center"" cellpadding=""3"" cellspacing=""1"" border=""1"">"&VBCrlf)
Response.Write("<tr bgcolor=""#E8E8E8"">"&VBCrlf)
Response.Write("<td width=""12%""><b>客服编号</b></td>")
Response.Write("<td width=""9%""><b>客服主题</b></td>")
Response.Write("<td width=""9%""><b>关联客户</b></td>")
Response.Write("<td width=""9%""><b>客服日期</b></td>")
Response.Write("<td width=""9%""><b>客服类别</b></td>")
Response.Write("<td width=""9%""><b>客服状态</b></td>")
Response.Write("<td width=""9%""><b>紧急程度</b></td>")
Response.Write("<td width=""5%""><b>客服方式</b></td>")
Response.Write("<td width=""5%""><b>负责人员</b></td>")
Response.Write("<td width=""5%""><b>所用时间</b></td>")
Response.Write("<td width=""10%""><b>客服人员</b></td>")
Response.Write("<td width=""10%""><b>创建时间</b></td>")
Response.Write("<td width=""5%""><b>客服备注</b></td>")
Response.Write("<td width=""5%""><b>处理意见</b></td>")
Response.Write("<td width=""5%""><b>处理结果</b></td>")
Response.Write("</tr>"&VBCrlf)

if F("id")="" then
Set RS = Server.CreateObject("ADODB.Recordset")
if Session("Manager")=1 or Session("Manager")=2 then
sql="select * from SK_Services where SK_Del=0"
elseif Session("Manager")=3 then
sql="select * from SK_Services INNER JOIN SK_SystemUsers ON SK_Services.SK_SalesID=SK_SystemUsers.UsersID where SK_Services.SK_Del=0 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&""
elseif Session("Manager")=4 then
sql="select * from SK_Services INNER JOIN SK_SystemUsers ON SK_Services.SK_SalesID=SK_SystemUsers.UsersID where SK_Services.SK_Del=0 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&""
elseif Session("Manager")=5 then
sql="select * from SK_Services INNER JOIN SK_SystemUsers ON SK_Services.SK_SalesID=SK_SystemUsers.UsersID where SK_Services.SK_Del=0 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_SystemUsers.SK_Dept3="&Session("Dept3")&""
elseif Session("Manager")=6 then
sql="select * from SK_Services where SK_Del=0 and SK_SalesID="&Session("UID")&""
end if
RS.Open Sql,Conn,1,1
if rs.bof and rs.eof then Call ReturnError4()
K=0
while not Rs.eof
K=K+1
Response.Write("<tr bgcolor=FFFFFF>"&VBCrlf)
'-----------------------------------------
Response.Write("<td align=left>"&Rs("SK_SNo")&"</td>")
Response.Write("<td align=left>"&Rs("SK_STitle")&"</td>")

set rsClient=server.createobject("adodb.recordset")
sqlClient="select * from SK_Client where ClientID="&Rs("SK_ClientID")&""
rsClient.open sqlClient,conn,1,1
Response.Write("<td align=left>"&RsClient("SK_Wname")&"</td>")
RsClient.close
Set RsClient=nothing
Response.write"<td align=center>"&Rs("SK_ATime")&"</td>"

set RsClass=server.createobject("adodb.recordset")
SqlClass="select * from SK_SystemCategory where SK_Di=101 and CategoryID="&RS("SK_Di")&""
RsClass.open SqlClass,conn,1,1
Response.write"<td align=left>"&RsClass("SK_Name")&"</td>"
RsClass.close
Set RsClass=Nothing

set RsFeet=server.createobject("adodb.recordset")
SqlFeet="select * from SK_SystemCategory where SK_Di=103 and CategoryID="&RS("SK_Feet")&""
RsFeet.open SqlFeet,conn,1,1
Response.write"<td align=left>"&RsFeet("SK_Name")&"</td>"
RsFeet.close
Set RsFeet=Nothing

set RsLevel=server.createobject("adodb.recordset")
SqlLevel="select * from SK_SystemCategory where SK_Di=104 and CategoryID="&Rs("SK_Level")&""
RsLevel.open SqlLevel,conn,1,1
Response.write"<td align=left>"&RsLevel("SK_Name")&"</td>"
RsLevel.close
Set RsLevel=Nothing

set RsMode=server.createobject("adodb.recordset")
SqlMode="select * from SK_SystemCategory where SK_Di=102 and CategoryID="&Rs("SK_Mode")&""
RsMode.open SqlMode,conn,1,1
Response.write"<td align=left>"&RsMode("SK_Name")&"</td>"
RsMode.close
Set RsMode=Nothing

Response.Write("<td align=left>"&Rs("SK_Aname")&"</td>")

Response.Write("<td align=left>"&Rs("SK_NTime")&"</td>")

set RsSales=server.createobject("adodb.recordset")
SqlSales="select * from SK_SystemUsers where UsersID="&RS("SK_SalesID")&""
RsSales.open SqlSales,conn,1,1
Response.Write("<td align=left>"&RsSales("SK_OName")&"</td>")
RsSales.close
Set RsSales=Nothing
Response.Write("<td align=left>"&Rs("SK_Time")&"</td>")
Response.Write("<td align=left>"&Rs("SK_Content")&"</td>")
Response.Write("<td align=left>"&Rs("SK_Content1")&"</td>")
Response.Write("<td align=left>"&Rs("SK_Content2")&"</td>")
'------------------------------------------
Response.Write("</tr>"&VBCrlf)
rs.movenext
wend

elseif F("id")<>"" then '当选择有ID时输出数据开始
str2=split(F("id"),",")
for i=0 to ubound(str2)
Set Rs = Server.CreateObject("ADODB.Recordset")
if Session("Manager")=1 or Session("Manager")=2 then
sql="select * from SK_Services where SK_Del=0 and ServicesID="&trim(str2(i))
elseif Session("Manager")=3 then
sql="select * from SK_Services INNER JOIN SK_SystemUsers ON SK_Services.SK_SalesID=SK_SystemUsers.UsersID where SK_Services.SK_Del=0 and  SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_Services.ServicesID="&trim(str2(i))
elseif Session("Manager")=4 then
sql="select * from SK_Services INNER JOIN SK_SystemUsers ON SK_Services.SK_SalesID=SK_SystemUsers.UsersID where SK_Services.SK_Del=0 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_Services.ServicesID="&trim(str2(i))
elseif Session("Manager")=5 then
sql="select * from SK_Services INNER JOIN SK_SystemUsers ON SK_Services.SK_SalesID=SK_SystemUsers.UsersID where SK_Services.SK_Del=0 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_SystemUsers.SK_Dept3="&Session("Dept3")&" and SK_Services.ServicesID="&trim(str2(i))
elseif Session("Manager")=6 then
sql="select * from SK_Services where SK_Del=0 and SK_SalesID="&Session("UID")&" and ServicesID="&trim(str2(i))
end if
RS.Open Sql,Conn,1,1
Response.Write("<tr bgcolor=FFFFFF>"&VBCrlf)
'-----------------------------------------
Response.Write("<td align=left>"&Rs("SK_SNo")&"</td>")
Response.Write("<td align=left>"&Rs("SK_STitle")&"</td>")

set rsClient=server.createobject("adodb.recordset")
sqlClient="select * from SK_Client where ClientID="&Rs("SK_ClientID")&""
rsClient.open sqlClient,conn,1,1
Response.Write("<td align=left>"&RsClient("SK_Wname")&"</td>")
RsClient.close
Set RsClient=nothing
Response.write"<td align=center>"&Rs("SK_ATime")&"</td>"

set RsClass=server.createobject("adodb.recordset")
SqlClass="select * from SK_SystemCategory where SK_Di=101 and CategoryID="&RS("SK_Di")&""
RsClass.open SqlClass,conn,1,1
Response.write"<td align=left>"&RsClass("SK_Name")&"</td>"
RsClass.close
Set RsClass=Nothing

set RsFeet=server.createobject("adodb.recordset")
SqlFeet="select * from SK_SystemCategory where SK_Di=103 and CategoryID="&RS("SK_Feet")&""
RsFeet.open SqlFeet,conn,1,1
Response.write"<td align=left>"&RsFeet("SK_Name")&"</td>"
RsFeet.close
Set RsFeet=Nothing

set RsLevel=server.createobject("adodb.recordset")
SqlLevel="select * from SK_SystemCategory where SK_Di=104 and CategoryID="&Rs("SK_Level")&""
RsLevel.open SqlLevel,conn,1,1
Response.write"<td align=left>"&RsLevel("SK_Name")&"</td>"
RsLevel.close
Set RsLevel=Nothing

set RsMode=server.createobject("adodb.recordset")
SqlMode="select * from SK_SystemCategory where SK_Di=102 and CategoryID="&Rs("SK_Mode")&""
RsMode.open SqlMode,conn,1,1
Response.write"<td align=left>"&RsMode("SK_Name")&"</td>"
RsMode.close
Set RsMode=Nothing

Response.Write("<td align=left>"&Rs("SK_Aname")&"</td>")

Response.Write("<td align=left>"&Rs("SK_NTime")&"</td>")

set RsSales=server.createobject("adodb.recordset")
SqlSales="select * from SK_SystemUsers where UsersID="&RS("SK_SalesID")&""
RsSales.open SqlSales,conn,1,1
Response.Write("<td align=left>"&RsSales("SK_OName")&"</td>")
RsSales.close
Set RsSales=Nothing
Response.Write("<td align=left>"&Rs("SK_Time")&"</td>")
Response.Write("<td align=left>"&Rs("SK_Content")&"</td>")
Response.Write("<td align=left>"&Rs("SK_Content1")&"</td>")
Response.Write("<td align=left>"&Rs("SK_Content2")&"</td>")
'------------------------------------------
Response.Write("</tr>"&VBCrlf)
next
end if '当选择有ID时输出数据结束

Response.Write("</table>")

Call CloseDB()
'导出客户服务到Excel结束
%>