⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plan.asp

📁 办公自动化系统 适用于办公室的各种几本功能的操作 功能比较简单
💻 ASP
字号:
<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/connection.asp"-->
<!--#include file="verson.asp"-->

<%
SelectID=Session("SelectID")
LoginID=trim(session("LoginID"))
UserName=GetTableValue ("tblUser","Name","ID",LoginID)
if LoginID="" then LoginID=0
if SelectID="" then SelectID=LoginID

SelectDate=trim(request("SelectDate"))
if SelectDate<>"" then Session("TaskDate")=""

if Session("TaskDate")<>"" then
	SelectDate=Session("TaskDate")
end if
if SelectDate="" or (not isdate(SelectDate)) then SelectDate=date()

PlanID=trim(request("PlanID"))
Delete=trim(request("Delete"))
if Delete="true" and PlanID<>"" and isnumeric(PlanID) then
Conn.execute "delete tblPlanRelative Where PlanID="& PlanID
Conn.execute "delete tblPlan Where ID="& PlanID
end if

if trim(request("todo"))="start" and PlanID<>"" then
	Conn.execute "update tblPlan set Finish=1 where ID="& PlanID
end if
if trim(request("todo"))="end" and PlanID<>"" then
	Conn.execute "update tblPlan set Finish=100 where ID="& PlanID
	set rs1=server.createobject("adodb.recordset")
	sql="select * from tblPlan where ID="& Planid
	rs1.open sql,Conn
	if not rs.eof then
		sStartTime=trim(rs1("StartTime"))
		sEndTime=trim(rs1("EndTime"))
		sTitle=trim(rs1("Title"))
		AddID=trim(rs1("AddID"))
		UserID=trim(rs1("UserID"))
	end if
	rs1.close
	set rs1=nothing
	if trim(AddID)<>trim(UserID) then
		FromID=LoginID
		FromName=UserName
		ToID=AddID
		ToName=GetTableValue ("tblUser","Name","ID",AddID)
		Subject=FromName&"的任务完成通知"
		Body=ToName&"您好!"&chr(13)&"这是系统的自动邮件通知,您给"& FromName &"安排的 "&sStartTime&"——"&sEndTime&" 的任务: "& sTitle&" 已经完成!"&chr(13)&chr(13)&chr(13)&chr(13)& "                              系统自动邮件通知!"&Now()
		SendMail FromID,FromName,ToID,ToName,Subject,Body,AttachFile
	end if
end if

maxmessage=15
currentpage=request("page")
if currentpage="" then 
currentpage=1
end if

set rs=Server.CreateObject("ADODB.RecordSet")
sql="select ID,Title,Body,AddID,UserID,StartTime,EndTime,Remark,Finish,url,dengji from tblPlan where class="& nClass &" and  StartTime<='"& SelectDate &"' and EndTime>='"& SelectDate &"' and (UserID="& SelectID &" or AddID="& SelectID &") order by UserID,ID desc"
rs.pagesize=maxmessage
rs.open sql,Conn,1,1
totalpage=rs.pagecount
totalmessage=rs.recordcount
if totalmessage<>0 then
	rs.AbsolutePage=currentpage
	msgArr=rs.getrows(maxmessage)
end if

rs.close%>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../CSS/main.css">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<table border=0 width="100%">
<tr><td  width=80><strong><b><%=SelectDate%></b></strong></td>
<td>
<%if SelectID=LoginID then%>
<a href="AddPlan.asp?SelectDate=<%=SelectDate%>"><img src="../images/add.gif" border=0 alt="添加新任务"></a>
<%else%>
为下属添加任务
<a href="AddUserPlan.asp?SelectDate=<%=SelectDate%>"><img src="../images/add.gif" border=0 alt="添加新任务"></a>
<%end if%>
</td>
</tr>
</table>
<hr size=1 width="100%">

<%
response.write "任务 共" & totalmessage & "条/" & totalpage & "页,每页"& maxmessage &"条"
if totalpage>0 then
	response.write ",第" & currentpage & "页 "
end if

if totalpage>1 then
	if currentpage>1 then%>
		<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?page=<%=currentpage-1%>">上页</a>  
		<%
	end if

	if currentpage+1<=totalpage then%>
		<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?page=<%=currentpage+1%>">下页</a>
		<%
	end if
end if
%>

<%
if isempty(msgArr) then
	response.write "<BR><BR>暂时为空!"
else
for i = 0 to UBound(msgArr,2) '循环
	if trim(msgArr(3,i))=SelectID and trim(msgarr(4,i))=SelectID then  '自己给自己安排的任务
	%>
	<table border=0 width="100%" bgcolor=#0d85ff cellspacing=1 cellpadding=3>
		<tr>
			<td colspan=2>
		<font color=#ffffff><%="<b>"&trim(msgarr(1,i))&"</b>"%>&nbsp;(<%=trim(msgarr(5,i))&"至"&trim(msgarr(6,i))%>)</font>
			</td>
			<td align=right width=180><a href="editplan.asp?planid=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>"><img src="../images/edit.gif" border=0></a><a href="plan.asp?delete=true&planid=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>" onclick="return CheckDelete();"><img src="../images/delete1.gif" border=0></a></td>	
		</tr>
		<tr bgcolor=#ffffff>
			<td width="30%"><a href="addRelative.asp?planID=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>">添加注释</a>
			<BR><a href="ViewRelative.asp?planid=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>">查看相关注释 (<%=GetRelative(trim(msgarr(0,i)))%>条)</a></td>
			<td width="20%">
			<%if cint(trim(msgarr(8,i)))="0" then%>
			<font color=#ff0000>尚未开始</font>
			<%elseif cint(trim(msgarr(8,i)))="100" then%>
			<font color=#0000ff>已完成</font>
			<%else%>
			尚未完成
			<%end if%>
			<BR>已完成 <%=trim(msgarr(8,i)) &"%"%></td>
			<td>
			<%if cint(trim(msgarr(8,i)))="0" then%>
			<a href="plan.asp?todo=start&PlanID=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>">开始执行
			</a>
			<%elseif cint(trim(msgarr(8,i)))<>"100" then%>

			<a href="editFinish.asp?PlanID=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>">修改进度
			</a>

			<a href="plan.asp?todo=end&PlanID=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>">执行完毕
			</a>
			<%end if%>
			
			</td>
		</tr>
		<tr bgcolor=#FFFFFF>
			<td colspan=3><b>重要性:</b> 
			<%nDengji=trim(msgarr(10,i))
			if nDengji="1" then
				response.write "<font color=#9999FF>低</font>"
			elseif nDengji="2" then
				response.write "<font color=#CC0066>中</font>"
			elseif nDengji="3" then
				response.write "<font color=#FF0000>高</font>"
			else
				response.write "未指定"
			end if
			%>
			</td>
		</tr>
		<tr bgcolor=#FFFFFF>
			<td colspan=3><b>内容:</b> <%=replace(replace(server.htmlencode(trim(msgarr(2,i))&""),chr(13),"<br>")," ","&nbsp;")%></td>
		</tr>
		<tr bgcolor=#FFFFFF>
			<td colspan=3><b>备注:</b> <%=replace(replace(server.htmlencode(trim(msgarr(7,i))&""),chr(13),"<br>")," ","&nbsp;")%></td>
		</tr>
		<tr bgcolor=#FFFFFF>
			<td colspan=3><b>相关连接:</b> 
			<%if trim(msgarr(9,i))="" or trim(msgarr(9,i))="http://" then%>
			<%=trim(msgarr(9,i))%>
			<%else%>
			<a href="<%=trim(msgarr(9,i))%>" target="_blank"><%=trim(msgarr(9,i))%></a>
			<%end if%>
			</td>
		</tr>
	</table><BR><BR>
	<%
	elseif trim(msgArr(3,i))<>trim(msgarr(4,i)) and trim(msgarr(4,i))=SelectID then '上级安排的任务%>
	<table border=0 width="100%" bgcolor=#FFCC66 cellspacing=1 cellpadding=3>
		<tr>
		<%if SelectID=LoginID then%>
			<td colspan=3>
			<div align=center><font color=#CC0000><b>***上级 <%=GetTableValue("tblUser","Name","ID",trim(msgarr(3,i)))%> 安排的任务***</b></font></div>
		<font color=#ffffff><%="<b>"&trim(msgarr(1,i))&"</b>"%>&nbsp;(<%=trim(msgarr(5,i))&"至"&trim(msgarr(6,i))%>)</font>
			</td>
		<%else%>
			<td colspan=2>
			<div align=center><font color=#CC0000><b>***上级 <%=GetTableValue("tblUser","Name","ID",trim(msgarr(3,i)))%> 安排的任务***</b></font></div>
		<font color=#ffffff><%="<b>"&trim(msgarr(1,i))&"</b>"%>&nbsp;(<%=trim(msgarr(5,i))&"至"&trim(msgarr(6,i))%>)</font>
			</td>
			<td align=right width=180><!--a href="editplan.asp?planid=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>"--><img src="../images/edit.gif" border=0><!--/a--><!--a href="plan.asp?delete=true&planid=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>" onclick="return CheckDelete();"--><img src="../images/delete1.gif" border=0><!--/a--></td>
		<%end if%>
		</tr>
			
		<tr bgcolor=#ffffff>
			<td width="30%"><a href="addRelative.asp?planID=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>">添加注释</a>
			<BR><a href="ViewRelative.asp?planid=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>">查看相关注释 (<%=GetRelative(trim(msgarr(0,i)))%>条)</a></td>
			<td  width="20%">
			<%if cint(trim(msgarr(8,i)))="0" then%>
			<font color=#ff0000>尚未开始</font>
			<%elseif cint(trim(msgarr(8,i)))="100" then%>
			<font color=#0000ff>已完成</font>
			<%else%>
			尚未完成
			<%end if%>
			<BR>已完成 <%=trim(msgarr(8,i)) &"%"%></td>
			<td>
			<%if cint(trim(msgarr(8,i)))="0" then%>
			<a href="plan.asp?todo=start&PlanID=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>">开始执行
			</a>
			<%elseif cint(trim(msgarr(8,i)))<>"100" then%>

			<a href="editFinish.asp?PlanID=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>">修改进度
			</a>

			<a href="plan.asp?todo=end&PlanID=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>">执行完毕
			</a>
			<%end if%>
			
			</td>
		</tr>
		<tr bgcolor=#FFFFFF>
			<td colspan=3><b>重要性:</b> 
			<%nDengji=trim(msgarr(10,i))
			if nDengji="1" then
				response.write "<font color=#9999FF>低</font>"
			elseif nDengji="2" then
				response.write "<font color=#CC0066>中</font>"
			elseif nDengji="3" then
				response.write "<font color=#FF0000>高</font>"
			else
				response.write "未指定"
			end if
			%>
			</td>
		</tr>
		<tr bgcolor=#FFFFFF>
			<td colspan=3><b>内容:</b> <%=replace(replace(server.htmlencode(trim(msgarr(2,i))&""),chr(13),"<br>")," ","&nbsp;")%></td>
		</tr>
		<tr bgcolor=#FFFFFF>
			<td colspan=3><b>备注:</b> <%=replace(replace(server.htmlencode(trim(msgarr(7,i))&""),chr(13),"<br>")," ","&nbsp;")%></td>
		</tr>
		<tr bgcolor=#FFFFFF>
			<td colspan=3><b>相关连接:</b> 
			<%if trim(msgarr(9,i))="" or trim(msgarr(9,i))="http://" then%>
			<%=trim(msgarr(9,i))%>
			<%else%>
			<a href="<%=trim(msgarr(9,i))%>" target="_blank"><%=trim(msgarr(9,i))%></a>
			<%end if%>
			</td>
		</tr>
	</table><BR><BR>
	<%elseif trim(msgArr(3,i))<>trim(msgarr(4,i)) and trim(msgarr(3,i))=SelectID then '安排给下级的任务%>
	<table border=0 width="100%" bgcolor=#333399 cellspacing=1 cellpadding=3>
		<tr>
			<td colspan=2><div align=center><font color=#FFFF00><b>***给下级 <%=GetTableValue("tblUser","Name","ID",trim(msgarr(4,i)))%> 安排的任务***</b></font></div>
		<font color=#ffffff><%="<b>"&trim(msgarr(1,i))&"</b>"%>&nbsp;(<%=trim(msgarr(5,i))&"至"&trim(msgarr(6,i))%>)</font>
			</td>
			<td align=right width=180><!--a href="editplan.asp?planid=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>"--><img src="../images/edit.gif" border=0><!--/a><a href="plan.asp?delete=true&planid=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>" onclick="return CheckDelete();"--><img src="../images/delete1.gif" border=0><!--/a--></td>	
		</tr>
		<tr bgcolor=#ffffff>
			<td  width="30%"><a href="addRelative.asp?planID=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>">添加注释</a>
			<BR><a href="ViewRelative.asp?planid=<%=trim(msgarr(0,i))%>&selectDate=<%=SelectDate%>">查看相关注释 (<%=GetRelative(trim(msgarr(0,i)))%>条)</a></td>
			<td  width="20%">
			<%if cint(trim(msgarr(8,i)))="0" then%>
			<font color=#ff0000>尚未开始</font>
			<%elseif cint(trim(msgarr(8,i)))="100" then%>
			<font color=#0000ff>已完成</font>
			<%else%>
			尚未完成
			<%end if%>
			<BR>已完成 <%=trim(msgarr(8,i)) &"%"%></td>
			<td>
			
			
			</td>
		</tr>
		<tr bgcolor=#FFFFFF>
			<td colspan=3><b>重要性:</b> 
			<%nDengji=trim(msgarr(10,i))
			if nDengji="1" then
				response.write "<font color=#9999FF>低</font>"
			elseif nDengji="2" then
				response.write "<font color=#CC0066>中</font>"
			elseif nDengji="3" then
				response.write "<font color=#FF0000>高</font>"
			else
				response.write "未指定"
			end if
			%>
			</td>
		</tr>
		<tr bgcolor=#FFFFFF>
			<td colspan=3><b>内容:</b> <%=replace(replace(server.htmlencode(trim(msgarr(2,i))&""),chr(13),"<br>")," ","&nbsp;")%></td>
		</tr>
		<tr bgcolor=#FFFFFF>
			<td colspan=3><b>备注:</b> <%=replace(replace(server.htmlencode(trim(msgarr(7,i))&""),chr(13),"<br>")," ","&nbsp;")%></td>
		</tr>
		<tr bgcolor=#FFFFFF>
			<td colspan=3><b>相关连接:</b> 
			<%if trim(msgarr(9,i))="" or trim(msgarr(9,i))="http://" then%>
			<%=trim(msgarr(9,i))%>
			<%else%>
			<a href="<%=trim(msgarr(9,i))%>" target="_blank"><%=trim(msgarr(9,i))%></a>
			<%end if%>
			</td>
		</tr>
	</table><BR><BR>
	<%end if
next
end if
%>

</table>
<form name="task" method="post" action="">
<INPUT TYPE="hidden" name="SelectDate" value="<%=SelectDate%>">
</form>
</BODY>
</HTML>
<script language=javascript>
function CheckDelete()
{
	return confirm("确实删除吗?");
}
</script>
<!--#include file="../inc/connclose.asp"-->
<%
Function GetTableValue(TableName,Field,ValueField,Value)
	if TableName<>"" and Value<>"" then
		Set RsTmp = Server.Createobject("Adodb.recordset")
		strSql = "Select "& Field &" from "& TableName &" where "& ValueField &"='"& Value &"'"
		Rstmp.open strSql,Conn,1,1
		If not Rstmp.eof then
			GetTableValue=trim(Rstmp(Field))
		else
			GetTableValue=""
		end if
		Rstmp.close
		'set RsTmp = Nothing
	else
		GetTableValue=""
	end if
End Function
Function GetRelative(PlanID)
	if PlanID<>"" and isnumeric(planid) then
		Set RsTmp = Server.Createobject("Adodb.recordset")
		strSql = "Select count(*) as num from tblPlanRelative where PlanID ="& PlanID
		Rstmp.open strSql,Conn
		If not Rstmp.eof then
			GetRelative=trim(Rstmp("num"))
		else
			GetTableValue=0
		end if
		Rstmp.close
		set RsTmp = Nothing
	else
	GetRelative=0
	end if
end function

Sub SendMail(FromID,FromName,ToID,ToName,Subject,Body,AttachFile)
	sql="INSERT INTO tblMailIn(FromID, ToID, FromName, ToName, Subject, Body, AttachFile) VALUES(" &  FromID & _
		","& ToId & _
		",'" & FromName & _
		"','"& ToName & _
		"','"& Subject & _
		"','"& Body & _
		"','"& AttachFile & _
		"')"		
		'response.write sql&"<BR>"
		Conn.execute (sql)		
End Sub
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -