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

📄 spsladmin.asp

📁 超市商品信息系统
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Inc/Dataconn.asp" -->
<!--#include file="Inc/Funcs.asp" -->
<%
Call CheckAdmin
if request.form("Action")="SearchSP" then
	SPName=Trim(request.form("SPName"))
	if SPName="" then
		call eMessage("请输入商品名称!")
	end if 
	SQLStr="Select SPID,SPName from SP where SPName like '%"& SPName &"%'"
	rS.open SQLStr,conn,1,1
	if rS.eof and rS.bof then
		call eMessage("无相关商品!")
		IfHaveSP=false
	end if
		IfHaveSP=true
end if
'商品入库
if request.Form("Action")="SaveSPINSL" then
	SPID=request.Form("SPID")
	KCDate=Now()
	KCBD="入库"
	InSL=request.Form("InSL")
	if InSL="0" or InSL="" then
		call eMessage("请填写入库数量!")
	end if 
	SPPrice=request.Form("SPPrice")
	if SPPrice="0.00" or SPPrice="" then
		call eMessage("请填写入库价格!")
	end if 
	SPTotalMoney=Cint(InSL)*Csng(SPPrice)
	Operator=session("User")
	if Operator="" then
		call eMessage("请先登录再进行操作!")
	end if
	SQLStr="Insert into KC(SPID,KCDate,KCBD,InSL,SPPrice,SPTotalMoney,Operator) values("&SPID&",'"&KCDate&"','"&KCBD&"',"&InSL&","&SPPrice&","&SPTotalMoney&",'"&Operator&"')"
	conn.Execute SQLStr
	Call message("入库成功!")
end if
'商品出库
if request.Form("Action")="SaveSPOutSL" then
	SPID=request.Form("SPID")
	KCDate=Now()
	KCBD="出库"
	OutSL=request.Form("OutSL")
	'判断是否填写了出库数量
	if OutSL="0" or OutSL="" then
		call eMessage("请填写出库数量!")
	end if 
	if JudgeSPINKC(SPID)=false then
		call eMessage("该商品还没有入库,请先入库!")
	end if
	if GetSPKCSLBYSPID(SPID)< Cint(OutSL) then
		call eMessage("该商品库存数量不足!")
	end if
	SPPrice=request.Form("SPPrice")
	'判断是否填写了出库数量
	if SPPrice="0.00" or SPPrice="" then
		call eMessage("请填写出库价格!")
	end if 
	SPTotalMoney=Cint(OutSL)*Csng(SPPrice)
	Operator=session("User")
	if Operator="" then
		call eMessage("请先登录再进行操作!")
	end if
	SQLStr="Insert into KC(SPID,KCDate,KCBD,OutSL,SPPrice,SPTotalMoney,Operator) values("&SPID&",'"&KCDate&"','"&KCBD&"',"&OutSL&","&SPPrice&","&SPTotalMoney&",'"&Operator&"')"
	conn.Execute SQLStr
	Call message("出库成功!")
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>商品数量维护</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<link href="Inc/css.css" rel="stylesheet" type="text/css" />
<!--#include file="Inc/hlink.asp" -->
<style type="text/css">
<!--
.STYLE5 {
	font-size: 14px;
	color: #000033;
}
.STYLE6 {color: #FF0000}
-->
</style>
</head>

<body>
<table width="612" height="450" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  <tr>
    <td valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
      <tr>
        <td height="25" colspan="2" align="center" background="Images/tbtitle.jpg"><span class="STYLE5">商品库存维护</span></td>
      </tr>
	  <form action="SPSLAdmin.asp" name="form1" id="form1" method="post">
      <tr>
        <td height="20" colspan="2" bgcolor="#FFFFFF" class="Txt">&nbsp; 商品名称(可模糊查询、添加出/入库记录):
          <input name="SPName" type="text" class="InputStyle" id="SPName" />
          <input name="Action" type="hidden" id="Action" value="SearchSP" />
          <input name="Submit" type="submit" class="Button1" value="查询" /></td>
      </tr>
	  </form>
	  <form action="SPSLAdmin.asp" name="form4" id="form4" method="post">
      <tr>
        <td height="20" bgcolor="#FFFFFF" class="Txt">  搜索商品出/入库记录(可模糊查询):
          <input name="SPName" type="text" class="InputStyle" id="SPName" />
          <input name="SearchKC" type="hidden" id="SearchKC" value="SearchKCREC" />
          <input name="Submit3" type="submit" class="Button1" value="查询" /></td>
        <td height="20" align="center" bgcolor="#FFFFFF" class="Txt"><a href="SPSLAdmin.asp?Action=ShowAllKC" >所有出入库记录</a></td>
      </tr>
	  </form>
	  <%if request("Action")="SearchSP" and IfHaveSP=true then
	  for i=1 to rS.recordcount
	  %>
      <tr>
        <td width="530" height="20" bgcolor="#FFFFFF" class="Txt"> 商品编号:<%=rS(0)%> 商品名称:<%=rS(1)%></td>
        <td width="100" align="center" bgcolor="#FFFFFF" class="Txt"><a href="SPSLAdmin.asp?Action=InCreaseOrDeCrease&Action2=InCrease&SPID=<%=rS(0)%>">入库</a>  <a href="SPSLAdmin.asp?Action=InCreaseOrDeCrease&Action2=DeCrease&SPID=<%=rS(0)%>" class="Txt2">出库</a></td>
      </tr>
	  <%
	  rS.movenext
	  next
	  rS.close
	  end if%>
	  <% '点击入库时显示的类容
	  if request.QueryString("Action")="InCreaseOrDeCrease" and request.QueryString("Action2")="InCrease" then
	  	SPID=request.querystring("SPID")
	  	SQLStr="Select SPID,SPName from SP where SPID="&request.querystring("SPID")
		rS.open SQLStr,conn,1,1
	%>
	<form name="form3" id="form3" method="post" action="SPSLAdmin.asp">
      <tr>
        <td width="530" height="20" bgcolor="#FFFFFF" class="Txt"> 商品名称:<%=rS(1)%> 入库数量:
          <input name="InSL" type="text" class="InputStyleShort" id="InSL" value="0" size="5" maxlength="4" /> 
          入库价格:
          <input name="SPPrice" type="text" class="InputStyleShort" id="SPPrice" value="0.00" size="7" maxlength="6" /></td>
        <td width="100" align="center" bgcolor="#FFFFFF" class="Txt"><input name="SPID" type="hidden" id="SPID" value="<%=SPID%>" />
          <input name="Action" type="hidden" id="Action" value="SaveSPINSL" />
          <input name="Submit2" type="submit" class="Button1" value="入库" /></td>
      </tr>
	</form>
	<%rS.close
	end if
	%>
	<%  '点击出库时显示的类容
	if request.QueryString("Action")="InCreaseOrDeCrease" and request.QueryString("Action2")="DeCrease" then
	  	SPID=request.querystring("SPID")
	  	SQLStr="Select SPID,SPName from SP where SPID="&request.querystring("SPID")
		rS.open SQLStr,conn,1,1
	%>
	<form name="form4" id="form4" method="post" action="SPSLAdmin.asp">
      <tr>
        <td width="530" height="20" bgcolor="#FFFFFF" class="Txt"> 商品名称:<%=rS(1)%> 出库数量(<span class="STYLE6">库存:<%=GetSPKCSLBYSPID(SPID)%></span>):
          <input name="OutSL" type="text" class="InputStyleShort" id="OutSL" value="0" size="5" maxlength="4" /> 
          出库价格:
          <input name="SPPrice" type="text" class="InputStyleShort" id="SPPrice" value="0.00" size="7" maxlength="6" /></td>
        <td width="100" align="center" bgcolor="#FFFFFF" class="Txt"><input name="SPID" type="hidden" id="SPID" value="<%=SPID%>" />
          <input name="Action" type="hidden" id="Action" value="SaveSPOutSL" />
          <input name="Submit2" type="submit" class="Button1" value="出库" /></td>
      </tr>
	</form>
	  <%
	  rS.close
	  end if%>
    </table>
	<%if request.QueryString("Action")="ShowAllKC" or request.Form("SearchKC")="SearchKCREC" then%>
	<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#666666">
  <tr>
    <td height="25" align="center" background="Images/tbtitle.jpg" class="Txt">商品名称</td>
    <td align="center" background="Images/tbtitle.jpg" class="Txt">出/入库时间</td>
    <td align="center" background="Images/tbtitle.jpg" class="Txt">出/入库</td>
    <td align="center" background="Images/tbtitle.jpg" class="Txt">入库数量</td>
    <td align="center" background="Images/tbtitle.jpg" class="Txt">出库数量</td>
    <td align="center" background="Images/tbtitle.jpg" class="Txt">单价</td>
    <td align="center" background="Images/tbtitle.jpg" class="Txt">总价</td>
    <td align="center" background="Images/tbtitle.jpg" class="Txt">操作人</td>
  </tr>
  <%  '搜寻库存记录
  if request.Form("SearchKC")="SearchKCREC" then
  		SPName=request.Form("SPName")
  		SQLStr="Select * From KC where SPID in (select SPID from SP where SPName like '%"&SPName&"%') order by KCDate desc"
  else
  		SQLStr="Select * From KC order by KCDate desc"
  end if
  rS.open SQLStr,conn,1,1
  for i=1 to rS.recordcount
  %>
  <tr>
    <td height="20" align="center" bgcolor="#FFFFFF" class="Txt"><%=GetSPNameBySPID(rS(1))%></td>
    <td align="center" bgcolor="#FFFFFF" class="Txt"><%=rS(2)%></td>
    <td align="center" class="Txt" <% if trim(rS(3)) ="出库" then response.Write("bgcolor='#ccccff'") else response.Write("bgcolor='#cceeff'") end if%>><%=rS(3)%></td>
    <td align="center" class="Txt" <% if trim(rS(3)) ="入库" then response.Write("bgcolor='#cceeff'") else response.Write("bgcolor='#ccccff'") end if%>><%=rS(4)%></td>
    <td align="center" class="Txt" <% if trim(rS(3)) ="出库" then response.Write("bgcolor='#ccccff'") else response.Write("bgcolor='#cceeff'") end if%>><%=rS(5)%></td>
    <td align="center" class="Txt" <% if trim(rS(3)) ="入库" then response.Write("bgcolor='#cceeff'") else response.Write("bgcolor='#ccccff'") end if%>><%=rS(6)%></td>
    <td align="center" class="Txt" <% if trim(rS(3)) ="入库" then response.Write("bgcolor='#cceeff'") else response.Write("bgcolor='#ccccff'") end if%>><%=rS(7)%></td>
    <td align="center" bgcolor="#FFFFFF" class="Txt"><%=rS(8)%></td>
  </tr>
  <%rS.movenext
  next
  rS.close%>
  <tr>
    <td height="20" colspan="8" align="right" bgcolor="#FFFFFF" class="Txt">入库总数量:<%=GetInKCSPCountOrSPTMoney("","TSL")%> 总金额:¥<%=GetInKCSPCountOrSPTMoney("","TMoney")%> 出库总数量:<%=GetOutKCSPCountOrSPTMoney("","TSL")%> 总金额:¥<%=GetOutKCSPCountOrSPTMoney("","TMoney")%>&nbsp;</td>
    </tr>
</table>
	<%end if%>
	</td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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