📄 edit.asp
字号:
<%response.expires=0%>
<%Response.Buffer=true%>
<%
function opendb(DBPath,sessionname,dbsort)
dim conn
Set conn=Server.CreateObject("ADODB.Connection")
DBPath1=server.mappath("../../db/#sdoa.asa")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath1
set session(sessionname)=conn
set opendb=session(sessionname)
end function
%>
<%
oabusyname=request.cookies("oabusyname")
oabusyusername=request.cookies("oabusyusername")
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
%>
<%
set conn=opendb("oabusy","conn","accessdsn")
set rs=server.createobject("adodb.recordset")
sql="select * from userinf where username='" & oabusyusername&"'"
rs.open sql,conn,1
allow_goods_manage=rs("allow_goods_manage")
conn.close
set conn=nothing
set rs=nothing
if allow_goods_manage<>"yes" then
response.write("<font color=red size=""+1"">对不起,需要库存管理权限!</font>")
response.end
end if
%>
<!-- #include file="../conn_lr.asp"-->
<!-- #include file="../css.asp"-->
<%
oabusyname=request.cookies("oabusyname")
oabusyusername=request.cookies("oabusyusername")
oabusyuserdept=request.cookies("oabusyuserdept")
oabusyuserlevel=request.cookies("oabusyuserlevel")
session("id")=request.cookies("oabusyname")
if oabusyusername="" then
response.write("<script language=""javascript"">")
response.write("window.top.location.href='../../default.asp';")
response.write("</script>")
response.end
end if
%>
<head>
<title></title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<!-- #Include File=../inc/css.asp -->
<% '定义变量
dim Number,opFlag,title,namelist,stylelist,unitlist,placelist,levellist,image
'获取输入参数:记录号和操作标志
opFlag=request("opFlag")
if opFlag="" then opFlag="cmdAddNew"
Number=request("Number")
if Number="" then Number="0"
on error resume next
'创建记录访问对象
SET rs=Server.CreateObject("ADODB.RecordSet")
'读取物品名称列表信息
rs.open "select DISTINCT vname, vnumber from goods where isrereg='f'",Session("conn"),1,1
namelist=""
while not rs.eof
namelist=namelist & "<option value='" & rs("vname") & "^" & rs("vnumber") & "'>" & rs("vname") & "</option>"
rs.movenext
wend
rs.close
'读取物品类别列表信息
rs.open "select DISTINCT vstyle from goods",Session("conn"),1,1
stylelist=""
while not rs.eof
stylelist=stylelist & "<option value='" & rs("vstyle") & "'>" & rs("vstyle") & "</option>"
rs.movenext
wend
rs.close
'读取物品单位列表信息
rs.open "select DISTINCT vunit from goods",Session("conn"),1,1
unitlist=""
while not rs.eof
unitlist=unitlist & "<option value='" & rs("vunit") & "'>" & rs("vunit") & "</option>"
rs.movenext
wend
rs.close
'读取物品产地列表信息
rs.open "select DISTINCT vplace from goods",Session("conn"),1,1
placelist=""
while not rs.eof
placelist=placelist & "<option value='" & rs("vplace") & "'>" & rs("vplace") & "</option>"
rs.movenext
wend
rs.close
'读取物品等级列表信息
rs.open "select DISTINCT vlevel from goods",Session("conn"),1,1
levellist=""
while not rs.eof
levellist=levellist & "<option value='" & rs("vlevel") & "'>" & rs("vlevel") & "</option>"
rs.movenext
wend
rs.close
if opFlag="cmdEdit" then
rs.open Session("SQL"),Session("conn"),1,1
rs.move Number
end if
select case opFlag
case "cmdAddNew"
title="入库"
case "cmdEdit"
title="资料修改"
end select
image="../images/goods.gif"
rs.close
%>
<style>
.css0{border:none;}
</style>
<script language=JavaScript>
<!--
function ds(sstr)
{
var dstr="";
for (i=0;i<sstr.length;i++)
{ if (sstr.charAt(i)!=' ') dstr+=sstr.charAt(i);
}
return dstr;
}
function getit()
{
if (ds(document.submitinput.vname.value)=="")
{
alert("对不起,物品名称不允许为空!");
document.submitinput.vname.focus();
return false;
}
if (document.submitinput.vname.value.length>255)
{
alert("对不起,您输入的物品名称超过最大限制,请重新输入!");
document.submitinput.vname.focus();
return false;
}
if (ds(document.submitinput.vnumber.value)=="")
{
alert("对不起,物品编号不允许为空!");
document.submitinput.vnumber.focus();
return false;
}
if (document.submitinput.vnumber.value.length>40)
{
alert("对不起,您输入的物品编号超过最大限制,请输入不大于40字符的数据!");
document.submitinput.vnumber.focus();
return false;
}
if (ds(document.submitinput.vcount.value)=="")
{
alert("对不起,物品数量不允许为空!");
document.submitinput.vcount.focus();
return false;
}
if (document.submitinput.vcount.value.length>6)
{
alert("对不起,您输入的物品数量格式不正确,请重新输入!");
document.submitinput.vcount.focus();
return false;
}
if (document.submitinput.vplace.value.length>255)
{
alert("对不起,您输入的物品产地超过最大限制,请重新输入!");
document.submitinput.vplace.focus();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -