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

📄 modify_contract.asp

📁 关于设备管理的大型系统
💻 ASP
字号:
<!--#include file="user_timeout.asp"-->
<!--#include file="getabcd.asp"-->
<%
c_no=trim(request("c_no"))
c_no2=trim(request("c_no2"))
c_content=trim(request("c_content"))
c_file=trim(request("c_file"))
c_total=request("c_total")
first_payment=request("first_payment")
last_payment=c_total-first_payment
is_del_file=request("is_del_file")
sql="select * from contract where c_no='"&c_no2&"'"
rs.open sql,conn,1,1
c_file_old=rs("c_file")
c_state=rs("c_state")
rs.close
if c_state<>"new" then
	errmsg="合同“<font color=red>"&c_no2&"</font>”已被审核,不能修改!"
	return_url="main.asp"
elseif c_no="" or c_total="" or c_content="" or first_payment="" then
	errmsg="所填项均不能为空,请重新填写!"
	return_url="edit_contract.asp?c_no="&c_no2
elseif not IsNumeric(c_total) or not IsNumeric(first_payment) then
	errmsg="总金额、首款必须为数字,请重新填写!"
	return_url="edit_contract.asp?c_no="&c_no2
elseif c_total<=first_payment then
	errmsg="总金额不能小于或等于首款,请重新填写!"
	return_url="edit_contract.asp?c_no="&c_no2
else
	sql="select * from contract where c_no='"&c_no&"'"
	rs.open sql,conn,1,1
	query_num=rs.recordcount
	'response.write sql
	'response.write query_num
	'response.end
	rs.close
	if query_num>0 and c_no<>c_no2 then
		errmsg="合同“<font color=red>"&c_no&"</font>”已存在,请重新填写!"
		return_url="edit_contract.asp?c_no="&c_no2
	else
		tmp="" '临时变量,存储rs("c_file")值:“nothing”、新合同文件名或旧合同文件名。
		if is_del_file="del" then
			tmp="nothing"
			set c_fs=server.createobject("scripting.filesystemobject")
  		c_fs.deletefile(Server.MapPath("con_files/"&c_file_old))
  		c_fs.close
  	else
  		tmp=c_file_old
		end if
		if c_file<>"" then
			'删除旧合同文件,因为同文件名但不同后缀的文件不能被覆盖。
			set c_fs=server.createobject("scripting.filesystemobject")
  		c_fs.deletefile(Server.MapPath("con_files/"&c_file_old))
  		c_fs.close
			'文件上传
			tmp=c_no&mid(c_file,instrrev(c_file,"."),4)
			'response.write tmp
			'response.end
			Set objStream = Server.CreateObject("ADODB.Stream")
		  objStream.Type = 1
		  objStream.Open
		  objStream.LoadFromFile c_file
		  objStream.SaveToFile Server.MapPath("con_files/"&tmp),2
		  objStream.Close
		end if
		sql="update contract set c_no='"&c_no&"', c_content='"&c_content&"', c_total="&c_total&", first_payment="&first_payment&", last_payment="&last_payment&", create_time='"&now()&"', c_file='"&tmp&"' where c_no='"&c_no&"'"
		rs.open sql,conn,0,1
		errmsg="合同“<font color=red>"&c_no&"</font>”修改成功!"
		return_url="main.asp"
	end if
end if
%>
<html>
	<head>
		<title>北华航天工业学院 设备合同管理系统</title>
    <META HTTP-EQUIV=REFRESH CONTENT='1; URL=<%=return_url%>'>
    <link href="global.css" rel="stylesheet" type="text/css">
  </head>
  <body>
  	<div align="right"><a href="edit_pwd.asp">[修改密码]</a> <a href="help/index.html" target="_black">[帮助]</a> <a href="logout.asp">[退出系统]</a> </div>
  	<br><br><br><br><br><br><br><br><br><br><br>
  	<center><%=errmsg%></center>
  </body>
</html>
<%call DBConnEnd()%>

⌨️ 快捷键说明

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