<!--#include file="conn.asp"--><%seo_title="Checkout-"&sitename%>
<!--#include file="IncAsp/WrzcNet_top.asp"-->
<!--#include file="IncAsp/WrzcNet_email.asp"-->
<!--#include file="IncAsp/WrzcNet_md5.asp"-->
<!--#include file="IncAsp/all_pay.asp"-->
<div align="center">
<table cellpadding="0" cellspacing="0" class="all_t1">
<tr><td class="all_l_td" valign="top">
<!--#include file="IncAsp/WrzcNet_log.asp"--><div class="d5"></div>
</td>
<td valign="top" class="all_c_td">
<%if Request.Cookies("WrzcNet")("user_name")="" and Request.Cookies("WrzcNet")("guest")="" then
response.redirect "buy.asp"
response.end
end if
zhekou=100

if Request.Cookies("WrzcNet")("user_name")<>"" then
	user_name=Request.Cookies("WrzcNet")("user_name")
	if Request.Cookies("WrzcNet")("user_type")="" then
	zhekou=100
	usertype_name="Non-Member"
	zhekouyu="You Save:0%"
	else
	user_type=Request.Cookies("WrzcNet")("user_type")
	set rs=server.createobject("adodb.recordset")
	sql="select * from WrzcNet_usertype where usertype_id="&user_type&""
	rs.open sql,conn,1,1
	if rs.eof then
	zhekou=100
	usertype_name="Member"
	zhekouyu="You Save:0%"
	else
	zhekou=rs("usertype_zhekou")
	usertype_name=rs("usertype_name")
		if zhekou=100 then
		zhekouyu="You Save:0%"
		else
		zhekouyu="You Save:"&zhekou&"%"
		end if
	end if
	rs.close
	set rs=nothing
	end if
elseif Request.Cookies("WrzcNet")("guest")<>"" then
	user_name=Request.Cookies("WrzcNet")("guest")
	usertype_name="Non-Member"
end if

if isvalidemail(trim(request("sub_mail")))=false then
	showerr "e7"
else
	user_mail=trim(request("sub_mail"))
end if

set rs=server.createobject("adodb.recordset")
sql="select hw_name,basket_check,sub_number,hw_id,basket_count,hw_weight,hw_yunfei,hw_price from WrzcNet_basket where user_name='"&user_name&"' and basket_check=0"
rs.open sql,conn,1,3
if rs.eof then
showerr "e6"
rs.close
set rs=nothing
end if
sub_number=right(year(date()),2)&month(date())&day(date())&hour(now())&minute(now())&second(now())
sub_number=replace(sub_number,"-","")
sub_number=replace(sub_number," ","")
sub_number=replace(sub_number,":","")
do while not rs.eof
	rs("basket_check")=1
	rs("sub_number")=sub_number
	hw_id=rs("hw_id")
	set rs1=conn.execute("update WrzcNet_hw set hw_buys=hw_buys+1 where hw_id="&hw_id&"")
	totalcash=totalcash+(rs("basket_count")*trim(rs("hw_price")))
	totalw=totalw+(rs("basket_count")*trim(rs("hw_weight")))
	totaly=totaly+(rs("basket_count")*trim(rs("hw_yunfei")))
	totalc=totalc+rs("basket_count")
	showbasket=showbasket&"<p  style=""margin: 5px"">"&rs("hw_name")&" "&fuhao&rs("hw_price")&danwei&" "&rs("basket_count")&">"
rs.update
rs.movenext
loop
rs.close
set rs=nothing

if request("quan_no")<>"" and request("quan_pass")<>"" then
	set rsp=server.createobject("adodb.recordset")
	rsp.open "select * from WrzcNet_quan where quan_no='"&DelStr(request("quan_no"))&"' and quan_pass='"&DelStr(request("quan_pass"))&"' and quan_date>#"&now()&"#",conn,1,3
	if not rsp.eof then
		quan_man=rsp("quan_man")
		if quan_man<=totalcash then
			quan_id=rsp("quan_id")
			quan_cash=rsp("quan_cash")
			quan_man=rsp("quan_man")
			quan_no=rsp("quan_no")
			quan_pass=rsp("quan_pass")
			rsp("quan_is")=1
			rsp("user_name")=user_name
			rsp("sub_number")=sub_number
			rsp.update
		else
			quan_id=0
			quan_cash=0
			quan_man=0
			quan_no=""
			quan_pass=""
		end if
	else
		quan_id=0
		quan_cash=0
		quan_man=0
		quan_no=""
		quan_pass=""
	end if
	rsp.close
	set rsp=nothing
else
	quan_id=0
	quan_cash=0
	quan_man=0
	quan_no=""
	quan_pass=""
end if



if request("zp")<>0 then
	set rsp=server.createobject("adodb.recordset")
	rsp.open "select * from WrzcNet_zp where zp_id="&request("zp")&" and zp_kucun>0",conn,1,1
	if not rsp.eof then
	zp_full=rsp("zp_full")
	if zp_full<=totalcash then
	zp_id=rsp("zp_id")
	zp_name=rsp("zp_name")
	zp_price=rsp("zp_price")
	zp_full=rsp("zp_full")
	else
	zp_id=0
	zp_name=""
	zp_price=0
	zp_full=0
	end if
	else
	zp_id=0
	zp_name=""
	zp_price=0
	zp_full=0
	end if
	rsp.close
	set rsp=nothing
else
	zp_id=0
	zp_name=""
	zp_price=0
	zp_full=0
end if





set rs=server.createobject("adodb.recordset")
sql="select * from WrzcNet_sub"
rs.open sql,conn,1,3
rs.addnew
rs("sub_name")=user_name
rs("sub_number")=sub_number
rs("sub_date")=now()
rs("sub_zt")=1
ps=split(request("ps_id"),"/")
pay=split(request("pay_id"),"/")
rs("sub_ps")=ps(0)
rs("sub_pay")=pay(0)
rs("sub_psname")=ps(1)
rs("sub_payname")=pay(1)
rs("sub_totime")=request("totime")
rs("sub_yunfei")=countfee(int(ps(0)),yunfei,totaly,totalw,totalc,int(totalcash),int(mian))
if fapiao=1 then
rs("sub_fapiao")=request("fapiao")
if request("sub_taitou")<>"" then
rs("sub_taitou")=DelStr(request("sub_taitou"))
end if
else
rs("sub_fapiao")=0
rs("sub_taitou")="NO"
end if
rs("sub_quehuo")=request("quehuo")
rs("sub_other")=DelStr(request("other"))
rs("sub_to")=DelStr(request("sub_to0"))&"&nbsp;"&DelStr(request("sub_to1"))
rs("sub_mail")=DelStr(request("sub_mail"))
rs("sub_tel")=DelStr(request("sub_tel"))
rs("sub_adds")=DelStr(request("sub_adds"))
rs("sub_post")=DelStr(request("sub_post"))
rs("sub_country")=DelStr(request("sub_country"))
rs("sub_state")=DelStr(request("sub_state"))
rs("sub_city")=DelStr(request("sub_city"))

rs("sub_k")=0
rs("sub_h")=0
rs("zp_id")=zp_id
rs("zp_name")=zp_name
rs("zp_price")=zp_price
rs("zp_full")=zp_full
rs("sub_ip")=request.servervariables("remote_addr")
rs("sub_usertype")=usertype_name
rs("sub_zhekou")=zhekou
rs("quan_id")=quan_id
rs("quan_cash")=quan_cash
rs("quan_man")=quan_man
rs("quan_no")=quan_no
rs("quan_pass")=quan_pass


rs("fuhao")=fuhao
rs("hui")=hui
rs("danwei")=danwei
rs("bizhong")=bizhong



rs.update
rs.close
set rs=nothing
user_mail=request("sub_mail")
totalcash=0
totalw=0
totaly=0
totalc=0
%>

<table width="99%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="sort">&nbsp;<IMG src="Skin/<%=WrzcNet_skin%>/home.gif" border=0 align="absmiddle">  <a href="index.asp">Home</a> >>&nbsp;Success, Order Number:<%=sub_number%>:</td></tr>
</table>


<table border="0" cellpadding="0" cellspacing="0" class="useri">
<tr><td height="150">

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" class="cartshowa">Product</td>
<td align="center" class="cartshowa">Price</td>
<td align="center" class="cartshowa">Qty</td>
<td align="center" class="cartshowa">Tpye</td>
<td align="center" class="cartshowa">Total</td>
</tr>
<%set rs=server.createobject("adodb.recordset")
sql="select * from WrzcNet_basket where user_name='"&user_name&"' and sub_number='"&sub_number&"' and basket_check=1"
rs.open sql,conn,1,1
if rs.eof then%>
<tr><td height="50" colspan="5" align="center"><%=sub_number%><%=user_name%>No Data</td></tr>
<%
rs.close
set rs=nothing
else
i=0
do while not rs.eof
i=i+1
%>
<tr>
<td align="left" class="cartshow<%=(i mod 2)%>"><a target="_blank" href="views.asp?hw_id=<%=rs("hw_id")%>"><%=rs("hw_name")%></a></td>
<td align="center" class="cartshow<%=(i mod 2)%>"><%=fuhao%> <%=FormatNum(rs("hw_price")*hui)%> <%=danwei%></td>
<td align="center" class="cartshow<%=(i mod 2)%>"><%=rs("basket_count")%></td>
<td align="center" class="cartshow<%=(i mod 2)%>"><%=rs("kxa")%>&nbsp;<%=rs("kxb")%></td>
<td align="center" class="cartshow<%=(i mod 2)%>"><%=fuhao%> <%=FormatNum(rs("basket_count")*rs("hw_price")*hui)%> <%=danwei%></td>
</tr>
<%totalcash=totalcash+rs("basket_count")*trim(rs("hw_price"))*hui
totaljifen=totaljifen+rs("basket_count")*rs("hw_jifen")
totalw=totalw+(rs("basket_count")*trim(rs("hw_weight")))
totaly=totaly+(rs("basket_count")*trim(rs("hw_yunfei")))
totalc=totalc+rs("basket_count")
rs.movenext
loop
rs.close
set rs=nothing%>
<%if request("zp")<>0 then
i=i+1%>
<tr>
<td align="left" class="cartshow<%=(i mod 2)%>"><a target=_blank href="viewzp.asp?zp_id=<%=request("zp")%>"><%=zp_name%></a></td>
<td align="center" class="cartshow<%=(i mod 2)%>"><%=fuhao%> 0 <%=danwei%></td>
<td align="center" class="cartshow<%=(i mod 2)%>">1</td>
<td align="center" class="cartshow<%=(i mod 2)%>">Gift</td>
<td align="center" class="cartshow<%=(i mod 2)%>"><%=fuhao%> 0 <%=danwei%></td>
</tr>
<%end if%>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td height="26" align="right">
<%

set rs=server.createobject("adodb.recordset")
sql="select * from WrzcNet_sub where sub_name='"&user_name&"' and sub_number='"&sub_number&"'"
rs.open sql,conn,1,1
if not rs.eof then%>
<p style="line-height: 200%; margin-left:5px; margin-right:15px; margin-top:5px; margin-bottom:5px">
Total:<span class="price"><%=totalc%></span>&nbsp;Price:<span class="price"><%=fuhao%> <%=FormatNum(totalcash)%> <%=danwei%></span>&nbsp;&nbsp;
<%showbasket=showbasket&"<p  style=""line-height: 150%; margin: 5px"">Price:"&fuhao&" "&totalcash&" "&danwei%>
<font color="#0000FF"><%=usertype_name%></font>(<%=zhekouyu%>)<br>
<%showbasket=showbasket&"&nbsp;&nbsp;"&usertype_name&" "&zhekouyu%>


<%if quan_id<>0 and quan_cash<>0 then%>
Discount Voucher(<%=quan_no%>) Save:<%=fuhao%><%=quan_cash*hui%><%=danwei%><br>
<%end if%>

Shipping:<%=rs("sub_psname")%>&nbsp;&nbsp;Shipping Fee:<%=fuhao%> <%=rs("sub_yunfei")*hui%> <%=danwei%><br>
<%showbasket=showbasket&"&nbsp;&nbsp;Shipping Fee:"&fuhao&" "&rs("sub_yunfei")*hui&" "&danwei%>
Subtotal:<%totalcash=checkshui(totalcash*zhekou/100+rs("sub_yunfei")*hui-quan_cash*hui,shuidian,rs("sub_fapiao"))%>

<%showbasket=showbasket&"<br><b>Subtotal:<font color=red>"&fuhao&" "&FormatNum(totalcash)&" "&danwei&"</font></b>"%>
<span class="price"><%=fuhao%> <%=FormatNum(totalcash)%> <%=danwei%></span>
<%if rs("sub_fapiao")=1 then%>
<%showbasket=showbasket&"&nbsp;&nbsp;(Need Invoice Add "&shuidian&"%)"%>
(Need Invoice Add <%=shuidian%>%)
<%end if%>&nbsp;&nbsp;
You Score:<%=totaljifen%>
<%
showr="<p  style=""line-height: 150%; margin: 5px"">"
showr=showr&"Name:&nbsp;"&DelStr(request("sub_to"))&""
showr=showr&"<p  style=""line-height: 150%; margin: 5px"">"
showr=showr&"Phone Number:&nbsp;"&DelStr(request("sub_tel"))&"<br>"
showr=showr&"Email:&nbsp;"&DelStr(request("sub_mail"))&"<br>"
showr=showr&"Address:&nbsp;"&DelStr(request("sub_adds"))&" "&rs("sub_City")&" "&rs("sub_State")&" "&rs("sub_Country")&"<br>"
showr=showr&"Postcode:&nbsp;"&DelStr(request("sub_post"))&"<br>"


if mail_orders<>"" and mail_orderc<>"" then
	mail_orders=replace(replace(replace(replace(replace(replace(mail_orders,"#U",user_name),"#M",user_mail),"#S",sub_number),"#BASKET",showbasket),"#F",showf),"#R",showr)
	mail_orderc=replace(replace(replace(replace(replace(replace(mail_orderc,"#U",user_name),"#M",user_mail),"#S",sub_number),"#BASKET",showbasket),"#F",showf),"#R",showr)

	if E_SendManType=1 then
	SendEmail ""&user_mail&"",""&mail_orders&"",""&mail_orderc&"","Jmail"
	elseif E_SendManType=2 then
	SendEmail ""&user_mail&"",""&mail_orders&"",""&mail_orderc&"","ObjCDOMail"
	elseif E_SendManType=3 then
	SendEmail ""&user_mail&"",""&mail_orders&"",""&mail_orderc&"","Aspemail"
	elseif E_SendManType=4 then
	SendEmail ""&user_mail&"",""&mail_orders&"",""&mail_orderc&"","Cdom"
	end if
end if

%>

<!--#include file="IncAsp/WrzcNet_inpay.asp"-->
</td></tr><%end if%>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="99%">
<tr><td height="26" align="right" width="19%" class="cartshow0"><b>Name:　</b></td><td height="26" class="cartshow0">
	<b><%=rs("sub_to")%></b>&nbsp;&nbsp;</td></tr>
<tr><td height="26" align="right" width="19%">Phone Number:　</td><td height="26"><%=rs("sub_tel")%></td></tr>
<tr><td height="26" align="right" width="19%">Email:</td><td height="26"><%=rs("sub_mail")%></td></tr>

<tr><td height="26" align="right" width="19%">Country:</td><td height="26"><%=rs("sub_Country")%></td></tr>
<tr><td height="26" align="right" width="19%">State: </td><td height="26"><%=rs("sub_State")%></td></tr>
<tr><td height="26" align="right" width="19%">City: </td><td height="26"><%=rs("sub_City")%></td></tr>

<tr><td height="26" align="right" width="19%">Address:</td><td height="26"><%=rs("sub_adds")%></td></tr>
<tr><td height="26" align="right" width="19%">Postcode:</td><td height="26"><%=rs("sub_post")%></td></tr>
<tr><td height="26" align="right" width="19%">Arrival date:</td><td><%=rs("sub_totime")%></td></tr>
<tr><td height="26" align="right" width="19%" valign="top">Payment:</td>
	<td valign="top"><%=rs("sub_payname")%> <%if paymentid<>0 then%>
<p style="margin-top: 5px; margin-bottom: 5px;"><a href="help.asp?typeid=<%=paymentid%>" target=_blank><font color="#FF0000">More About Payment>></font></a>
<%end if%></td></tr>
<tr><td height="26" align="right" width="19%" valign="top">Shipping:</td>
	<td valign="top"><%=rs("sub_psname")%><%if psid<>0 then%>
<p style="margin-top: 5px; margin-bottom: 5px;"><a href="help.asp?typeid=<%=psid%>" target=_blank><font color="#FF0000">More About Shipping>></font></a>
<%end if%></td></tr>
<%if fapiao=1 then%>
<tr><td height="26" align="right" width="19%">Invoice:</td><td height="26"><%if rs("sub_fapiao")=1 then%>Yes(Company:<%=rs("sub_taitou")%>)<%else%>No<%end if%></td></tr>
<%end if%>
<tr><td height="26" align="right" width="19%">Out of stock:</td><td height="26"><%if rs("sub_quehuo")=1 then%>Wait<%else%>Delete<%end if%></td></tr>
<tr><td height="26" align="right" width="19%">Details:</td><td height="26"><%=rs("sub_other")%></td></tr>
</table>
<%end if
rs.close
set rs=nothing%>

</td></tr></table>
</td></tr></table></div><!--#include file="IncAsp/WrzcNet_copy.asp"-->