?? 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 + -