<%@ LANGUAGE="VBScript" %>
<!--#include file="Inc/Conn.asp" -->
<!--#include file="Lock.asp"-->
<!--#include file="Inc/Util.asp" -->
<!--#include file="Inc/eshopcode.asp"-->
<!--#include file="Inc/Eshopcode.asp"-->
<%
Set rsid = Server.CreateObject("ADODB.recordset")
sql="Select ID From [Product]"
rsid.open sql,conn,1,1
chkstr = ""
Do until rsid.Eof
If Session("C_"&rsid("ID"))<>"" Then 
chkstr = chkstr & Session("C_"&rsid("ID"))
End if
rsid.MoveNext
Loop
rsid.Close
Set rsid=Nothing
If Len(chkstr)=0 Then 
Response.Redirect "Index.asp"
End if

ProductList = Session("ProductList")
If Len(ProductList) = 0 Then
Response.Redirect "Index.asp"
End if
Set rs=Server.Createobject("adodb.recordset")
sqltext="Select * From [ShopOrder]"
rs.Open sqltext,conn,3,3,1
rs.AddNew
rs("username")=checkstr(Trim(request.form("username")))
rs("Compname")=checkstr(Trim(request.form("Comane")))
rs("Somane")=checkstr(Trim(request.form("Somane")))
rs("Address")=checkstr(Trim(request.form("Add")))
rs("Zip")=checkstr(Trim(request.form("Zip")))
rs("Phone")=checkstr(Trim(request.form("Phone")))
rs("Fox")=checkstr(Trim(request.form("Fox")))
rs("Email")=checkstr(Trim(request.form("Email")))
rs("Bank")=Trim(request.form("Pays"))
rs("Flag")="尚未处理"
If Trim(request.form("Remark"))="" then
rs("Remark")="无"
Else
rs("Remark")=checkstr(Trim(request.form("Remark")))
End If
rs.Update
rs.Close
sql="Select [Form_Id] From [ShopOrder] Order By [RegTime] desc"
rs.open sql,conn,1,1
formid=rs(0)
rs.close
%>
<%
Set rs=Server.Createobject("Adodb.Recordset")
Productlist = Session("Productlist")
sql = "Select * From [Product]"
sql = sql & " Where [Product_ID] In (" & ProductList & ")"
sql = sql & " Order By ID desc"
Set rs = Conn.Execute( sql )
While Not rs.Eof
set rs2=Server.Createobject("Adodb.recordset")
sqltext2="Select * From [ShopList]"
rs2.Open sqltext2,conn,3,3,1
rs2.AddNew
rs2("Product_ID")=rs("Product_ID")
rs2("ShopForm_Id")=formid
rs2("Product_Name")=rs("Name")
rs2("BigClassName")=rs("BigClassP")
rs2("SmallClassName")=rs("SmallClassP")
rs2("Number")=Cint(Session(rs("Product_ID")))
rs2.Update
rs2.Close
Session(rs("Product_ID"))=""
rs.MoveNext
Wend
rs.close
rs_home.close
conn.close
set conn=nothing
Session("Productlist")=""
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="ziyan/Style.css" rel="stylesheet" type="text/css">
<title>提交成功</title>
</head>
<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br>
<div align="center">
  <TABLE width=95% height="47%" align="center" cellPadding=0 cellSpacing=0>
    <TR>
<TD align=middle width="100%">
<TABLE cellSpacing=0 cellPadding=0 width=100% bgColor=#999999>
          <TBODY>
<TR>
              <TD align="center" height=22 width="100%" bgcolor="#eeeeee"> 购买成功 
              </TD>
</TR></TBODY></TABLE>
<div align="center">
          <TABLE width=100% height="136" border="0" cellpadding="0" cellSpacing=1 bgColor=#CCCCCC >
            <TBODY>
              <TR vAlign=top bgColor=#eeeeee> 
                <TD  width="100%" height="60" bgcolor="#FFFFFF"> 订单提交成功，您的订单号是：<b><font size="4"><font color="#FF0000"><%=formid%></font></b><br>
                  请牢记您的订单号，以便查询。 </TD>
              </TR>
              <td height="14" bgcolor="#FFFFFF"> 
            <TR bgColor=#eeeeee> 
              <TD  width="100%" height="27" bgcolor="#FFFFFF"> 
                <p align="center"> 
                  <input type="button" name="close" value="关闭窗口"  onClick="window.close()">
                  <br>
                  <br>
              </TD>
            </TR>
          </TABLE>
</div>
</TD></TR></TABLE>
  <br>
</div>