<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 FollowID="&JCID(F("ID"))&""
elseif Session("Manager")=3 then
sql="SELECT * from SK_Follow INNER JOIN SK_SystemUsers ON SK_Follow.SK_SalesID=SK_SystemUsers.UsersID where SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_Follow.FollowID="&JCID(F("ID"))&""
elseif Session("Manager")=4 then
sql="SELECT * from SK_Follow INNER JOIN SK_SystemUsers ON SK_Follow.SK_SalesID=SK_SystemUsers.UsersID where SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_Follow.FollowID="&JCID(F("ID"))&""
elseif Session("Manager")=5 then
sql="SELECT * from SK_Follow INNER JOIN SK_SystemUsers ON SK_Follow.SK_SalesID=SK_SystemUsers.UsersID where SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_SystemUsers.SK_Dept3="&Session("Dept3")&" and SK_Follow.FollowID="&JCID(F("ID"))&""
elseif Session("Manager")=6 then
sql="SELECT * from SK_Follow INNER JOIN SK_SystemUsers ON SK_Follow.SK_SalesID=SK_SystemUsers.UsersID where SK_Client.SK_SalesID="&Session("UID")&" and SK_Follow.FollowID="&JCID(F("ID"))&""
end if
rs.Open sql,conn,1,1
if rs.eof and rs.bof then Call ReturnError4()

'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

'Delete begin
if F("Bid")<>"" and RQ("Action")="Del" and (Session("Manager")="1" AND 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")<>6 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">查看客户跟进</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>

<tr>
  <td width="14%" class="SK_Text2">关联客户</td>
  <td width="32%" class="SK_Text1"><%
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="13%" class="SK_Text2">客户联系人</td>
  <td width="41%" class="SK_Text1">
<%
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
%></td>
</tr>

<tr>
  <td class="SK_Text2">跟进主题</td>
  <td colspan="3" class="SK_Text1"><font color=red><%=Rs("SK_Ftitle")%></font></td>
  </tr>

<tr>
  <td class="SK_Text2">跟进日期</td>
  <td class="SK_Text1"><%=Rs("SK_Ftime")%></td>
  <td class="SK_Text2">跟进状态</td>
  <td class="SK_Text1"><%if Rs("SK_Di")="1" then Response.write"已经跟进" else Response.write"计划跟进" end if%></td>
</tr>


<tr>
  <td class="SK_Text2">跟进内容</td>
  <td colspan="3" class="SK_Text1"><%=Rs("SK_Fcontent")%></td>
</tr>
<%
'自定义选项开始
set RsOptions=server.createobject("adodb.recordset")
sqlOptions="SELECT * from SK_ClientOptions where SK_Di=2 and SK_ShowOnForm=0 Order by SK_OrderID asc"
RsOptions.Open sqlOptions,conn,1,1
if RsOptions.bof and RsOptions.eof then
else
%>
<tr>
  <td colspan="4" class="SK_Title1">自定义选项</td>
</tr>
<tr>
  <td colspan="4" class="SK_Text1">
<%
Response.write"<table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""1"">"
for Optionsi=1 to RsOptions.recordCount '变量i从1循环到数据库中的全部记录数 
if (Optionsi mod 2 =1) then '每个tr即每行显示1个记录,可根据需要自行修改, 将左边的1修改为2即显示两行。
response.write "<tr>" 
end if
Response.write"<td class=""SK_Text2"" width=""14%"">"&RsOptions("SK_Title")&"</td><td class=""SK_Text1"">"

Set rsOptionsDetail=Server.CreateObject("ADODB.RecordSet") 
sqlOptionsDetail="SELECT * from SK_ClientOptionsDetail where SK_OptionsID="&RsOptions("FieldID")&" and OptionsDetailID="&rs(""&RsOptions("SK_FieldName")&"")&"" 
rsOptionsDetail.Open sqlOptionsDetail,conn,1,1
Response.write""&rsOptionsDetail("SK_OName")&""
rsOptionsDetail.close
set rsOptionsDetail=Nothing

Response.write"</td>"
if (Optionsi mod 2 = 0) then '每个tr即每行显示1个记录,可根据需要自行修改, 将左边的1修改为2即显示两行。
response.write "</tr>" 
end if 
RsOptions.movenext 
next 
Response.write"</table>"
%>
</td>
</tr>
<%
end if
RsOptions.close
set RsOptions=Nothing
'自定义选项结束
'自定义字段开始
set RsFields=server.createobject("adodb.recordset")
sqlFields="SELECT * from SK_ClientFields where SK_Di=2 and SK_ShowOnForm=0 Order by SK_OrderID asc"
RsFields.Open sqlFields,conn,1,1
if RsFields.bof and RsFields.eof then
else
%>
<tr>
<td colspan="4" class="SK_Title1">自定义字段</td>
</tr>
<tr>
  <td colspan="4" class="SK_Text1">
<%
Response.write"<table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""1"">"
for Fieldsi=1 to RsFields.recordCount '变量i从1循环到数据库中的全部记录数 
if (Fieldsi mod 2 =1) then '每个tr即每行显示1个记录,可根据需要自行修改, 将左边的1修改为2即显示两行。
response.write "<tr>" 
end if
Response.write"<td class=""SK_Text2"" width=""14%"">"&RsFields("SK_Title")&"</td><td class=""SK_Text1"">"&Rs(""&RsFields("SK_FieldName")&"")&"</td>"
if (Fieldsi mod 2 = 0) then '每个tr即每行显示1个记录,可根据需要自行修改, 将左边的1修改为2即显示两行。
response.write "</tr>" 
end if 
RsFields.movenext 
next 
Response.write"</table>"
%>
</td>
</tr>
<%
end if
RsFields.close
set RsFields=Nothing
'自定义字段结束
%>
<tr>
  <td colspan="4" class="SK_Title1">相关点评  
<%if Session("Manager")<>6 and Rs("SK_SalesID")<>Session("UID") AND 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>
<%
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
%>
<tr><td colspan="4" class="SK_Text">对不起,暂时还没有点评！</td></tr>
<%
else
K=0
while not RsRFollow.eof
K=K+1
%>
<tr>
<td class="SK_Text2"><%=split(RsRFollow("SK_Atime"))(0)%></td>
<td colspan="3" class="SK_Text1"><%=RsRFollow("SK_FollowReplyContent")%>  <font color=red>[ 时间：<%=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()
%><%=RsUser("SK_OName")%><%
RsUser.close
RsUser=Nothing
%>] 
<%if Session("Manager")<>6 AND RsRFollow("SK_SalesID")=Session("UID") AND 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=<%=Rs("FollowID")%>&Bid=<%=RsRFollow("RFollowID")%>">删除</a> )</font>
<%end if%></td>
</tr>
<%
RsRFollow.movenext
wend
RsRFollow.close
set RsRFollow=Nothing
%>
<%end if%>				  
<tr>
<td colspan="4" class="SK_Text">
<input type="button" value=" 关闭 " onClick="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>