<html xmlns="http://www.w3.org/1999/xhtml">
<!--#include file="../Inc/Conn.asp" -->
<!--#include file="../Inc/SK.Session.asp" -->
<!--#include file="../Inc/SK.Funtion.asp" -->
<%if Not (Getconfig("SK_Client")="0" AND (Session("Manager")="1" OR (JudgePopedomTF(Session("UserName"),"SK200000000") AND JudgePopedomTF(Session("UserName"),"SK200000300")))) then Call ReturnError()%>
<%
if not isnumeric(JCID(F("ID"))) then Call ReturnError10()
set rs=server.createobject("adodb.recordset")
if Session("Manager")=1 or Session("Manager")=2 then
sql="SELECT * from SK_Follow where SK_Del=0 and SK_ClientID="&JCID(F("ID"))&" order by FollowID desc"
elseif Session("Manager")=3 then
sql="SELECT * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where SK_Follow.SK_Del=0 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_Follow.SK_ClientID="&JCID(F("ID"))&" order by SK_Follow.FollowID desc"
elseif Session("Manager")=4 then
sql="SELECT * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where SK_Follow.SK_Del=0 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_Follow.SK_ClientID="&JCID(F("ID"))&" order by SK_Follow.FollowID desc"
elseif Session("Manager")=5 then
sql="SELECT * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where SK_Follow.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_Follow.SK_ClientID="&JCID(F("ID"))&" order by SK_Follow.FollowID desc"
elseif Session("Manager")=6 then
sql="SELECT * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where SK_Follow.SK_Del=0 and SK_Client.SK_SalesID="&Session("UID")&" and SK_Follow.SK_ClientID="&JCID(F("ID"))&" order by SK_Follow.FollowID desc"
end if
rs.Open sql,conn,1,1
if rs.eof and rs.bof then Call ReturnError4()

'Delete begin
if F("Bid")<>"" and RQ("Action")="Del" and (Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK200000304")) then
if Session("Manager")=1 or Session("Manager")=2 then
conn.execute("delete from SK_FollowReply where RFollowID in("&F("Bid")&")")
elseif Session("Manager")<>1 or Session("Manager")<>2 then
conn.execute("delete from SK_FollowReply where SK_SalesID="&Session("UID")&" and RFollowID in("&F("Bid")&")")
end if
'Event Begin
if getconfig("SK_Event")=0 then
set rsEvent=server.createobject("adodb.recordset")
sqlEvent="select * from SK_SystemEvent"
rsEvent.open sqlEvent,conn,1,3
rsEvent.AddNew
rsEvent("SK_Title")="删除跟进点评"
rsEvent("SK_User")=Session("UserName")
rsEvent("SK_Time")=Now()
rsEvent("SK_IP")=request.ServerVariables("Remote_Addr")
rsEvent.Update
rsEvent.Close 
set rsEvent=Nothing
end if
'Event End

Call Returnokback()
end if
'Delete End
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<title>查看客户跟进</title>
<META http-equiv=Page-Enter content=SKCRM>
<META http-equiv=Page-Exit content=SKCRM>
<META content="MSHTML 6.00.3790.2858" name=GENERATOR>
<LINK href="../images/style.css" type=text/css rel=stylesheet>
<script language="javascript" src="../Inc/Check.js"></script>
<script language="javascript" src="../Inc/Calendar.js"></script>
<script language="javascript" src="../Inc/jquery.js"></script>
<style type="text/css">
<!--
body {
margin: 5px 0px 5px 0px;
overflow-x: hidden;
}
-->
</style>
</head>
<body>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<TBODY>
<tr>
<td class="SK_Td_Top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="12" height="25"><img src="../images/tab_03.gif" width="12" height="25" /></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="46%" valign="middle"><%
set rsClient=server.createobject("adodb.recordset")
sqlClient="select * from SK_Client where ClientID="&Rs("SK_ClientID")&""
rsClient.open sqlClient,conn,1,1
if rsClient.eof and rsClient.bof then Call ReturnError12()
Response.write""&RsClient("SK_Wname")&""
RsClient.close
Set RsClient=Nothing
%></td>
<td width="54%"></td>
</tr>
</table></td>
<td width="16"><img src="../images/tab_07.gif" width="16" height="25" /></td>
</tr>
</table></td>
</tr>
<tr>
<td>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8" background="../images/tab_12.gif"></td>
<td>

<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="b5d6e6">
<tr>
  <td colspan="4" class="SK_Title1">跟进列表</td>
</tr>
<%
P=0
while not rs.eof
P=P+1
%>
<tr>
  <td width="12%" rowspan="3" class="SK_Text"><%=split(Rs("SK_Ftime"))(0)%></td>
  <td width="88%" colspan="3" class="SK_Text1"><font color=#0066CC>跟进主题：<%=Rs("SK_Ftitle")%> [ 跟进人：<%
set rsSales=server.createobject("adodb.recordset")
sqlSales="select * from SK_SystemUsers where UsersID="&Rs("SK_SalesID")&""
rsSales.open sqlSales,conn,1,1
if rsSales.eof and rsSales.bof then Call ReturnError16()
Response.write""&RsSales("SK_OName")&""
RsSales.close
RsSales=Nothing
%>  |  对方联系人：<%
set rsLinkman=server.createobject("adodb.recordset")
sqlLinkman="select * from SK_Linkman where LinkmanID="&Rs("SK_LinkmanID")&""
rsLinkman.open sqlLinkman,conn,1,1
if rsLinkman.eof and rsLinkman.bof then Call ReturnError14()
Response.write""&RsLinkman("SK_LName")&""
RsLinkman.close
RsLinkman=Nothing
%> ] (<%if Rs("SK_Di")="1" then Response.write"已经跟进" else Response.write"<font color=red>计划跟进</font>" end if%>)</font> 
<%if Session("Manager")<>6 AND Rs("SK_SalesID")<>Session("UID") AND (Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK200000304")) then%>
<a href="javascript:void(0)" onClick="javascript:var win=window.open('SK.AddDP.asp?ID=<%=Rs("FollowID")%>','AddDP','width=820,height=400,top=170,left=161,center:yes,status:no,help:no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes'); win.focus()"><img src="../images/Add.gif" title="新建点评" /></a>
<%end if%> </td>
</tr>

<tr>
  <td colspan="3" class="SK_Text1"><font color=#0066CC>跟进内容：<%=Rs("SK_Fcontent")%></font></td>
</tr>
<tr>
  <td colspan="3" class="SK_Text1"><%
Dim RsRFollow,K
set RsRFollow=Server.createobject("adodb.recordset")
sql2="select * from SK_FollowReply where SK_FollowID="&Rs("FollowID")&" and SK_Del=0 order by RFollowID desc"
RsRFollow.open sql2,conn,1,1
if RsRFollow.bof and RsRFollow.eof then
Response.write"<font color=#999999>对不起,暂时还没有点评！</font>"
else
K=0
while not RsRFollow.eof
K=K+1
%>
<font color=red>
点评：
<%=RsRFollow("SK_FollowReplyContent")%>  [ 时间：<%=RsRFollow("SK_Atime")%>  点评人：<%
set rsUser=server.createobject("adodb.recordset")
sqlUser="select * from SK_SystemUsers where UsersID="&RsRFollow("SK_SalesID")&""
rsUser.open sqlUser,conn,1,1
if rsUser.eof and rsUser.bof then Call ReturnError16()
Response.write""&RsUser("SK_OName")&""
RsUser.close
RsUser=Nothing
%>] 
<%if Session("Manager")<>6 AND RsRFollow("SK_SalesID")=Session("UID") AND (Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK200000304")) then%>
( <a href="javascript:void(0)" onClick="javascript:var win=window.open('SK.ModDP.asp?ID=<%=RsRFollow("RFollowID")%>','ModDP','width=820,height=400,top=170,left=161,center:yes,status:no,help:no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes'); win.focus()">修改</a> | <a onClick="return confirm('此操作将无法恢复,确定要删除此记录吗？')" href="?Action=Del&ID=<%=F("ID")%>&Bid=<%=RsRFollow("RFollowID")%>">删除</a> )</font>
<%end if%>
<br>
<%
RsRFollow.movenext
wend
RsRFollow.close
set RsRFollow=Nothing
%>
<%end if%>	
</td>
</tr>
<%
rs.movenext
wend
rs.close
set rs=Nothing
%>
<tr>
<td colspan="4" class="SK_Text">
<input type="button" value=" 关闭 " onClick="window.opener.location.reload();window.close();" class="button1" /></td>
</tr>
</table>

</td>
<td width="8" background="../images/tab_15.gif"></td>
</tr>
</table></td>
</tr>
<tr>
<td class="SK_Td_Foot">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" height="20"><img src="../images/tab_18.gif" width="12" height="20" /></td>
<td width="98%" class="SK_Td_Page"></td>
<td width="1%"><img src="../images/tab_20.gif" width="16" height="20" /></td>
</tr>
</table>
	
</td>
</tr>
</TBODY>
</table>
</body>
<%
Call CloseDB()
%>
</html>