<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/util.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<HTML>
<HEAD>
<TITLE>添加计划</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<style>
body,td,input,textarea {font-size:9pt}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
	font-size: 12pt;
}
</style>
<script language="JavaScript" src="../JS/PublicJS.js"></script>
</HEAD>
<BODY>
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p15")
'''''''''''''''''''''''''''''''''''''''''''''''
%>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<%
dim act,adminname,PassWord,RoleId,t_date
if not isempty(request("date")) then
	t_date=request.QueryString("date")
else
	t_date=date
end if
act=request.QueryString("act")

if(act="add") then	
	task_name=trim(request.Form("task_name"))
	task_content=Replace(Trim(Request.Form("task_content")),"'","")
	task_date=Cdate(request.Form("task_date"))
	'添加到库
	set rs=server.createobject("adodb.recordset")
	sql="select top 1 * from t_task where task_name='"&task_name&"' order by id desc "
	rs.open sql,conn,3,3
	if not rs.eof then
		response.Write("<script>alert(""该任务已存在!"");history.back();</script>")
		response.End()
	else
		rs.addnew
		rs("admin_name")=UserName
		rs("task_name")=task_name
		rs("task_content")=task_content
		rs("task_date")=task_date
		rs("ModiTime")=now	
		rs.update		
		response.Write("添加计划任务成功~!")
		response.Write("<br><a href=task_add.asp>继续添加</a>&nbsp;&nbsp;<a href=calender.asp>管理任务</a>")
	end if
	rs.close
	set rs=nothing
else
%>
<FORM method="POST" name="form1" action="?act=add" style="margin:0 0 0 0;">
  <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#666666">
<TR bgcolor="#FF9900">
  <TD height="24" colspan="2"><div align="center" class="style1">添加计划</div></TD>
  </TR>
<TR bgcolor="#F5F5F5">
  <TD width="14%"><div align="center">任务名称：</div></TD>
  <TD width="86%"><input name="task_name" type="text" id="task_name" size="30"></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD><div align="center">计划内容：</div></TD>
  <TD><div align="left">
    <textarea name="task_content" cols="50" rows="6" id="task_content"></textarea>
</div></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD><div align="center">计划日期：</div></TD>
  <TD><input name="task_date" type="text" id="task_date" size="30" value="<%=t_date%>">
    <input name="sdaf" type="button" id="sdaf" onClick="OpenWindowAndSetValue('Inc/SelectDate.asp',280,120,window,document.form1.task_date);document.form1.task_date.focus();" value="选择日期"></TD>
</TR>
<TR bgcolor="#F5F5F5">
	<TD height="50" align=right bgcolor="#F5F5F5">&nbsp;	  </TD>
    <TD align=right bgcolor="#F5F5F5"><div align="left"> 
        <input type=submit name=b1 value="提 交">&nbsp;&nbsp;
        <input type=reset name=b2 value="重 填">       
    </div></TD>
</TR>
</TABLE>
</FORM>
<%
end if
%>
</BODY>
</HTML>
<%
call connclose()
%>