📄 savesalegoods.asp
字号:
<!--#include file="../include/top.asp"-->
<%
Set conn=Server.CreateObject("ADODB.Connection")
conn.connectionstring="Driver={Sql Server};Server=(local);UID=sa;database=DB_lsmanage"
conn.open
TypeName1=request("TypeName") '接收类别名称
yName=request("yName") '接收药品名称
Sl=trim(request("Sl")) '接收销售数量
set rs0=conn.execute("select sum(Sl) from tb_Sell where itType=1 and yName='"&yName&"' and UserId="&Session("UserID"))
if isnull(rs0(0)) or rs0(0)<=0 then '判断药品的库存数量
%>
<script language="javascript">
alert("该药品库存为0!");
window.history.back();
</script>
<%
response.End()
else
set rs1=conn.execute("select sum(Sl) from tb_Sell where itType=2 and yName='"&yName&"' and UserId="&Session("UserId"))
if isnull(rs1(0)) or rs1(0)<=0 then
if Sl-rs0(0)>0 then '判定药品销量是否大于库存数量
%>
<script language="javascript">
alert("销售量不能大于库存量!");
window.history.back();
</script>
<%
response.End()
end if
else
if Sl-(rs0(0)-rs1(0))>0 then
%>
<script language="javascript">
alert("销售量不能大于库存量!");
window.history.back();
</script>
<%
response.End()
end if
end if
end if
set rs=conn.execute("select * from tb_MedicineName where yName='"&yName&"'")
Mode1=rs("Mode")
Mode2=rs("Mode1")
Price=rs("Price")
TotalPrice=Sl*Price
Time1=now()
itType=2
UserId=Session("UserID")
set rs2=conn.execute("insert into tb_Sell (TypeName,yName,Mode,Price,Sl,TotalPrice,Time1,itType,UserId) values ('"&TypeName1&"','"&yName&"','"&Mode1&"','"&Price&"',"&Sl&","&TotalPrice&",'"&Time1&"',"&itType&",'"&UserId&"')")
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="34" bgcolor="#FFCC33"><div align="left"><span class=""> <img src="../images/borrow.gif"><span class="style2"><strong> 药品销售登记完成</strong></span></span></div></td>
</tr>
</table>
<p><br></p>
<table border="0" width="90%" cellpadding="4" cellspacing="1" bgcolor="#CCCC33">
<tr>
<td width="27%" height="144" align="right" bgcolor="#FFFFFF">
<div align="center"><strong>销售登记已完成</strong><br>
<br>
<strong>本次销售药品为:<%=yName%><br><br>共<%=Sl%><font color="#FF0000"><%=Mode1%> <%=Mode2%></font><br><br>
合计:(<%=TotalPrice%>元)</strong> </div>
</td>
</tr>
</table>
<!--#include file="../include/bottom.asp"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -