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

📄 spxsth_deal.asp

📁 企业进销存管理系统
💻 ASP
字号:
<!--#include file="../conn/conn.asp"-->
<!-- #include file="../adovbs.inc"-->
<%
	if request.Form("jsr")<>"" then
		pzs_new=request.Form("pzs")
		pzs=0
		redim arr(pzs_new-1,2)
		for i=1 to pzs_new
			if request.Form("thsl"&i)>0 then
				pzs=pzs+1
				arr(i-1,0)=request.Form("spid"&i)
				arr(i-1,1)=request.Form("dj"&i)			
				arr(i-1,2)=request.Form("thsl"&i)				
			end if		
		next
		je=request.Form("yf")   '总金额
		thdate=now()
		operator=session("name")
		khname=request.Form("khname")
		yf=request.Form("yf")
		sf=request.Form("sf")
		wf=request.Form("wf")
		jsr=request.Form("jsr")
		jsfs=request.Form("jsfs")
		if wf=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_xsth" '指定存储过程名称 
		objCmd.Parameters.Append _ 
		objCmd.createparameter("pzs",adInteger,adparaminput)
		objCmd.Parameters.Append _ 
		objCmd.createparameter("je",adCurrency,adparaminput)
		objCmd.Parameters.Append _ 
		objCmd.createparameter("sf",adCurrency,adparaminput) 
		objCmd.Parameters.Append _ 
		objCmd.createparameter("khname",advarchar,adparaminput,100)	
		objCmd.Parameters.Append _ 
		objCmd.createparameter("thdate",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("xsthid",adVarchar,adParamOutput,30) 
		objCmd.Parameters("pzs")=pzs
		objCmd.Parameters("je")=je
		objCmd.Parameters("sf")=sf
		objCmd.Parameters("khname")=trim(khname)		
		objCmd.Parameters("thdate")=thdate      
		objCmd.Parameters("operator")=trim(operator)
		objCmd.Parameters("jsr")=trim(jsr)
		objCmd.Parameters("jsfs")=trim(jsfs)
		objCmd.Execute
		re_thid=objCmd.Parameters("xsthid")  '从存储过程中取回入库单号
		'-->
		'插入结帐主表
		sql="insert into tab_xsthjz_main values('"&re_thid&"',"&wf&",'"&whether&"')"
		conn.execute(sql)
		'插入结帐明细表
		sql="insert into tab_thjz_xs(thid, khname, bcjk, ye, jkdate,czy ,jsr) values('"&re_thid&"','"&khname&"',"&sf&","&wf&",'"&thdate&"','"&operator&"','"&jsr&"')"
		conn.execute(sql)		
		if pzs=0 then
			arr_spid=arr(0,0)
			arr_dj=arr(0,1)
			arr_sl=arr(0,2)	
				'插入明细表数据
			sql="insert into tab_xsth_detail values('"&re_thid&"','"&arr_spid&"',"&arr_dj&","&arr_sl&")"
			response.Write(sql)
			conn.execute(sql)		
			'更新库存表'
			sql="update tab_kucun set kcsl=kcsl+"&arr_sl&" where id='"&arr_spid&"'"
			conn.execute(sql)			
		else
			For j = 0 To UBound(arr)
				arr_spid=arr(j,0)
				arr_dj=arr(j,1)
				arr_sl=arr(j,2)	
					'插入明细表数据
				sql="insert into tab_xsth_detail values('"&re_thid&"','"&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
		end if
		conn.CommitTrans  '事务结束
		if err<>0 then
			conn.rollbackTrans  '事务回滚
		else
			response.Write("<script language='javascript'>alert('商品销售退货成功!');window.location.href='spxsth.asp';</script>")
		end if
	else
		response.Redirect("spxsth.asp")
		response.End()
	end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
</body>
</html>

⌨️ 快捷键说明

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