<!--#include file="../Include/Const.Asp" -->
<!--#include file="../Include/ConnSiteData.Asp" -->
<!--#include file="../CheckAdmin.Asp"-->
<%
ID = request.QueryString("ID")
Result = request.QueryString("Result")
strReferer = Request.ServerVariables("http_referer")
If Result = "Modify" Then
	    Dim rs,sql
		Taskframe=trim(request.Form("Task_frame"))
		select case Taskframe
		      case "today"
			       TEtime=date()
			  case "tomorrow"
			       TEtime=DateAdd("d",+1,Date())
			  case "aftertomorrow"
			       TEtime=DateAdd("d",+2,Date())
			  case "this_week"
			       TEtime=dateadd("d",date,7-weekday(date))&" 23:59:59"
			  case "next_week"
			       TEtime=DateAdd("d",+7,dateadd("d",date,7-weekday(date)))&" 23:59:59"
			  case "later"
			  case "calendar"
			       TEtime=trim(Request.Form("d241"))
			  case else
		end select
		Set rs = server.CreateObject("adodb.recordset")
	    sql = "select * from Zqj_Plan where Cp_ID="&ID&" and PL_SortName='"&Request.Form("PlanSort")&"' and DATEDIFF('d',PL_time,'"&TEtime&"')=0"
        rs.Open sql, conn, 1, 3
		if rs.bof and rs.eof then
           rs.addnew
		   rs("PL_SortName")=Request.Form("PlanSort")
		   rs("MemName")=session("UserName")
		   rs("RealName")=session("RealName")
		   if trim(Request.Form("TKehuID"))="" then
			   rs("Cp_ID")=0
		   else
		    	rs("Cp_ID")=trim(Request.Form("TKehuID"))
		   end if
		   rs("Or_ID")=0
		   rs("Co_ID")=0
		   rs("PL_time")=TEtime
		   rs.update
		else
		  response.Write "<script language='javascript'>alert('计划已经存在!');history.back(-1);</script>"
		end if
        rs.Close
        Set rs = Nothing
End If
response.Redirect strReferer
%>