sx_chk_suborder.asp

来自「这是去年开发的中移鼎讯手机进销存系统 大家」· ASP 代码 · 共 431 行

ASP
431
字号
<!--#include file="../inc/function.asp"-->
<!--#include file="../inc/ChkPurview.asp"-->
<%
'订单审批	SubOrder/SX_Chk_SubOrder.asp
Dim Action,crs,csql,Pro_Name
Dim Rst,Sqlt,k,j
Dim t,t1,t2,t3
Dim rsm,sqlm
Dim CityID,CityName
Dim Total
Dim syear,smonth,sday,Stime

if GetUserGPower <> 9999 then
	Call Msg("您无权管理",1,"")
end if

Action = Trim(Request("Action"))
CityID = Trim(Request("CityID"))
if CityID = "" then
	CityID = 1
end if
Sqlt="Select CityID,CityName from City where CityID="&Cstr(CityID)&""
Call sql_open(Rst,Sqlt,Conn,1,1)
if Rst.eof and Rst.bof then
	Response.Write("没有相应地区")
	Response.end()
else
	CityName = Rst("CityName")
end if
Call rs_end(Rst)

%>
<html>
<head>
<title>订单管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/mobile_sale.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
<!--
  function ShowPro(id) {
    var url = "../product/ShowProInfo.asp?ID=" + id ;
  	window.open(url,"","scrollbars=yes,resizable=no, width=800,height=500");
  }
    function ShowUser(id) {
    var url = "../User/ShowUserInfo.asp?ID=" + id ;
  	window.open(url,"","scrollbars=yes,resizable=no, width=800,height=500");
  }

//-->
</script>

</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr class="topbg"> 
    <td height="22" colspan="2" align="center"><strong>订单管理</strong></td>
  </tr>
  <tr class="tdbg"> 
    <td width="70" height="30"><strong>管理导航:</strong></td>
    <td height="30">
<%
if GetUserGPower = 9999 then
	Response.write "<a href=""SX_Chk_SubOrder.asp"">订单审批</a>"
	Response.write "&nbsp;|&nbsp;<a href=""SX_SubOrder_List.asp"">订单列表</a>"
end if
if GetUserGPower = 999 then	
	Response.write "<a href=""SubOrder_wrt.asp"">添加订单</a>"
	Response.write "&nbsp;|&nbsp;<a href=""My_SubOrder_List.asp"">市公司订单</a>"
	Response.write "&nbsp;|&nbsp;<a href=""X_Chk_SubOrder.asp"">县级待审批订单</a>"
	Response.write "&nbsp;|&nbsp;<a href=""X_SubOrder_List.asp"">县级订单列表</a>"	
	Response.write "&nbsp;|&nbsp;<a href=""SF_SubOrder_List.asp?Chk=0"">分销点待审批订单</a>"
	Response.write "&nbsp;|&nbsp;<a href=""SF_SubOrder_List.asp?Chk=1"">分销点订单列表</a>"	
end if
if GetUserGPower = 99 then	
	Response.write "<a href=""SubOrder_wrt.asp"">添加订单</a>"
	Response.write "&nbsp;|&nbsp;<a href=""My_SubOrder_List.asp"">县公司订单</a>"
	Response.write "&nbsp;|&nbsp;<a href=""XF_SubOrder_List.asp?Chk=0"">分销点待审批订单</a>"	
	Response.write "&nbsp;|&nbsp;<a href=""XF_SubOrder_List.asp?Chk=1"">分销点订单列表</a>"		
end if
if GetUserGPower = 9 then	
	Response.write "<a href=""SubOrder_wrt.asp"">添加订单</a>"
	Response.write "&nbsp;|&nbsp;<a href=""My_SubOrder_List.asp"">我的订单</a>"
end if
%>
	</td>
  </tr>
</table>
<br>

<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr> 
    <td width="100" height="30" align="center" class="topbg"><strong>按地市列表:</strong></td>
    <td height="30">
	<%
	Sqlt="Select CityID,CityName from City order by CityID asc;"
	Call sql_open(Rst,Sqlt,Conn,1,1)
	for k=0 to Rst.recordcount
		sqlm = "Select SUM(SubOrderTotal) as Total from T_SubOrder where CityID="&cstr(rst("CityID"))&" and (IsChk=0 or IsChk=3) and SupChk_UserGPower=9999"
		'Response.Write sqlm
		Call sql_open(rsm,sqlm,conn,1,1)
		'Response.Write sqlm&"<br>"
		Total = rsm("Total")
		if Total="" or isnull(Total) then 
			Total=0
		else
			Total=Rsm("Total")
		end if
		call rs_end(rsm)
		if Total=0 then
			Response.write "<a href=SX_Chk_SubOrder.asp?CityID="&Rst("CityID")&"&CityName="&Rst("CityName")&">"&Rst("CityName")&"</a>&nbsp;"
		else
			Response.write "<a href=SX_Chk_SubOrder.asp?CityID="&Rst("CityID")&"&CityName="&Rst("CityName")&" title=""有未审批订单""><font color='#FF0000'>"&Rst("CityName")&"</font></a>&nbsp;"
		end if
		Rst.movenext
		If Rst.eof then Exit for
	Next
	Call Rs_End(Rst)
	%>		
	</td>
  </tr>
</table>
<br>
<%
if Action="ChkSubOrder" then
	Call ChkSubOrder()
elseif Action="ReChkSubOrder" then
	Call ReChkSubOrder()
else
	Call Main()
end if

Sub Main()
%>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="65%" valign="bottom">&nbsp;&nbsp;<%Response.Write "<font color=""#0000FF"">"&CityName&"</font>未审批订单"%></td>
    <td width="35%">&nbsp;</td>
  </tr>
</table>

<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
  <tr align="center" class="topbg">
    <td>主题</td>
    <td height="22">产品型号</td>
    <td>申购时间</td>
    <td>申购数</td>
    <td>收货人</td>
    <td title="已审批数+未审批数">审批数</td>
    <td>操作</td>
    <td>进货数</td>
    <td>发货数</td>
    <td>回款数</td>
    <td>库存数</td>
    <td>回款率</td>
  </tr>

<%
csql = "Select * from T_Product order by Pro_ID desc;"
Call sql_open(crs,csql,Conn,1,1)
if crs.eof and crs.bof then
	Response.Write "没有任何产品"
else


	k = 1
	Do while not crs.eof

	sql = "Select * from T_User where CityID="&cstr(CityID)&" and (UserGID=6 or UserGID=7) order by UserGID,UserID desc;"
	Call sql_open(rs,sql,conn,1,1)

	for j=0 to rs.recordcount
'/////////////////////////////////////////	
'''计算申购数量(今日)表名:T_SubOrder
sqlm = "Select * from T_SubOrder where Pro_ID="&cstr(crs("Pro_ID"))&" and UserID="&Cstr(rs("UserID"))&" and (IsChk=0 or IsChk=3) and SupChk_UserGPower=9999"
Call sql_open(rsm,sqlm,conn,1,1)

Do while not rsm.eof
'Response.Write sqlm&"<br>"
Total = rsm("SubOrderTotal")
if Total="" or isnull(Total) then 
	Total=0
end if

if Total=0 and rs("UserGID")=7 then
	response.write "fff"
else
	
%> 
<form name="myform" method="Post" action="SX_Chk_SubOrder.asp?Action=ChkSubOrder&ID=<%=rsm("SubOrderID")%>" onsubmit="return confirm('确认审批此订单?');">
  <tr <%if k mod 2 =1 then 
  	Response.write "class='tdbg' onmouseout=""this.style.backgroundColor=''"" onmouseover=""this.style.backgroundColor='#B3B3B3'"""
  else
  	Response.write "class='Lborder' onmouseout=""this.style.backgroundColor=''"" onmouseover=""this.style.backgroundColor='#CCCCCC'"""
  end if
  %>>
    <td align="center">
<%	
	Response.Write "<a href=""SX_SubOrder_Show.asp?ID="&rsm("SubOrderID")&""">"
	if rs("UserGID")=6 then
		Response.write "<b>"&rsm("SubOrderTitle")&"</b>"
	else
		Response.write rsm("SubOrderTitle")
	end if
	Response.write "</a>"
	%>	
	</td>
    <td align="center">
	<%
	sqlt= "Select * from T_Product where Pro_ID="&cstr(rsm("Pro_ID"))&""
	Call sql_open(rst,sqlt,conn,1,1)
	if rst.eof and rst.bof then
		Response.Write("<font color='#FF0000'>无此产品</font>")
	else
		response.Write "<a href=""javascript:ShowPro('"&rsm("Pro_ID")&"')"" title=""查看产品信息"">"&rst("Pro_MC")&"<font color='#0000FF'>("&rsm("Pro_col")&")</font></a>"
	end if
	call rs_end(rst)
	%></td>
    <td align="center"><%=Format_Time(rsm("InTime"), 9)%></td>
    <td align="center"><%
	if clng(Total)<0 then
		Response.write "<font color=""#0000FF""><b>"&Total&"</b></font>"
	else
		Response.write "<font color=""#0000FF""><b>"&Total&"</b></font>"
	end if
	%></td>
	<td align="center"><%=rsm("RecName")%></td>
	<td align="center"  title="已审批数+未审批数">
	<%
	if rsm("Chk_SubOrderTotal")=0 or isnull(rsm("Chk_SubOrderTotal")) then
		Response.Write "<input name=""Chk_SubOrderTotal"" type=""text"" value="&Total&" size=""3"" maxlength=""5"" onKeyUp='this.value=this.value.replace(/\D/gi,"""")'>"
	else
		Response.Write "<b>"&rsm("Chk_SubOrderTotal")&"+</b><input name=""Chk_SubOrderTotal"" type=""text"" value="&clng(Total)-clng(rsm("Chk_SubOrderTotal"))&" size=""3"" maxlength=""5"" onKeyUp='this.value=this.value.replace(/\D/gi,"""")'>"
	end if
	%>
	</td>
	<td align="center"><input type="submit" name="Submit" value="审批"></td>
    <td align="center"><%=S_InSubOrder(1,rs("UserID"),crs("Pro_ID"))%></td>
    <td align="center"><%=S_OutSubOrder(1,rs("UserID"),crs("Pro_ID"))%></td>
    <td align="center"><%
	if rs("UserGID")=6 then			'市的回款数
		Response.Write S_FundSubOrder(1,999,rs("CityID"),"","",crs("Pro_ID"))
	elseif rs("UserGID")=7 then		'县的回款
		Response.Write S_FundSubOrder(1,99,"",rs("CountyID"),"",crs("Pro_ID"))
	end if
	%></td>
    <td align="center">
	<%
	t=0
	t1=0
	t2=0
	t3=0	
	t1 = S_InSubOrder(1,rs("UserID"),crs("Pro_ID"))
	t2 = S_OutSubOrder(1,rs("UserID"),crs("Pro_ID"))
'	Response.Write t1&"<br>"
'	Response.Write t2&"<br>"

	if rs("UserGID")=6 then			'市的回款数
		t3 = S_FundSubOrder(1,999,rs("CityID"),"","",crs("Pro_ID"))
	elseif rs("UserGID")=7 then		'县的回款
		t3 = S_FundSubOrder(1,99,"",rs("CountyID"),"",crs("Pro_ID"))
	end if
		
	t = clng(t1)-clng(t2)-clng(t3)
	if clng(t)<clng(rs("UserProSave")) then
		Response.write "<font color=""#0000FF"">"&t&"</font>"
	else
		Response.write "<font color=""#FF0000""><b>"&t&"</b></font>"
	end if
	%>
	</td>
    <td align="center"><%
	
	
	t=0
	t1=0
	t2=0
	if rs("UserGID")=6 then			'市的回款数
		t1= S_FundSubOrder(1,999,rs("CityID"),"","",crs("Pro_ID"))
	elseif rs("UserGID")=7 then		'县的回款
		t1= S_FundSubOrder(1,99,"",rs("CountyID"),"",crs("Pro_ID"))
	end if
	t2 = S_InSubOrder(1,rs("UserID"),crs("Pro_ID"))
	if t1=0 or t2=0 then
		t=0
	else
		t = 100*(round((t1/t2),2))
	end if
	Response.write t&"%"
	%></td>
  </tr></form>
<%
end if
	rsm.movenext
	loop
	

		rs.movenext
		If rs.eof then Exit for
	Next
	
	crs.movenext
	k = k + 1
	loop
end if
%>  
 
</table><br>
<%
End Sub

Sub ChkSubOrder()
	Dim ID,Chk_SubOrderTotal
	ID = Request("ID")
	Chk_SubOrderTotal = Request("Chk_SubOrderTotal")
	if ID="" or isnull(ID) then
		Call Msg("非法参数",1,"")
	end if
	sqlt = "Select * from T_SubOrder where SupChk_UserGPower="&GetUserGPower&" and SubOrderID="&Cstr(ID)&";"
	Call sql_open(rst,sqlt,conn,1,3)
	if rst.eof and rst.bof then
		Response.write "订单不存在"
	else
		rst("SupChk_UserID")=GetUserID
		rst("SupChk_UserName")=GetUserName
		rst("Chk_SubOrderTotal")=rst("Chk_SubOrderTotal")+Chk_SubOrderTotal
		rst("Chk_SubOrderNum")	=Chk_SubOrderTotal	'本次审批多少
		rst("IsChk")=3								'尚未审批结束
		rst("ChkInfo")="省公司已审批"
		rst("ChkTime")=Now()
		rst.addnew
%>
  <table width="40%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
    <tr class="topbg">
      <td height="22" align="center"><strong>订单审批</strong></td>
    </tr>
    <tr class="tdbg">
      <td height="30">&nbsp;</td>
    </tr>
    <tr class="tdbg">
      <td height="30" align="center">
        <input type="button" name="S2" value="没有完全审批,保留订单" onClick="window.location.href='SX_Chk_SubOrder.asp?Action=ReChkSubOrder&keep=3&ID=<%=ID%>'" style="cursor:hand;">
	  <input type="button" name="S3" value="不保留" onClick="window.location.href='SX_Chk_SubOrder.asp?Action=ReChkSubOrder&keep=1&ID=<%=ID%>'" style="cursor:hand;"></td>
    </tr>
  </table>
<%	
	end if
	'call rs_end(rst)
	'审批过以后直接就存到发货库中。
'SubOrderID,Pro_ID,Pro_Name,Pro_col,Pro_Num,Pro_Price,Pro_Money,CityID,CountyID
Dim rs0,sql0,rs1,sql1,rs2,sql2
Dim UserID,UserGPower
Dim SubOrderID,Pro_ID,Pro_Name,Pro_col,Pro_Num,Pro_Price,Pro_Money,CityID,CountyID
dim Chk_SubOrderNum
sql1 = "Select * from T_SubOrder where SubOrderID="&Cstr(ID)&";"
Call sql_open(rs1,sql1,conn,1,1)
SubOrderID	=	rs1("SubOrderID")
Pro_ID		=	rs1("Pro_ID")
Pro_col		=	rs1("Pro_col")
UserID		=	rs1("UserID")
UserGPower	=	rs1("UserGPower")
'------------------------------------
	sql0 = "Select * from T_Product where Pro_ID="&cstr(Pro_ID)&""
	call sql_open(rs0,sql0,conn,1,1)
	if rs0.eof and rs0.bof then
		call Msg("产品不存在",1,"")
	else
		Pro_Name=rs0("Pro_MC")
		Pro_Price=rs0("Pro_DJ")
	end if
	call rs_end(rs0)
'------------------------------------

Pro_Money	=	clng(Pro_Price)*rs1("Chk_SubOrderNum")
Chk_SubOrderNum	=rs1("Chk_SubOrderNum")
CityID		=	rs1("CityID")
CountyID	=	rs1("CountyID")
call rs_end(rs1)
sql2="Select * from T_SubOutOrder"
Call sql_open(rs2,sql2,conn,1,3)
rs2.addnew
	rs2("SubOrderID")=SubOrderID
	rs2("Pro_ID")=Pro_ID
	rs2("Pro_Name")=Pro_Name	
	rs2("Pro_col")=Pro_col
	rs2("Pro_Num")=Chk_SubOrderNum
	rs2("Pro_Price")=Pro_Price
	rs2("Pro_Money")=Pro_Money
	rs2("CityID")=CityID
	rs2("CountyID")=CountyID
	rs2("ChkOutOrder")=0			'未确认发货
	rs2("UserPower")=9999
	rs2("InChk_UserID")=UserID
	rs2("InChk_UserPower")=UserGPower
rs2.update


End Sub

Sub ReChkSubOrder()
	Dim ID,keep
	Dim rsc,sqlc
	ID = trim(Request("ID"))
	keep = trim(Request("keep"))
	if ID="" or isnull(ID) then
		Call Msg("非法参数",1,"")
	end if
	if keep="" or isnull(keep) then
		Call Msg("非法参数",1,"")
	end if	
	sqlc = "Select * from T_SubOrder where SupChk_UserGPower="&GetUserGPower&" and SubOrderID="&Cstr(ID)&";"
	Call sql_open(rsc,sqlc,conn,1,3) 
	if rsc.eof and rsc.bof then
		Response.write "订单不存在"
	else
		if keep=1 then		'不保留
			rsc("IsChk")=1
		elseif keep=3 then
			rsc("IsChk")=3
		end if
		rsc.update
	end if
	call rs_end(rsc)
	Response.Redirect("SX_Chk_SubOrder.asp")
	
End Sub
%>


<br>

⌨️ 快捷键说明

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