<!--#include file="conn.asp"--><%seo_title="Shopping Cart-"&sitename%>
<!--#include file="IncAsp/WrzcNet_top.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">


<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;Shopping Cart</td></tr>
</table>
<%
mian=mian*hui


if Request.Cookies("WrzcNet")("user_name")="" and Request.Cookies("WrzcNet")("guest")="" then
response.redirect "login.asp?comurl=buy.asp"
response.end
else
if Request.Cookies("WrzcNet")("user_name")<>"" then
user_name=Request.Cookies("WrzcNet")("user_name")
elseif Request.Cookies("WrzcNet")("guest")<>"" then
user_name=Request.Cookies("WrzcNet")("guest")
end if


if request("action")="change" then
if request("count")="" or Not(isNumeric(request("count"))) then
    count=1
else
    count=Cint(request("count"))
end if

if count<=0 then count=1

basket_id=request("basket_id")

chkid(basket_id)
set rs=server.createobject("adodb.recordset")
sql="select hw_id,basket_count from WrzcNet_basket where user_name='"&user_name&"' and basket_id="&basket_id&" and basket_check=0"
rs.open sql,conn,1,3
if not rs.eof then
hw_id=rs("hw_id")
set rsh=server.createobject("adodb.recordset")
sql="select hw_kucun from WrzcNet_hw where hw_id="&hw_id&""
rsh.open sql,conn,1,1
hw_kucun=rsh("hw_kucun")
if count>hw_kucun then
Response.Write"<script language=javascript>alert('Sorry,Shortage of stock!');window.location.href='"&Request.ServerVariables("Http_Referer")&"';</script>"
response.End
else
rsh.close
set rsh=nothing
rs("basket_count")=count
rs.update
end if
end if
rs.close
set rs=nothing
response.redirect "buy.asp"
response.End

elseif request("action")="del" then
basket_id=request("basket_id")
chkid(basket_id)
set rs=server.createobject("adodb.recordset")
sql="select * from WrzcNet_basket where user_name='"&user_name&"' and basket_id="&basket_id&" and basket_check=0"
rs.open sql,conn,1,3
if rs.eof then
response.redirect "buy.asp"
response.End
else
rs.delete
rs.update
end if
rs.close
set rs=nothing
response.redirect "buy.asp"
response.End
end if


set rs=server.createobject("adodb.recordset")
sql="select * from WrzcNet_basket where user_name='"&user_name&"' and basket_check=0"
rs.open sql,conn,1,3
i=0
do while not rs.eof
i=i+1
	set rsh=server.createobject("adodb.recordset")
	sql="select * from WrzcNet_hw where hw_id="&rs("hw_id")&""
	rsh.open sql,conn,1,1
	if not rsh.eof then
		if rs("tao_id")=0 then
		rs("hw_price")=rsh("hw_price2")
		else
		rs("hw_price")=rsh("hw_price2")+rsh("tao_price"&rs("tao_id"))
		end if
	rs.update
	else
	rs.delete
	rs.update
	end if
	rsh.close
	set rsh=nothing
rs.movenext
loop
rs.close
set rs=nothing
%>

<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">Total</td>
		<td align="center" class="cartshowa">Type</td>
		<td align="center" class="cartshowa" width="180">Modify</td>
</tr>
<%set rs=server.createobject("adodb.recordset")
sql="select * from WrzcNet_basket where user_name='"&user_name&"' and basket_check=0"
rs.open sql,conn,1,1
if rs.eof then%>
<tr><td height="50" colspan="6" align="center">No Data</td></tr>
<%
else
i=0
do while not rs.eof
i=i+1
%>
<form name="form1" method="POST" action="buy.asp?action=change&basket_id=<%=rs("basket_id")%>"><tr>
<td align="left" class="cartshow<%=(i mod 2)%>"><a target="_blank" href="<%if rs("tao_id")>0 then%>views_tao.asp?hw_id=<%=rs("hw_id")%>&tao_id=<%=rs("tao_id")%><%else%>views.asp?hw_id=<%=rs("hw_id")%><%end if%>"><%=rs("hw_name")%></a></td>
<td align="center" class="cartshow<%=(i mod 2)%>"><%=fuhao%><%=FormatNum(rs("hw_price")*hui)%></td>
<td align="center" class="cartshow<%=(i mod 2)%>"><input type="text" name="count" size="2" value="<%=rs("basket_count")%>"></td>
<td align="center" class="cartshow<%=(i mod 2)%>" class="cartshow<%=(i mod 2)%>"><%=fuhao%><%=FormatNum(rs("basket_count")*rs("hw_price")*hui)%></td>
<td align="center" class="cartshow<%=(i mod 2)%>"><%=rs("kxa")%>-<%=rs("kxb")%></td>
<td align="center" class="cartshow<%=(i mod 2)%>">
<input type="submit" value="Modify" name="B1">
<input onclick="javascript:window.open('buy.asp?action=del&basket_id=<%=rs("basket_id")%>','_self','')" type="button" value="Delete"></td>
</tr></form>
<%
totalcash=totalcash+(rs("basket_count")*trim(rs("hw_price")))*hui
totalisbn=totalisbn+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
end if
rs.close
set rs=nothing%></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td height="30" colspan="8" align="right">
<%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%>
<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;<font color="#0000FF"><%=usertype_name%></font>(<%=zhekouyu%>)<br>
Subtotal:<span class="price"><%=fuhao%> <%=FormatNum(totalcash*zhekou/100)%> <%=danwei%></span>&nbsp;&nbsp;You Score:<%=totalisbn%><br>

<%if yunfei=2 then%>Shipping Fee:<%=fuhao%> <%=totaly%> <%=danwei%><br><%elseif yunfei=3 then%>Weight:<%=totalw%> kg<br><%end if%>

<%if mian<>0 then%><%if int(mian)>int(totalcash*zhekou/100) then%>Your order qualifies for free shipping when Subtotal more then <%=fuhao%><%=mian%> <%=danwei%>!<%else%>Your order qualifies for free shipping! <%end if%><br><%end if%>
<input onclick="javascript:window.open('index.asp','_self','')" type="button" value="Continue Shopping">&nbsp;
<input onclick="javascript:window.open('cash.asp','_self','')" type="button" value="Checkout"></td></tr>
</table>


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