?? rkth_deal.asp
字號:
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--#include file="../conn/conn.asp"-->
<!-- #include file="../adovbs.inc"-->
<%
if isarray(session("arr_rt")) then
arr=session("arr_rt")
pzs=ubound(arr,1)+1 '品種數
je=request.Form("ys") '總金額
rkthdate=now()
operator=session("name")
gysname=request.Form("gysname")
ys=request.Form("ys")
ss=request.Form("ss")
ws=request.Form("ws")
jsr=request.Form("jsr")
jsfs=request.Form("jsfs")
if ws=0 then
whether="是"
else
whether="否"
end if
on error resume next
conn.BeginTrans '事務開始
'<!--調用存儲過程插入退貨主表信息
set objCmd=Server.CreateObject("Adodb.Command")
objCmd.ActiveConnection=conn
objCmd.CommandType=adCmdStoredProc '其為Stored Procedure
objCmd.CommandText="P_rkth" '指定存儲過程名稱
objCmd.Parameters.Append _
objCmd.createparameter("pzs",adInteger,adparaminput)
objCmd.Parameters.Append _
objCmd.createparameter("je",adCurrency,adparaminput)
objCmd.Parameters.Append _
objCmd.createparameter("ss",adCurrency,adparaminput)
objCmd.Parameters.Append _
objCmd.createparameter("gysname",advarchar,adparaminput,100)
objCmd.Parameters.Append _
objCmd.createparameter("rkthdate",advarchar,adparaminput,20)
objCmd.Parameters.Append _
objCmd.createparameter("operator",advarchar,adparaminput,30)
objCmd.Parameters.Append _
objCmd.createparameter("jsr",advarchar,adparaminput,30)
objCmd.Parameters.Append _
objCmd.createparameter("jsfs",advarchar,adparaminput,10)
objCmd.Parameters.Append _
objCmd.CreateParameter("rkthid",adVarchar,adParamOutput,30)
objCmd.Parameters("pzs")=pzs
objCmd.Parameters("je")=je
objCmd.Parameters("ss")=ss
objCmd.Parameters("gysname")=trim(gysname)
objCmd.Parameters("rkthdate")=rkthdate
objCmd.Parameters("operator")=trim(operator)
objCmd.Parameters("jsr")=trim(jsr)
objCmd.Parameters("jsfs")=trim(jsfs)
objCmd.Execute
re_rkthid=objCmd.Parameters("rkthid") '從存儲過程中取回退貨單號
'-->
'插入結賬主表
sql="insert into tab_rkthjz_main values('"&re_rkthid&"',"&ws&",'"&whether&"')"
conn.execute(sql)
'加入入庫退貨票號表'
sql="insert into tab_thjz_rk(thid, gysname, bcjk, ye, jkdate,czy ,jsr) values('"&re_rkthid&"','"&gysname&"',"&ss&","&ws&",'"&rkthdate&"','"&czy&"','"&jsr&"')"
conn.execute(sql)
For I = 0 To ubound(arr,1)
arr_spid=arr(I, 0)
arr_dj=arr(I,1)
arr_sl=arr(I,2)
set arr_rs=Server.CreateObject("ADODB.RecordSet")
sql1="select * from tab_kucun where id='"&arr_spid&"'"
arr_rs.open sql1,conn,1,3
if arr_rs.bof and arr_rs.eof then
response.Write("<script>alert('您的操作有誤!');window.location.href='rkth.asp';</script>")
session("arr_rt")=""
response.End()
end if
'插入明細表數據
sql="insert into tab_rkth_detail values('"&re_rkthid&"','"&arr_spid&"',"&arr_dj&","&arr_sl&")"
conn.execute(sql)
'更新庫存表'
sql="update tab_kucun set kcsl=kcsl-"&arr_sl&" where id='"&arr_spid&"'"
conn.execute(sql)
Next
conn.CommitTrans '事務結束
if err<>0 then
conn.rollbackTrans '事務回滾
response.Write("<script language='javascript'>alert('退貨數據出錯,請檢查后重新登記!');window.location.href='rkth.asp';</script>")
else
session("arr_rt")=""
response.Write("<script language='javascript'>alert('入庫退貨成功!\n\r您的入庫退貨票號為"&re_rkthid&"!');window.location.href='rkth.asp';</script>")
end if
end if
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -