<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr> 
    <td><br>&nbsp;&nbsp;<font color="#FF3333"><b>以下是您购物车中的商品信息，请核对正确无误后下单，非注册用户请牢记你的订单号以便日后查询！<br> &nbsp; </b></font></td>
 </tr>
<tr> <td>
      <table border="0" cellspacing="1" cellpadding="4" align="center" width="100％" bgcolor="#227776">
        <tr bgcolor="#FFFFFF" height="25" align="center"> 
            <td width="40">编 号</td>
            <td width="300">商 品 名 称</td>
            <td width="40">数量</td>
			 <td width="40">积分</td>
			 <td width="60">会员价</td>
			 <td width="40">邮费</td>
            <td width="60">成交价</td>
			<td width="70">总 计</td>
          </tr>
<%
Set rsCheck=Server.CreateObject("ADODB.RecordSet") 
strsql="select ID,Name,Score,Price2," & LstPrice & ",amount,VipPrice,Stock,Solded from Product where ID in ("&Session("ProductList")&") order by ID"
rsCheck.open strsql,conn,1,1

Sum = 0
SumS = 0
SumFee = 0
Do While Not rsCheck.EOF
     Quatity = CInt( Request( "Q_" & rsCheck("ID")) )
     If Quatity <= 0 Then 
        Quatity = CInt( Session(rsCheck("ID")) )
        If Quatity <= 0 Then Quatity = 1
     End If
if len(Quatityt)=0 then
Quatityt=Quatity
else
Quatityt=Quatityt&","&Quatity
end if
strprice2 = Round(rsCheck("Price2"),2)
strvipprice = Round(rsCheck("VipPrice"),2)
ProScore = rsCheck("Score")
YourPrice =  Round(rsCheck("" & LstPrice & ""),2)
Session(rsCheck("ID")) = Quatity
Sum = Sum + (YourPrice + strvipprice)*Quatity
Sum=Round(Sum,2) 
SumS = SumS + ProScore*Quatity
%> 
          <tr bgcolor="#FFFFFF" height="25"align="center"> 
            <td><%=rsCheck("ID")%></td>
            <td align="left">&nbsp;<a href="product.asp?ID=<%=rsCheck("ID")%>" target="_blank"><%=rsCheck("Name")%></a></td>
            <td><%=Quatity%> </td>
			<td><%=ProScore %></td>
			<td><%=strprice2 %></td>
			<td><%=strvipprice %></td>
			<td><%=YourPrice %></td>
			<td><%=Round((YourPrice + strvipprice)*Quatity,2) %></td>
          </tr>
          <%
Message=message &"<tr bgcolor=#FFFFFF height=25 align=center> "
Message=message &"<td>"& rsCheck("ID") &"</td>"
Message=message &"<td align=left><a href=product.asp?ID="& rsCheck("ID")&" target=_blank>"& rsCheck("Name") &"</a></td>"
Message=message &"<td>"& Quatity &"</td>"
Message=message &"<td>"&ProScore &"</td>"
Message=message &"<td>"& strprice2 &"</td>"
Message=message &"<td>"& strvipprice &"</td>"
Message=message &"<td>"& YourPrice &"</td>"
Message=message &"<td>"& Round((YourPrice + strvipprice)*Quatity,2) &"</td>"
Message=message &"</tr>"

IF FormatSQL(SafeRequest("action",0)) = 3 Then 
strprice2 = rsCheck("Price1")
strvipprice = rsCheck("Vipprice")
YourPrice =  (rsCheck("" & LstPrice & "")+strvipprice)*Quatity
If LngUserID=0 Then
strUserName = Request.ServerVariables("REMOTE_ADDR")
End IF
if request.form("receipt")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写收货人姓名！');history.go(-1);</script>"
response.End
end if
if request.form("address")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写详细地址！');history.go(-1);</script>"
response.End
end if
if request.form("postcode")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写邮编！');history.go(-1);</script>"
response.End
end if
if request.form("usertel")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写电话！');history.go(-1);</script>"
response.End
end if
if request.form("useremail")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写电子邮件！');history.go(-1);</script>"
response.End
end if
if request.form("deliverymethord")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写送货方式！');history.go(-1);</script>"
response.End
end if
if request.form("paymethord")="" then
conn.close
set conn = nothing
response.Write "<script language=javascript>alert('请填写支付方式！');history.go(-1);</script>"
response.End
end if
set rs=server.CreateObject("adodb.recordset")  
rs.open "select * from orders",conn,1,3
rs.addnew
rs("username")=trim(strUserName)
rs("id")=rsCheck("ID")
rs("actiondate")=Now()
rs("productnum")=Quatity
rs("state")=2
rs("goods")=goods
rs("postcode")=int(request.form("postcode"))
rs("receipt")=trim(request.form("receipt"))
rs("address")=trim(request.form("address"))
rs("paymethord")=int(request.form("paymethord"))
rs("deliverymethord")=int(request.form("deliverymethord"))
rs("UserSex")=int(request.form("UserSex"))
rs("comments")=HTMLEncode2(trim(request.form("comments")))
rs("paid")=YourPrice
rs("realname")=trim(request.form("realname"))
rs("score")=ProScore*Quatity
rs("useremail")=trim(request.form("useremail"))
rs("usertel")=trim(request.form("usertel"))
rs("comments")=trim(request.form("comments"))
rs("userid")=LngUserID
rs.update
rs.close
Session(rsCheck("ID")) = 1
End IF

     rsCheck.MoveNext
     Loop
rsCheck.close
set rsCheck=nothing
%> 
<tr bgcolor="#FFFFFF"> 
<td colspan="8" height="25">
您现在是：<font color="#FF6600"><%= strTitle %></font>&nbsp;
商品总计：<font color="#FF6600"><%=Sum  %></font>&nbsp;元&nbsp;
获得积分：<font color="#FF6600"><%=SumS %></font>&nbsp;分
            </td>
          </tr>
<% 
Message=message &"<tr bgcolor=#FFFFFF>"
Message=message &"<td colspan=8 height=25>"
Message=message &"您现在是：<font color=#FF6600>"& strTitle &"</font>"
Message=message &"商品总计：<font color=#FF6600>"& Sum  &"</font>元"
Message=message &"获得积分：<font color=#FF6600>"& SumS &"</font>分"
Message=message &"</td>"
Message=message &"</tr>"

IF FormatSQL(SafeRequest("action",0)) = 3 Then 

rs.open "select * from delivery where deliveryid="&int(request.form("deliverymethord")),conn,1,1
	  if rs.eof and rs.bof then
	  strMth = "你选择的送货方式已经被删除"
	  LngMth = 0
	  else
	  strMth = rs("subject")
	  LngMth = rs("fee")
	  LngPayfee = rs("payfee")
      end if
	  rs.close
	  Sum = Sum*(1+LngPayfee/100)
	  If webbj5 = 0 Then
	  Sum = Sum +LngMth
	  strMian = ""
	  Else
	  strMian = "(购物满&nbsp;<font color=red>"&webbj5&"</font>&nbsp;元免附加邮费)"
		  	IF Sum < webbj5 Then
		         Sum = Sum +LngMth
			End IF 
	  End If
			 %>
<tr bgcolor="#FFFFFF"> 
<td colspan="8" height="25">
您选择的送货方式：<font color="#FF6600"><% = strMth %></font>&nbsp;附加邮费：<font color="#FF6600"><% = LngMth %></font>&nbsp;方式加收：<% = LngPayfee %>%&nbsp;订单费用总计：<font color="#FF6600"><% = Round(Sum,2) %></font>&nbsp;<% = strMian %>

            </td>
          </tr>
<%
Message=message &"<tr bgcolor=#FFFFFF> "
Message=message &"<td colspan=8 height=25>"
Message=message &"您选择的送货方式：<font color=#FF6600>"& strMth &"</font>&nbsp;附加邮费：<font color=#FF6600>"& LngMth &"</font>&nbsp;订单费用总计：<font color=#FF6600>"& Sum &"</font>&nbsp;"& strMian &" "
Message=message &"</td>"
Message=message &"</tr>"
%>

		  <tr> 
<td colspan="8" bgcolor=#FFFFFF>
订单号：<% = goods %><br>
收货人姓名：<%response.Write trim(request.form("receipt"))
    if request.form("UserSex")=0 then
    response.Write "&nbsp;(先生)"
	strMale = "&nbsp;(先生)"
    else
    response.Write "&nbsp;(女士)"
	strMale = "&nbsp;(女士)"
    end if 
	Message=message &"<tr>"
	Message=message &"<td colspan=8 bgcolor=#FFFFFF>"
	Message=message &"订单号："& goods &"<br> "
	Message=message &"收货人姓名："& trim(request.form("receipt")) &" "& strMale &" <br>"
	%>
	<br>详细地址：<% = trim(request.form("address")) %>
	<br>邮政编码：<% = trim(request.form("postcode")) %>
	<br>联系电话：<% = trim(request.form("usertel")) %>
	<br>电子邮件：<% = trim(request.form("useremail")) %>
	<%
	Message=message &"详细地址："& trim(request.form("address")) &" <br>"
	Message=message &"邮政编码："& trim(request.form("postcode")) &" <br>"
	Message=message &"联系电话："& trim(request.form("usertel")) &" <br>"
	Message=message &"电子邮件："& trim(request.form("useremail")) &" <br>"
	%>
	<br>送货方式：<% 
	rs.open "select * from delivery where deliveryid="&int(request.form("deliverymethord")),conn,1,1
	  if rs.eof and rs.bof then
	  response.write "方式已经被删除"
	   Message=message &"送货方式：方式已经被删除<br>"
	  else
      response.Write trim(rs("subject"))&"(送货费用"
	  response.Write (rs("fee"))&"元，方式加收"
	   response.Write (rs("payfee"))&"%)"
	  Message=message &"送货方式："& rs("subject") &" ("
	  Message=message &" "& rs("fee") &") <br>"
      end if
	  rs.close %>
	<br>支付方式：<% 
	  rs.open "select * from delivery where deliveryid="&request.form("paymethord"),conn,1,1
	  if rs.eof and rs.bof then
	  response.write "方式已经被删除"
	  Message=message &"汇款方式：方式已经被删除<br>"
	  else
      response.Write trim(rs("subject"))
	  Message=message &"方式："& rs("subject") &"<br> "
      end if
	  rs.close
	  
	  
	  if LngDeposit>Sum then
		 rs.open "select state,goods From Orders Where Orders.Goods = '"& goods &"' ",conn,1,3
		 do while not rs.eof
		 rs("state")=3
		 rs.update
		 rs.movenext
		 loop
		 rs.close

		 rs.open "Select score,deposit From [User] where userid = "&LngUserID,conn,1,3
		 rs("deposit")=rs("deposit")-sum
		 rs("score")=rs("score")+sums
		 rs.update
		 rs.close
		 
		strsql="select ID,Stock,Solded from Product where ID in ("&Session("ProductList")&") order by ID"
		rs.open strsql,conn,1,3
		rs("Stock") = rs("Stock") - Quatity
		rs("Solded") = rs("Solded") + Quatity
		rs.Update
		rs.close

		 strtxtdeposit="已从你的预存款中扣除"&""&Round(sum,2)&""&"元，给你加了"&""&sums&""&"分，订单状态自动变成已汇款"
else
		 strtxtdeposit="请您在一周内按您选择的支付方式进行汇款，汇款时请注明您的订单号！汇款后请及时通知我们"
         rs.open "select paymethord from config",conn,1,1
		 strtxtdeposit = strtxtdeposit &"<br><br> "& rs("paymethord") &" "
		 rs.close
end if
     set rs=nothing
      %>
	<br>您的留言：<% = trim(request.form("comments")) %>
	<br>
	<br>
	<br><% = strtxtdeposit %>
		<%
	Message=message &"您的留言："& trim(request.form("comments")) &" <br>"
	Message=message &" "& strtxtdeposit &" "
	Message=message &"</tr>"
	Message=message &"</table>"
	%>
	<br><br><div align="center"><a href="index.asp">继续购物</a>&nbsp;&nbsp;<a href="JavaScript:onClick=window.close();">关闭窗口</a></div>
      </td></tr>

<% 
End IF %>
      </table>
 </td>
</tr>
      </table>