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

📄 odd_edit_no.asp

📁 物流进销存系统 全功能,MSSQL 2000数据库. 可做物流公司信息系统开发的源程序
💻 ASP
字号:
<%@ LANGUAGE="VBSCRIPT" %>
<% 
response.buffer=true
Response.Expires = 0
Response.CacheControl = "Private"
%>
<%const title="出库详细信息修改"%>
<!-- #include file=../data/username.inc-->
<!-- #include file=../data/connect.asp-->
<!--#include file=../data/myPrg.asp-->
<html>
<head>
<meta http-equiv="Content-Type"content="text/html; charset=gb_2312-80">
<title><%=title%></title>
<link rel="stylesheet" type="text/css" href="../data/forum.css">
</head>
<body topmargin="0"  onload="javascript:self.moveTo(0,0)">
<%
if isempty(session("username")) then
	call closedatabase
	Response.Write "请重新登入!"
	Response.End 
end if 
newcompanyid = request("companyid")
if newcompanyid = "" then
	call closedatabase
	Response.Write "<script language=javascript>"
	Response.Write "alert(""请先选择公司再做此步操作!"");"
	Response.write "history.go(-1);"
	Response.Write "</script>"
	Response.End
elseif not isnumeric(newcompanyid) then
	call closedatabase
	Response.Write "<script language=javascript>"
	Response.Write "alert(""companyid必须为整数!"");history.go(-1);"
	Response.Write "</script>"
	Response.End
else
	newcompanyid = cint(newcompanyid)  
end if
arra = split(session("username"),";")
UserCompanyid = arra(0)
flag = arra(1)
User = arra(2)
userno = arra(4)
detail_id = request("detail_id")
if not isnumeric(detail_id) then
	call closedatabase
	Response.Write "<script language=javascript>"
	Response.Write "alert(""ID必须为数字!"");"
	Response.write "history.go(-1);"
	Response.Write "</script>"
	Response.End
end if
ziti_flag = request("ziti_flag")
if flag > 4 then
	call closedatabase
	Response.End 
end if
if Request.ServerVariables("REQUEST_METHOD")="POST" then
			dim detail_no_now
			dim prod_id_now
			detail_no_now = clng(trim(request("detail_no")))
			prod_id_now = Request("prod_id")
			sql = "select * from outward_detail where detail_id = "&detail_id&" "
			set rs_xx = conn.execute(sql)
			if not rs_xx.eof then
				prod_id = rs_xx("detail_prod_id")
				detail_no = rs_xx("detail_no")
				elink_id = rs_xx("detail_elink_id")
				no = clng(detail_no_now) - clng(detail_no)
								
					'取得该单子的记录标志,以便于判断
					sql = "select elink_dc_id,elink_dir_flag,elink_flag from outward_elink where elink_id = "&elink_id&" "
					set rs_elink = conn.execute(sql)
					if not rs_elink.eof then
						elink_dc_id = rs_elink("elink_dc_id")
						elink_dir_flag = rs_elink("elink_dir_flag")
						elink_flag = rs_elink("elink_flag")
					else
						rs_elink.close
						set rs_elink = nothing
						rs_xx.close
						set rs_xx = nothing
						call closedatabase
						Response.Write "<script language=javascript>"	
						Response.Write "{opener.location.reload();window.close();}"		
						Response.Write "</script>"
						Response.End 
					end if
					rs_elink.close
					set rs_elink = nothing
										
					if cstr(prod_id) <> cstr(prod_id_now) then	
						if elink_flag <> 1 then	
							if ziti_flag = 0 then			
								sql = "update inventory set inve_fenpei = inve_fenpei - "&detail_no&",inve_maysent = inve_maysent + "&detail_no&",inve_total = inve_total + "&detail_no&" "
								sql = sql + " where inve_dc_id = "&elink_dc_id&" and inve_prod_id = "&prod_id&" "
								conn.execute(sql)
							end if
							if no = 0 then
								if ziti_flag = 0 then
								sql = "update inventory set inve_fenpei = inve_fenpei + "&detail_no&",inve_maysent = inve_maysent - "&detail_no&",inve_total = inve_total - "&detail_no&" "
								sql = sql + " where inve_dc_id = "&elink_dc_id&" and inve_prod_id = "&prod_id_now&" "
								conn.execute(sql)
								end if
								sql = "update outward_detail set detail_prod_id = "&prod_id_now&" where detail_id = "&detail_id&" " 
								conn.execute(sql)
							else
								if ziti_flag = 0 then
								sql = "update inventory set inve_fenpei = inve_fenpei + "&detail_no_now&",inve_maysent = inve_maysent - "&detail_no_now&",inve_total = inve_total - "&detail_no_now&" "
								sql = sql + " where inve_dc_id = "&elink_dc_id&" and inve_prod_id = "&prod_id_now&" "
								conn.execute(sql)
								end if
								sql = "update outward_detail set detail_prod_id = "&prod_id_now&",detail_no = "&detail_no_now&"  where detail_id = "&detail_id&" " 
								conn.execute(sql)
							end if
						elseif elink_flag = 1 then
							'更新原有记录的库存
							'再更新为现修改的产品的库存
							'再更新现记录的数量
							if ziti_flag = 0 then
							sql = "update inventory set inve_chuku = inve_chuku - "&detail_no&",inve_maysent = inve_maysent + "&detail_no&",inve_total= inve_total + "&detail_no&" "
							sql = sql + " where inve_dc_id = "&elink_dc_id&" and inve_prod_id = "&prod_id&" "
							conn.execute(sql)
							end if
							if no = 0 then
								if ziti_flag = 0 then
								sql = "update inventory set inve_chuku = inve_chuku + "&detail_no&",inve_maysent = inve_maysent - "&detail_no&",inve_total = inve_total - "&detail_no&" "
								sql = sql + " where inve_dc_id = "&elink_dc_id&" and inve_prod_id = "&prod_id_now&" "
								conn.execute(sql)
								end if
								sql = "update outward_detail set detail_prod_id = "&prod_id_now&" where detail_id = "&detail_id&" "
								conn.execute(sql)
							else
								if ziti_flag = 0 then
								sql = "update inventory set inve_chuku = inve_chuku + "&detail_no_now&",inve_maysent = inve_maysent - "&detail_no_now&",inve_total = inve_total - "&detail_no_now&" "
								sql = sql + " where inve_dc_id = "&elink_dc_id&" and inve_prod_id = "&prod_id_now&" "
								conn.execute(sql)
								end if
								sql = "update outward_detail set detail_prod_id = "&prod_id_now&",detail_no = "&detail_no_now&" where detail_id = "&detail_id&" "
								conn.execute(sql)
							end if
						end if
						 
					else 
					'未修改产品名称,即未选择其它类别(没有做改动)
						if elink_flag <> 1 then
							if no <> 0 then
								if ziti_flag = 0 then
								sql = "update inventory set inve_fenpei = inve_fenpei + "&no&",inve_maysent = inve_maysent - "&no&",inve_total = inve_total - "&no&" "
								sql = sql + " where inve_dc_id = "&elink_dc_id&" and inve_prod_id = "&prod_id&" "
								conn.execute(sql)
								end if
								sql = "update outward_detail set detail_no = "&detail_no_now&" where detail_id = "&detail_id&" "
								conn.execute(sql)							
							end if						
						elseif elink_flag = 1 then
							if no <> 0 then
								if ziti_flag = 0 then
								sql = "update inventory set inve_chuku = inve_chuku + "&no&",inve_maysent = inve_maysent - "&no&",inve_total = inve_total - "&no&" "
								sql = sql + " where inve_dc_id = "&elink_dc_id&" and inve_prod_id = "&prod_id&" "
								conn.execute(sql)
								end if
								sql = "update outward_detail set detail_no = "&detail_no_now&" where detail_id = "&detail_id&" "
								'Response.Write sql
								'Response.End 
								conn.execute(sql)
							end if						
						end if 
					end if	
			end if
			rs_xx.close
			set rs_xx = nothing
			call closedatabase
			Response.Write "<script language=javascript>"	
			Response.Write "{window.close();}"		
			Response.Write "</script>"
			Response.End 
	
else
	sql = "select * from outward_detail where detail_id = "&detail_id&" "
	set rs_xx = conn.execute(sql)
	if not rs_xx.eof then

%>
<form action="odd_edit_no.asp" method="POST" name="output1">
<table align=center width=100%  cellspacing='0' cellpadding='0' bordercolorlight='#000000'bordercolordark='#FFFFFF'bgcolor='#DADBFC' border="1">
<tr>
 <td colspan=4 align=center bgcolor=red><b><font color=yellow>出库记录详细信息一览</font></b></td>
</tr>
<%
		prod_id = rs_xx("detail_prod_id")
		detail_no = rs_xx("detail_no")
		elink_id = rs_xx("detail_elink_id")
			
			Response.Write "<tr bgcolor=green>"
			Response.Write "<td width=""15%""><b><font color=white> 客户信息:</font></b></td>"
			Response.Write "<td width=""35%"">"
			Response.Write "<b><font color=white> 产品</font></b></td>"
			Response.Write "<td width=""50%"">"
			Response.Write "<b><font colspan=""2"" color=white>&nbsp;数量</font></b></td>"
			Response.Write "</tr>"
			Response.Write "<tr>"
			Response.Write "<td width=""25%"">&nbsp;</td>"
			Response.Write "<td width=""35%"">"
			Response.Write "<select name=""prod_id""  onkeydown=""javascript:if(event.keyCode==13)event.keyCode=9"">"	
		if ziti_flag = 0 then
			sql = "select * from product where prod_dir_flag = 0 and prod_flag = (select prod_flag from product where prod_companyid = "&newcompanyid&" and prod_id = "&prod_id&")"
		elseif ziti_flag = 1 then
			sql = "select * from product where prod_dir_flag = 1 and prod_flag = (select prod_flag from product where prod_companyid = "&newcompanyid&" and prod_id = "&prod_id&")"
		end if
		set rs_prod = conn.execute(sql)
		do while not rs_prod.eof 
			prod_id_table = rs_prod("prod_id") 
			prod_no = rs_prod("prod_no")
			prod_type = rs_prod("prod_type")
			prod_color = rs_prod("prod_color")
			prod_pinming = rs_prod("prod_pinming")
			prod_weight = rs_prod("prod_weight")
			prod_volume = rs_prod("prod_volume")
			if prod_id = prod_id_table then
				Response.Write "<option value="&prod_id_table&" selected>"&prod_no &" " & prod_type &" " & prod_color &" " & prod_pinming &" " & prod_weight &" " & prod_volume&"</option>"
			else
				Response.Write "<option value="&prod_id_table&">"&prod_no &" " & prod_type &" " & prod_color &" " & prod_pinming &" " & prod_weight &" " & prod_volume&"</option>"
			end if
			rs_prod.movenext
		loop
		rs_prod.close
		set rs_prod = nothing
			Response.Write "</select>"
			Response.Write "</td>"
			Response.Write "<td colspan=2 width=""40%"">"
			response.write "<input  style=""font-size:9pt;width=120;BORDER-TOP-WIDTH: 1px;BORDER-BOTTOM-WIDTH: 2px;BORDER-LEFT-WIDTH: 1px;BORDER-RIGHT-WIDTH: 2px"" type=textbox name='detail_no' value='"&detail_no&"' maxlength=15 onkeydown=""javascript:if(event.keyCode==13)event.keyCode=9"">"
			Response.Write "</td>"
			'Response.Write "</td>"		
			Response.Write "</tr>"
	rs_xx.close
	set rs_xx = nothing
%>
 <input type=hidden name=ziti_flag value=<%=ziti_flag%>>
 <input type=hidden name=detail_id value=<%=detail_id%>>
 <input type=hidden name=companyid value=<%=newcompanyid%>>
<tr bgcolor=white>
   <td colspan="5"><br><br>
   <center>
   <input class=buttonface type=button  onclick="datacheck()" name=ok value=修改>
   	</center>
	<br><br>
 </tr>
</table>
</form>
 <%
 else
	Response.Write "可能该数据已经被他人删除,请刷新主页面!"
	rs_xx.close
	set rs_xx = nothing
end if
call closedatabase
%>
<br><br>
 <script language=vbscript>
<!--
Sub datacheck()
if trim(output1.detail_no.value)=empty then
   msgbox "「数量」不得为空白!", 64, "请输入数量!"
     document.output1.detail_no.focus()
     Exit Sub
  End if
if not isnumeric(trim(output1.detail_no.value)) then
   msgbox "「数量」必须为数字!", 64, "请输入数量!"
     document.output1.detail_no.focus()
     Exit Sub
  End if
output1.Submit
End Sub
-->
</script>
 
  <%
end if
%>
</body>
</html>

⌨️ 快捷键说明

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