📄 inventory.asp
字号:
<!--#include file="../config.ini" -->
<!--#include file="../commfunction.inc" -->
<%
Dim objcheck
Set objcheck=Server.CreateObject("SmartSales.CheckFunction")
objcheck.CheckUserFunction "inventory","read"
set objcheck=nothing
dim conn
dim rs
set conn=server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
conn.Open connstring
if Request("strfield")<>"" then
strwhere=" and "&request("strfield")&" like '%"&request("strvalue")&"%'"
end if
if Request.Form("strfield")<>"" then
strwhere=" and "&request("strfield")&" like '%"&request.form("strvalue")&"%'"
end if
'按在库情况显示
if request("whsstatus")<>"" then
session("whsstatus")=request("whsstatus")
end if
if session("whsstatus")="" then
session("whsstatus")="code1"
end if
if session("whsstatus")="code1" then
strwhere=strwhere & "and (qty_on_hand >0)"
elseif session("whsstatus")="code2" then
strwhere=strwhere & "and (qty_on_hand=0)"
elseif session("whsstatus")="code3" then
strwhere=strwhere & "and (qty_rsvd>0)"
elseif session("whsstatus")="code4" then
strwhere=strwhere & "and (nonnet=1)"
elseif session("whsstatus")="code5" then
strwhere=strwhere
end if
'response.write strwhere&"<br>"
'response.write request("whsstatus")&"<br>"
if Request.QueryString("orderbyfield")<>"" then
'排序字段改变返回首页
if session("orderbyfield")<>Request.QueryString("orderbyfield") then
tofirstpage=true
else
tofirstpage=false
end if
'翻页时保持排序方式,不翻页循环改变升序/降序
if request("turnpage")="" then
if request("orderby")="" or request("orderby")="desc" then
session("orderby")="asc"
else
session("orderby")="desc"
end if
strwhere=strwhere & " order by "&Request.QueryString("orderbyfield")&" "&session("orderby")
else
if request("orderbyfield")<>"" then
strwhere=strwhere & " order by "&Request.QueryString("orderbyfield")&" "&session("orderby")
end if
end if
'保存当前排序字段
session("orderbyfield")=Request.QueryString("orderbyfield")
end if
rs.Open "select * from v_inventoryall where 1=1"&strwhere,conn,1,1
'搜索时用
selecttablename="v_inventoryall"
if Request.QueryString("CurPage") = "" or Request("CurPage") = 0 then
CurPage = 1
else
CurPage = ccur(Request.QueryString("CurPage"))
end If
if not Rs.eof then
Rs.PageSize=session("PageSize")
Rs.AbsolutePage=CurPage
else
CurPage=0
end if
%>
<html>
<head>
<LINK href="../global.css" rel=STYLESHEET type=text/css>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>库存列表</title>
<script language=javascript>
window.top.frames (1).document.location='../left.asp?type=inventory';
</script>
</head>
<SCRIPT language=JavaScript>
function relativeinput_onchange()
{
if (form1.strfield.value=="Whse"){
strvalue1.style.display='none';
strvalue2.style.display='block';
form1.strvalue1.value="";
}
if (form1.strfield.value!="Whse"){
strvalue1.style.display='block';
strvalue2.style.display='none';
form1.strvalue2.value="";
}
}
function GetStrValue()
{
if (form1.strfield.value!="Whse"){
form1.strvalue.value=form1.strvalue1.value;
}
if (form1.strfield.value=="Whse"){
form1.strvalue.value=form1.strvalue2.value;
}
form1.submit();
}
</SCRIPT>
<body leftmargin="10" rightmargin="0" topmargin="10">
<form name="form1" method="post" action="inventory.asp" onsubmit="return GetStrValue();">
<table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="8%"><select name="strfield" onchange="relativeinput_onchange();">
<option value=model <%if request("strfield")="model" then Response.Write "selected"%>>型号</option>
<option value=productcode <%if request("strfield")="productcode" then Response.Write "selected"%>>货号</option>
<option value=Whse <%if request("strfield")="Whse" then Response.Write "selected"%>>仓库</option>
<option value=qty_on_hand <%if request("strfield")="qty_on_hand" then Response.Write "selected"%>>在库量</option>
<option value=qty_rsvd <%if request("strfield")="qty_rsvd" then Response.Write "selected"%>>保留量</option>
</select></td>
<td width="18%">
<div id=strvalue1 <%if request("strfield")<>"Whse" then response.write "style=display:block" else response.write "style=display:none" end if%>>
<input type="text" name="strvalue1" value="<%=request("strvalue1")%>">
</div>
<div id=strvalue2 <%if request("strfield")="Whse" then response.write "style=display:block" else response.write "style=display:none" end if%>>
<select name="strvalue2" class="stedit">
<option value="">--请选择仓库--</option>
<%getgrouptype selecttablename,"Whse",request("strvalue2")%>
</select></div>
</td>
<td>
<input type=HIDDEN name="strvalue" value="<%=request("strvalue")%>" >
<input type=image src="../images/button_submit.gif" style="cursor:hand" border=0>
<%
if CurPage<=1 then
Response.Write "<a href='inventory.asp?turnpage=yes&orderby="&session("orderby")&"&orderbyfield="&request("orderbyfield")&"&strvalue="&request("strvalue")&"&strfield="&request("strfield")&"&CurPage=1'><img src='../images/button_start.gif' border=0></a> "
else
Response.Write "<a href='inventory.asp?turnpage=yes&orderby="&session("orderby")&"&orderbyfield="&request("orderbyfield")&"&strvalue="&request("strvalue")&"&strfield="&request("strfield")&"&CurPage=1'><img src='../images/button_start.gif' border=0></a> "
Response.Write "<a href='inventory.asp?turnpage=yes&orderby="&session("orderby")&"&orderbyfield="&request("orderbyfield")&"&strvalue="&request("strvalue")&"&strfield="&request("strfield")&"&CurPage="&CurPage-1&"'><img src='../images/button_backward.gif' border=0></a> "
end if
if CurPage>=RS.PageCount then
Response.Write "<a href='inventory.asp?turnpage=yes&orderby="&session("orderby")&"&orderbyfield="&request("orderbyfield")&"&strvalue="&request("strvalue")&"&strfield="&request("strfield")&"&CurPage="&RS.PageCount&"'><img src='../images/button_end.gif' border=0></a>"
else
Response.Write "<a href='inventory.asp?turnpage=yes&orderby="&session("orderby")&"&orderbyfield="&request("orderbyfield")&"&strvalue="&request("strvalue")&"&strfield="&request("strfield")&"&CurPage="&CurPage+1&"'><img src='../images/button_forward.gif' border=0></a> "
Response.Write "<a href='inventory.asp?turnpage=yes&orderby="&session("orderby")&"&orderbyfield="&request("orderbyfield")&"&strvalue="&request("strvalue")&"&strfield="&request("strfield")&"&CurPage="&RS.PageCount&"'><img src='../images/button_end.gif' border=0></a>"
end if
%>
</td>
<td width=30% valign="middle">
<select name=whsstatus size=0 onchange="javascript:form1.submit();">
<option value="code1"<%if session("whsstatus")="code1" then response.write " selected"%>>在库量大于零</option>
<option value="code2"<%if session("whsstatus")="code2" then response.write " selected"%>>在库量等于零</option>
<option value="code3"<%if session("whsstatus")="code3" then response.write " selected"%>>保留量大于零</option>
<option value="code4"<%if session("whsstatus")="code4" then response.write " selected"%>>非净库存</option>
<option value="code5"<%if session("whsstatus")="code5" then response.write " selected"%>>所有明细</option>
</select></td>
</tr>
<tr>
<td height="25" colspan="3"><strong><font class=title>库存列表</font></strong> </td>
<td height="25" align="right" class="title"> </td>
</tr>
<tr >
<td height="16" colspan="4" background="../images/title.gif"> </td>
</tr>
<tr>
<td height=4></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="DECFAD">
<tr bgcolor="efefef">
<td height=22 width="10%" align=center><a href="inventory.asp?CurPage=<%=CurPage%>&strfield=<%=request("strfield")%>&strvalue=<%=request("strvalue")%>&orderbyfield=productcode&orderby=<%=session("orderby")%>">货号</a></td>
<td align=center><a href="inventory.asp?CurPage=<%=CurPage%>&strfield=<%=request("strfield")%>&strvalue=<%=request("strvalue")%>&orderbyfield=model&orderby=<%=session("orderby")%>">型号</a></td>
<td width="10%" align=center><a href="inventory.asp?CurPage=<%=CurPage%>&strfield=<%=request("strfield")%>&strvalue=<%=request("strvalue")%>&orderbyfield=producttypename&orderby=<%=session("orderby")%>">产品类型</a></td>
<td width="10%" align=center><a href="inventory.asp?CurPage=<%=CurPage%>&strfield=<%=request("strfield")%>&strvalue=<%=request("strvalue")%>&orderbyfield=whse&orderby=<%=session("orderby")%>">仓库</a></td>
<td width="8%" align=center><a href="inventory.asp?CurPage=<%=CurPage%>&strfield=<%=request("strfield")%>&strvalue=<%=request("strvalue")%>&orderbyfield=qty_on_hand&orderby=<%=session("orderby")%>">可用量</a></td>
<td width="8%" align=center><a href="inventory.asp?CurPage=<%=CurPage%>&strfield=<%=request("strfield")%>&strvalue=<%=request("strvalue")%>&orderbyfield=qty_on_hand&orderby=<%=session("orderby")%>">在库量</a></td>
<td width="8%" align=center><a href="inventory.asp?CurPage=<%=CurPage%>&strfield=<%=request("strfield")%>&strvalue=<%=request("strvalue")%>&orderbyfield=qty_rsvd&orderby=<%=session("orderby")%>">保留量</a></td>
<td width="8%" align=center><a href="inventory.asp?CurPage=<%=CurPage%>&strfield=<%=request("strfield")%>&strvalue=<%=request("strvalue")%>&orderbyfield=nonnet&orderby=<%=session("orderby")%>">非净库存</a></td>
<td width="10%" align=center><a href="inventory.asp?CurPage=<%=CurPage%>&strfield=<%=request("strfield")%>&strvalue=<%=request("strvalue")%>&orderbyfield=onwhsestatus&orderby=<%=session("orderby")%>">在库状态</a></td>
</tr>
<%i=1:do while not rs.EOF and i<=session("pagesize")%>
<%if rs("nonnet") then%>
<tr bgcolor="#FFFFFF">
<%end if%>
<%
set rsi=conn.execute("select * from InventorySetting where productid="&rs("productid"))
if not rsi.eof then
safetystock=rsi("safetystock")
inventorysettingid=rsi("id")
else
safetystock=""
inventorysettingid=0
end if
%>
<tr bgcolor="#FFFFFF">
<td height=22 align=center><a href="javascript:opensubwin('resizable=yes, scrollbars=no, left= 200, top=100, menubar=no, location=no, toolbar=no ,width=500, height=250','../product/productdetail.asp?productid=<%=rs("productid")%>');"><%=rs("productcode")%></a></td>
<td align=center><a href="javascript:opensubwin('resizable=yes, scrollbars=no, left= 200, top=100, menubar=no, location=no, toolbar=no ,width=500, height=250','../product/productdetail.asp?productid=<%=rs("productid")%>');"><%=rs("model")%></a></td>
<td align=center><%=rs("producttypename")%></td>
<td align=center><%=rs("whse")%></td>
<td align=center><%=rs("qty_on_hand")-rs("qty_rsvd")%></td>
<td align=center><a href="javascript:opensubwin('resizable=yes, scrollbars=no, left= 150, top=100, menubar=no, location=no, toolbar=no ,width=550, height=300','inventorydetail.asp?productid=<%=rs("productid")%>&nonnet=<%=rs("nonnet")%>');" title="查看产品在货位上的分布,调准平均成本"><%=rs("qty_on_hand")%></a></td>
<td align=center><a href="javascript:opensubwin('resizable=yes, scrollbars=yes, left= 150, top=100, menubar=no, location=no, toolbar=no ,width=550, height=200','inventoryreservedetail.asp?productid=<%=rs("productid")%>');" title="查看库存保留明细"><%=rs("qty_rsvd")%></a></td>
<td align=center>
<%if rs("nonnet") then Response.Write "是" else Response.Write "否"%>
</td>
<td align=center>
<%response.write rs("onwhsestatus")%>
</td>
</tr>
<%
i=i+1
rs.MoveNext
loop
%>
</table>
<%
dim totalonhandqty
dim totalreserveqty
dim availabledqty
totalonhandqty=0
totalreserveqty=0
availabledqty=0
if i>1 then
rs.Movefirst:do while not rs.EOF
totalonhandqty=totalonhandqty+ccur(rs("qty_on_hand"))
totalreserveqty=totalreserveqty+ccur(rs("qty_rsvd"))
availabledqty=totalonhandqty-totalreserveqty
rs.MoveNext
loop
end if
%>
<BR>
<table width="100%" cellpadding="0" cellspacing="1" bgcolor="#DECFAD">
<tr><td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr height="22">
<td valign="middle" width="2%"><IMG SRC="../images/smallprompt.jpg"></td>
<td align="center"><font color="#CC0099"> 在库数量:<%=totalonhandqty%></font></td>
<td align="center"><font color="#CC0099"> 可用数量:<%=availabledqty%></font></td>
<td align="center"><font color="#CC0099"> 保留数量:<%=totalreserveqty%></font></td>
</table>
</td></tr></table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr height="50"><td>第<%=CurPage%>页 / 共<%=RS.PageCount%>页 / 记录数:<%=Rs.RecordCount%>条
</td></tr></table>
<%
rs.Close
set rs=nothing
conn.Close
set conn=nothing
%>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -