<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Include/conn.asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="../Include/NoHackSql.Asp" -->
<%
'=====================================
'天天企业网站管理系统  TianTianCMS
'博科网络科技工作室版权所有
'官方客服中心 http://www.ip126.com
'QQ:530051328 mail:bbfhq@163.com
'=====================================
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <TITLE>收货确认</TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>

 <BODY>
 <%dim id,rs,sql
    id=Request("id")
	if request("admincl")<>"" then
    set rs = server.createobject("adodb.recordset")	
    sql="select * from TianTianCMS_Order where ID="&ID
    rs.open sql,conn,1,3	  
	rs("admincl")=4
	rs("zfqr")=1
	rs("ddshsj")=now()
	rs.update
Products_id=split(rs("Products_id"),"|")
Products_num=split(rs("Products_num"),"|")
amount=split(rs("amount"),"|")
Call CloseRs(rs)
'将订单按商品详细记录开始，之前要读出数组参数＝＝＝＝＝＝＝＝

for i=1 to Ubound(Products_id)
set rs = server.createobject("adodb.recordset")
sql="select * from TianTianCMS_Products where ID="&CInt(Products_id(i))
rs.open sql,conn,1,3
rs("sales_amount")=rs("sales_amount")+CInt(Products_num(i))'销售数量
rs("Stock")=rs("Stock")-CInt(Products_num(i))'减去库存
rs("amount")=rs("amount")+Formatnumber(amount(i),2,-1,-1,0)'货款总额
rs.update
Next
Call CloseRs(rs)
for i=1 to Ubound(Products_id)
set rs = server.createobject("adodb.recordset")
sql="select * from TianTianCMS_Sales"
rs.open sql,conn,1,3
rs.addnew
rs("goodsid")=Products_id(i)'商品ID号
rs("sales_num")=CInt(Products_num(i))'销量
rs("sales_amount")=Formatnumber(amount(i),2,-1,-1,0)'货款总额
rs("ddshsj")=now()
rs.update
Next
Call CloseRs(rs)
Call CloseDB(conn)
'将订单按商品详细记录结束＝＝＝＝＝＝＝＝
response.Write "<script language=javascript>alert('订单确认收货成功!');location.replace('MemberOrder.Asp');</script>"
Else
response.Write "<script language=javascript>alert('请选择确认收货!');location.replace('MemberOrder.Asp');</script>"
End if%>
 </BODY>
</HTML>
