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

📄 editworkrep.asp

📁 一套简单的OA系统
💻 ASP
字号:
<%response.expires=0%>
<!--#include file="asp/sqlstr.asp"-->
<!--#include file="asp/opendb.asp"-->
<!--#include file="asp/bgsub.asp"-->
<!--#include file="asp/keepformat.asp"-->
<!--#include file="asp/checked.asp"-->
<!--#include file="asp/sendeventemail.asp"-->
<%
oabusyname=request.cookies("oabusyname")
oabusyusername=request.cookies("oabusyusername")
oabusyuserid=request.cookies("oabusyuserid")
oabusyuserdept=request.cookies("oabusyuserdept")
oabusyuserlevel=request.cookies("oabusyuserlevel")
if oabusyusername="" then 
	response.write("<script language=""javascript"">")
	response.write("window.top.location.href='default.asp';")
	response.write("</script>")
	response.end
end if
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css/css.css">
<title>编辑工作计划</title>
</head>
<body bgcolor="#ffffff" topmargin="5" leftmargin="5">
<%
 
username=request("username")
superior=request("superior")
recdate=request("recdate")
id=request("id")
'打开数据库读出用户姓名
set conn=opendb("oabusy","conn","accessdsn")
set rs=server.createobject("adodb.recordset")
sql="select name from userinf where username=" & sqlstr(username)
rs.open sql,conn,1
if not rs.eof and not rs.bof then stafname=rs("name")
%>
<center>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>编辑<%=stafname%>的工作计划(<%=recdate%>)</b></td>
<form action="displayworkrec.asp" method=post name="form1">
<td><input type="submit" name="addworkrep" value="返回"></td>
<input type="hidden" name="username" value="<%=username%>">
<input type="hidden" name="superior" value="<%=superior%>">
<input type="hidden" name="recdate" value="<%=recdate%>">
</form>
</tr>
</table>
</center>
<%
 
if request.form("submit")="修改" then
	title=request.form("title")
	remark=request.form("remark")
	finished=request.form("finished")
	imp1=request.form("imp")
	superior=request.form("superior")
	sql = "update workrep set finished=" & sqlstr(finished) & ",imp=" & sqlstr(imp1) & ",title=" & sqlstr(title) & ",remark=" & sqlstr(remark) & " where id=" & id
	conn.Execute sql
	set rs1=server.createobject("adodb.recordset")
	sql1="select superior from workrep where id="&id
	rs1.open sql1,conn,1
	if not rs1.eof and not rs1.bof then
		superior=rs1("superior")
		set rs=server.createobject("adodb.recordset")
		sql=""
		if finished="yes" and superior<>"" and superior<>oabusyusername then
			sql="select userinf.ID from userinf,workrep where workrep.id="&id&" and workrep.superior=userinf.username"
		elseif superior=oabusyusername and superior<>"" then
			sql="select userinf.ID from userinf,workrep where workrep.id="&id&" and workrep.username=userinf.username"
		end if
		if sql<>"" then
			rs.open sql,conn,1
			if not rs.eof and not rs.bof then
				if finished="yes" and superior<>"" and superior<>oabusyusername then
					emailtitle="您好,您给"&oabusyname&"分配的工作任务已完成!["&title&"]"
					emailcontent="工作任务标题:["&title&"]"&chr(13)&chr(10)
					emailcontent=emailcontent&"详细说明:["&remark&"]"
					errstr="对不起,系统自动发送您完成工作任务邮件出错,请手动发送邮件通知对方!"
					errinfo=send_event_email(emailtitle,oabusyuserid,rs("ID"),emailcontent,errstr)
				elseif superior=oabusyusername and superior<>"" then
					emailtitle="您好,"&oabusyname&"为您修改了工作任务!["&title&"]"
					emailcontent="工作任务标题:["&title&"]"&chr(13)&chr(10)
					emailcontent=emailcontent&"详细说明:["&remark&"]"
					errstr="对不起,系统自动发送您修改工作任务邮件出错,请手动发送邮件通知对方!"
					errinfo=send_event_email(emailtitle,oabusyuserid,rs("ID"),emailcontent,errstr)
				end if
				if errinfo<>"" then
					set rs=nothing
					set rs1=nothing
					conn.close
					response.redirect "asp/disperrorinfo.asp?errorinfo="&errinfo
					response.end
				end if
			else
				set rs=nothing
				set rs1=nothing
				conn.close
				response.redirect "asp/disperrorinfo.asp?errorinfo="&errstr
				response.end
			end if
		end if
	end if
%>
<center>
<br><br>
<font color="red" size="+1">编辑工作计划成功!</font>
<br><br>
</center>
<%
else
	if request.form("submit")="删除" then
		sql = "delete from workrep where id=" & id
		conn.Execute sql
		conn.close
		set conn=nothing
%>
<center>
<br><br>
<font color="red" size="+1">删除工作计划成功!</font>
</center>
<br><br>
<%
	else
%>
&nbsp; 
<%
		'打开数据库读出id=id的记录
		set rs=server.createobject("adodb.recordset")
		sql="select * from workrep where id=" & id
		rs.open sql,conn,1
%>
<center> 
<script Language="JavaScript">
function maxlength(str,minl,maxl)
{
	if(str.length <= maxl && str.length >= minl)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function form_check()
{
	var l1=maxlength(document.form2.title.value,1,50);
	if(!l1)
	{
		window.alert("标题的长度大于1位小于50位");
		document.form2.title.focus();
		return (false);
	}
}
</script>
<br>
</center>
<form action="editworkrep.asp" method=post name="form2" onsubmit="return form_check();">
<div align="center">
  <center>
<table border="1" cellspacing="0" cellpadding="5" width=80% bordercolorlight="#808080" bordercolordark="#D4D0C8">
<tr>
<td width=211 align="right">
  <p align="right">简要标题:</p>
</td>
<center>
<td width=513>
<%
	if (username=oabusyusername and rs("superior")="") or (rs("superior")=oabusyusername) then
%>
<input type="text" name="title" size=50 value="<%=server.htmlencode(rs("title"))%>"><font color=red>*</font>
<% 
	else
%>
<input type="hidden" name="title" value="<%=server.htmlencode(rs("title"))%>"><%=server.htmlencode(rs("title"))%> 
<% 
	end if
%>
</td>
</tr>
<tr>
<td align="right" width="211" valign="top">详细说明:</td><td width="513">
<%
	if (username=oabusyusername and rs("superior")="") or (rs("superior")=oabusyusername) then
%>
<textarea rows="10" name="remark" cols="50"><%=server.htmlencode(rs("remark"))%></textarea>
<% 
	else
%>
<input type="hidden" name="remark" value="<%=server.htmlencode(rs("remark"))%>"><%=checked3(keepformat(rs("remark")))%> 
<% 
	end if
%>
</td>
</tr>
<tr>
<td colspan=2 width="736">完成情况: 
<%
	if username=oabusyusername and superior="" then
%> 
<input type="radio" name="finished" value="yes"<%=checked("yes",rs("finished"))%>>已完成&nbsp;&nbsp;<input type="radio" name="finished" value="no"<%=checked("no",rs("finished"))%>>未完成<br> 
<%
	else
%>
<input type="hidden" name="finished" value="<%=rs("finished")%>"> 
<%=checked1("yes",rs("finished"))%>已完成&nbsp;&nbsp;<%=checked1("no",rs("finished"))%>未完成<br> 
<%
	end if
%>
重要程度: 
<%
	if (username=oabusyusername and rs("superior")="") or (rs("superior")=oabusyusername) then
%> 
<input type="radio" name="imp" value="yes"<%=checked("yes",rs("imp"))%>>重要&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="imp" value="no"<%=checked("no",rs("imp"))%>>一般 
<%
	else
%>
<%=checked1("yes",rs("imp"))%>重要&nbsp;&nbsp;&nbsp;&nbsp;<%=checked1("no",rs("imp"))%>一般 
<input type="hidden" name="imp" value="<%=rs("imp")%>">
<% 
	end if
%>
</td>
</tr>
</table>
  </center>
  </div>
<%
	if (oabusyusername=rs("superior")) or (oabusyusername=rs("username")) then
%>
<input type="submit" name="submit" value="修改" >
<% 
	end if
	if (username=oabusyusername and rs("superior")="") or (rs("superior")=oabusyusername) then
%>
  &nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="submit" value="删除" onclick="return window.confirm('你确实要删除这条计划吗?');">
<% 
	end if
%>
<input type="hidden" name="username" value="<%=username%>"> 
<input type="hidden" name="superior" value="<%=superior%>"> 
<input type="hidden" name="recdate" value="<%=recdate%>"> 
<input type="hidden" name="id" value="<%=id%>"> 
</form>
</center>
<%
	conn.close
	set conn=nothing
	end if
end if
%>
<div align="center">
  <center>
  <table>
    <tr>
      <td height=19>
        <table border="0" cellpadding="0" cellspacing="0" width="610" height="19">
		  <tr>
          <td width="100%" height=20><p align="center"><font color="#808080">IE37 &copy; <a href="http://www.ie37.com" target="_blank">IE37.com</a></font></td> 
		  </tr>
        </table>
      </td>
    </tr>
<%
%>
  </table>
  </center>
</div>
</body>

⌨️ 快捷键说明

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