<!--#include file="../Include/Const.Asp" -->
<!--#include file="../Include/ConnSiteData.Asp" -->
<!--#include file="../CheckAdmin.Asp"-->
<%
ID = request.QueryString("ID")
LX = request.QueryString("LX")
s = request.QueryString("s")
Operation = request.QueryString("Operation")
strReferer = Request.ServerVariables("http_referer")
'If Operation = "up" Then
	    
'End If
	   Dim rs,sql
Select Case Operation
    Case "up"
		Set rs = server.CreateObject("adodb.recordset")
	    sql = "select * from "&LX&" where ID="&ID
        rs.Open sql,conn,1,3
        rs("Completed")=1
		rs("Completed_time")=now()
        rs.update
        rs.Close
        Set rs = Nothing
	 Case "modiy"
	    ReKehu="ReKehu"&s
		ReKehuID="ReKehuID"&s '联系人ID
		ReID="ReID"&s '事件ID
		Tasksid="Tasksid"&s '任务ID
		TChancesID="TChancesID"&s '机会ID
		ReKehuID=Request.Form(ReKehuID)
		ReID=Request.Form(ReID)
		Tasksid=Request.Form(Tasksid)
		TChancesID=Request.Form(TChancesID)
		Set rs = server.CreateObject("adodb.recordset") 
			   sql = "select * from Zqj_Kehu where ID="&ReKehuID
               rs.Open sql, conn, 1,1
			   if rs.bof and rs.eof then
			       ParentID=0
			   else
			       ParentID=rs("ParentID")
			   end if
	    rs.close
		set rs=nothing
		if trim(ReKehuID)="" then
		   ReKehuID=0
		end if
		if trim(TChancesI)="" then
		   TChancesI=0
		end if
		if trim(ReID)<>"" then
		      Set rs = server.CreateObject("adodb.recordset")
			   sql = "select * from Zqj_KehuRe where ID="&ReID
               rs.Open sql,conn,1,3
				  rs("Re")=Request.Form(rekehu)
				  rs("Retime")=now()
				  rs("KehuId")=ReKehuID
				  rs("KehuParentID")=ParentID
				  rs("chancesID")=TChancesID
			  rs.update
			  rs.close
			  set rs=nothing
		else
	 	       Set rs = server.CreateObject("adodb.recordset")
			   sql = "select * from Zqj_KehuRe"
               rs.Open sql, conn, 1, 3
			      rs.addnew
				  rs("MemName")=session("UserName")
				  rs("RealName")=session("RealName")
				  rs("Re")=Request.Form(rekehu)
				  rs("Retime")=now()
				  rs("KehuId")=ReKehuID
				  rs("KehuParentID")=ParentID
				  rs("TasksID")=Tasksid
				  rs("chancesID")=TChancesID
				  rs("ViewFlag")=1
			  rs.update
			  rs.close
			  set rs=nothing 
		end if
	 Case else
End Select	   
response.Redirect strReferer
%>