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

📄 newinitial_whse.asp

📁 1 除掉了 时间 限制 2 除掉了 人数 限制 改为 500人 原为5人 3 发现一点小缺陷 增加人员的时候没有判断 登陆名是否重复! 自己写吧~~~:) 4 又 是一点缺陷
💻 ASP
字号:
<!--#include file="../config.ini" -->
<!--#include file="../commfunction.inc" -->
<%
if Request("id")<>"" then
	dim connq
	set connq=server.CreateObject("adodb.connection")
	connq.Open connstring
	sql="select * from InitialInventory where id="&Request("id")
	set rsq=connq.Execute(sql)
	productid=rsq("productid")
	productcode=getfieldvalue("product","productid",rsq("productid"),"productcode")
	product=getfieldvalue("product","productid",rsq("productid"),"model")
	initialqty=rsq("initialqty")
	refcost=rsq("refcost")
	currentcost=rsq("currentcost")
	totalamount=rsq("totalamount")
	locationid=rsq("locationid")
	location=getfieldvalue("location","locationid",rsq("locationid"),"location")
	whseid=getfieldvalue("location","locationid",rsq("locationid"),"whseid")
	whsename=getfieldvalue("warehouse","whseid",whseid,"whse")
	rsq.Close
	set rsq=nothing
	connq.Close
	set connq=nothing
end if

if request("qty")<>"" then
	dim conn
	dim rs
	set conn=server.CreateObject("adodb.connection")
	set rs=server.CreateObject("adodb.recordset")
	conn.Open connstring
	
	if request("id")="" then
	  rs.Open "select productid from InitialInventory where productid='"&request("product")&"' and sysaccountid='"&request("sysaccountid")&"' and locationid='"&request("location")&"'" ,conn,1,1
		'response.write "select productid from InitialInventory where productid='"&request("product")&"' and sysaccountid='"&request("sysaccountid")&"' and locationid='"&request("location")&"'"
		'response.end

	  if rs.eof then
	  	rs.close
		rs.Open "select * from InitialInventory",conn,2,3,1
		rs.AddNew 
		rs("creator")=session("loginid")
		rs("createdate")=now()
		rs("lastmoduser")=session("loginid")
		rs("lastmoddate")=now()

	  else
		rs.Close 
		set rs=nothing
		conn.Close 
		set conn=nothing
	%>
			<script language=javascript>
				alert('<%=request.form("code")%>'+'产品已存在,请关闭窗口!');
				window.opener.location.reload();
				window.close();
			</script>
	<%
	  end if
	else
		rs.Open "select * from InitialInventory where id="&request("id"),conn,2,3,1
		rs("lastmoduser")=session("loginid")
		rs("lastmoddate")=now()
	end if
	
	rs("sysaccountid")=cint(request("sysaccountid"))
	rs("Productid")=request("product")
	rs("Locationid")=request("location")
	rs("InitialQty")=request("qty")
	rs("RefCost")=request("refcost")
	rs("CurrentCost")=request("cost")
	rs("TotalAmount")=request("totalamount")

	rs.Update 
	rs.Close 
	set rs=nothing
	conn.Close 
	set conn=nothing
%>
<script language=javascript>
	window.opener.location.reload();
	window.close();
</script>
<%
end if
%>
<html>
<head>
<LINK href="../global.css" rel=STYLESHEET type=text/css>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%if request("id")="" then%>新建<%else%>编辑<%end if%>期初库存</title>
</head>
<body leftmargin="10" rightmargin="10" topmargin="10">
<%'期初库存#############################################################################################################%>
<form name="form1" id="form1" method="post" action="">
  <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="FFFFFF" align="center">
    <tr> 
      <td height="25" colspan=3><div align="left"><strong><font size="2" class=title><%if request("id")="" then%>新建<%else%>编辑<%end if%>期初库存</font></strong></div></td>
      <td height="25" align="right"></td>
    </tr>
    <tr> 
      <td height="16" colspan="4" background="../images/title.gif">&nbsp;</td>
    </tr>
    <tr>
      <td  colspan="4" height=4></td>
    </tr>
    <tr valign="middle"> 
      <td height="25" colspan="4" align=center><div align=center> 
          <img src="../images/button_save.gif" style="cursor:hand" border=0 onclick="save();">&nbsp;&nbsp; 
          <img src="../images/button_cancel.gif" style="cursor:hand" border=0 onclick="window.close();"> 
        </div></td>
    </tr>
    <tr valign="middle"> 
      <td width="10%" height="25" align=center bgcolor="DEDFDE">型号</td>
      <td height="25" colspan="3" bgcolor="efefef"><div align="left">&nbsp;&nbsp; 
          <font color=red> 
          <div name="productname" id="productname"><%=product%></div>
          </font> </div></td>
    </tr>
    <tr valign="middle"> 
      <td width="10%" height="25" align=center bgcolor="DEDFDE">货号</td>
      <td width="40%" height="25" align=left bgcolor="efefef"> 
        <input type=hidden name=product value=<%=productid%>> 
        <input type=text name=code size=14 readonly value="<%=productcode%>">
		<input type=button name=bproduct onClick="JavaScript:opensubwin9('form1','product','code','refcost')" value="..."  class=black>
      </td>
      <td width="12%" height="25" align=center bgcolor="DEDFDE">参考成本</td>
      <td width="38%" height="25" align=center bgcolor="efefef"> 
        <div align="left"> 
          <input type=text name="refcost" size=6 readonly value=<%=refcost%>>
        </div></td>
    </tr>
  </table>
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="FFFFFF" dwcopytype="CopyTableRow">
    <tr valign="middle"> 
      <td width="10%" height="25" align=center bgcolor="DEDFDE">数量</td>
      <td width="20%" height="25" bgcolor="efefef">
		<input type=text name=qty size=6 onChange="calculateamount();" value=<%=initialqty%>>
        </td>
      <td width="12%" bgcolor="DEDFDE">
<div align="center">实际成本</div></td>
      <td width="28%" bgcolor="efefef"> 
        <div align="left"> 
          <input type=text name=cost size=6 onChange="recalculateamount();" value=<%=currentcost%> >
        </div></td>
      <td width="10%" height="25" align=center bgcolor="DEDFDE">金额</td>
      <td width="20%" height="25" align=left bgcolor="efefef">
	  <input type=text name="totalamount" size=6 readonly value=<%=totalamount%>></td>
    </tr>
    <tr valign="middle"> 
      <td width="10%" height="25" align=center bgcolor="DEDFDE">仓库</td>
      <td width="20%" height="25" bgcolor="efefef">
          <font color=red> 
          <div name="whsename" id="whsename"><%=whsename%></div>
          </font> </div>
	  </td>
      <td width="12%" bgcolor="DEDFDE"> 
        <div align="center">货位</div></td>
      <td width="28%" bgcolor="efefef"> 
        <div align="left"> 
		<input type="hidden" name=whse value=<%=whseid%>>
		<input name="location" type="hidden" value=<%=locationid%>>
		<input name="locationname" type="text" size="8" value="<%=location%>" readonly>
		<input type="button" name="bnlocation" onClick="JavaScript:if(form1.product.value==''){alert('请先选择产品');}else{opensubwin10('form1','location','whse')}"    value=... class=black>
        </div></td>
      <td width="10%" height="25" align=center bgcolor="DEDFDE">&nbsp;</td>
      <td width="20%" height="25" align=center bgcolor="efefef">&nbsp;</td>
    </tr>	  
  </table>
</form>
<script language=javascript>
function save(){
	if (form1.product.value==''){
		alert('请选择产品!');
		form1.product.focus();
		return false;
	}
	if (form1.qty.value=='' || form1.qty.value<=0 || isNaN(form1.qty.value)){
		alert('请输入正确的数量!');
		form1.qty.focus();
		return false;
	}
	if (form1.cost.value==''){
		alert('请输入实际成本!');
		form1.cost.focus();
		return false;
	}
	if (isNaN(form1.cost.value)){
		alert('请输入数字!');
		form1.cost.focus();
		return false;
	}
	if (form1.locationname.value==''){
		alert('请选择货位!');
		form1.locationname.focus();
		return false;
	}
form1.submit();
}
	function calculateamount(){
		if (isNaN(form1.qty.value)){
		alert('请输入数字!');
		form1.qty.focus();
		return false;
		}
		form1.totalamount.value=form1.qty.value*form1.cost.value;
	}
	function recalculateamount(){
		if (isNaN(form1.cost.value)){
		alert('请输入数字!');
		form1.cost.focus();
		return false;
		}
		form1.totalamount.value=form1.qty.value*form1.cost.value;
	}
</script>
</body>
</html>

⌨️ 快捷键说明

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