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

📄 newinventorysetting.asp

📁 1 除掉了 时间 限制 2 除掉了 人数 限制 改为 500人 原为5人 3 发现一点小缺陷 增加人员的时候没有判断 登陆名是否重复! 自己写吧~~~:) 4 又 是一点缺陷
💻 ASP
字号:
<!--#include file="../config.ini" -->
<!--#include file="../commfunction.inc" -->
<script language=javascript>
function inventorysettingselt(theForm,theName,theCode,thePrice,theOnwhseStatus)
{
	var theWindow;
	var theAccount;
	theWindow = window.open("selectwhseproduct.asp?theForm="+theForm+"&theName="+theName+"&theCode="+theCode+"&thePrice="+thePrice,"选择产品","toolbar=no,scrollbars=yes,location=no,status=no,menubar=no,width=520,height=320,top=150,left=160");
	theWindow.opener = this;
}
</script>
<%
Dim objcheck
Set objcheck=Server.CreateObject("SmartSales.CheckFunction")
objcheck.CheckUserFunction "inventory","edit"
set objcheck=nothing

if Request("id")<>"" then
	dim connq
	set connq=server.CreateObject("adodb.connection")
	connq.Open connstring
	sql="select * from v_InventorySetting where id="&Request("id")
	set rsq=connq.Execute(sql)
	productid=rsq("productid")
	productcode=rsq("productcode")
	product=rsq("product")
	onwhsestatus=rsq("onwhsestatus")
	Safetystock=rsq("Safetystock")
	refcost=rsq("refcost")
	StockCycle=rsq("StockCycle")
	WhseName=rsq("WhseName")
	whseid=rsq("whseid")
	lastdate=rsq("lastdate")

	rsq.Close
	set rsq=nothing
	connq.Close
	set connq=nothing
else
	productid=request("productid")
	productcode=getfieldvalue("product","productid",productid,"productcode")
	product=getfieldvalue("product","productid",productid,"model")
	refcost=getfieldvalue("product","productid",productid,"cost")
	whseid=request("whseid")
	WhseName=getfieldvalue("warehouse","whseid",whseid,"whse")
	lastdate=getfieldvalue("product_location","productid",productid,"lastdate")
end if

if request("product")<>"" 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 InventorySetting where productid='"&request("product")&"' and whseid='"&request("whse")&"'" ,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 InventorySetting",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 InventorySetting where id="&request("id"),conn,2,3,1
		rs("lastmoduser")=session("loginid")
		rs("lastmoddate")=now()
	end if
	
	rs("Productid")=request("product")
	rs("whseid")=request("whse")
	rs("Safetystock")=request("Safetystock")
	if request("StockCycle")<>"" then rs("StockCycle")=request("StockCycle") else rs("StockCycle")=null
	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 align="left" class=title> 
        <%if request("id")="" then response.write "新建安全库存" else response.write "编辑安全库存" %>
      </td>
      <td height="25" align="right"><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();"></td>
    </tr>
    <tr> 
      <td height="16" colspan="4" background="../images/title.gif">&nbsp;</td>
    </tr>
    <tr> 
      <td  colspan="4" height=4></td>
    </tr>
    <tr> 
      <td width="15%" height="25" align=center bgcolor="DEDFDE">型号</td>
      <td height="25" colspan="3" align="left" valign="middle" bgcolor="efefef"><font color=red> 
        <div name="productname" id="productname"><%=product%></div>
        </font> </td>
    </tr>
    <tr valign="middle"> 
      <td width="15%" height="25" align=center bgcolor="DEDFDE">货号</td>
      <td width="35%" 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:inventorysettingselt('form1','product','code','refcost')" value="..."  class=black <%if request("sign")="1" then response.write "disabled"%>> 
      </td>
      <td width="15%" height="25" align=center bgcolor="DEDFDE">参考成本</td>
      <td height="25" align=center bgcolor="efefef"> <div align="left"> 
          <input type=text name="refcost" size=6 readonly value="<%=refcost%>" >
        </div></td>
    </tr>
    <tr valign="middle"> 
      <td width="15%" height="25" align=center bgcolor="DEDFDE">安全库存</td>
      <td width="35%" height="25" bgcolor="efefef"> <input type=text name=Safetystock size=6 value=<%=Safetystock%>> 
      </td>
      <td width="15%" bgcolor="DEDFDE" align="center">库存周期</td>
      <td bgcolor="efefef"> <select name="StockCycle">
          <%if request("id")="" then%>
          <option value=""></option>
          <%else%>
          <option value="<%=StockCycle%>"><%=StockCycle%>个工作日</option>
          <%end if%>
          <option value="5">5个工作日</option>
          <option value="10">10个工作日</option>
          <option value="20">20个工作日</option>
          <option value="30">30个工作日</option>
          <option value="40">40个工作日</option>
          <option value="60">60个工作日</option>
        </select> </td>
    </tr>
    <tr valign="middle"> 
      <td width="15%" height="25" align=center bgcolor="DEDFDE">仓库</td>
      <td width="35%" height="25" bgcolor="efefef"> <input type="hidden" name="whse" value="<%=whseid%>"> 
        <input name="whsename" type="text" size="14" value="<%=whsename%>" readonly> 
        <input type="button" name="bnwhse" onClick="JavaScript:if(form1.product.value==''){alert('请先选择产品');}else{inventorysettingselt('form1','whse')}"    value=... class=black <%if request("sign")="1" then response.write "disabled"%>> 
      </td>
      <td width="15%" bgcolor="DEDFDE" align="center">最近库存更新</td>
      <td bgcolor="efefef"><%=lastdate%></td>
    </tr>
  </table>
</form>
<script language=javascript>
function save(){
	if (form1.code.value==''){
		alert('请选择产品!');
		form1.code.focus();
		return false;
	}
	if (form1.Safetystock.value=='' || form1.Safetystock.value<=0 || isNaN(form1.Safetystock.value)){
		alert('请输入正确的数量!');
		form1.Safetystock.focus();
		return false;
	}
	if (form1.whsename.value==''){
		alert('请选择仓库!');
		form1.whsename.focus();
		return false;
	}
form1.submit();
}
	function calculateamount(){
		if (isNaN(form1.Safetystock.value)){
		alert('请输入数字!');
		form1.Safetystock.focus();
		return false;
		}
		form1.amount.value=floatRound(form1.Safetystock.value*form1.refcost.value,2);
	}

function floatRound(myFloat,mfNumber)
{
         var cutNumber = Math.pow(100,mfNumber-1);
         return Math.round(myFloat * cutNumber)/cutNumber;
}
</script>
</body>
</html>

⌨️ 快捷键说明

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