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

📄 rkth_deal.asp

📁 企业进销存管理系统
💻 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 + -