<!--#include file="../../Groupon/Config.asp"-->
<%
'**************************************
'* 最后更新 2013-04-16 by 56770.Kingdge
'* Copyright www.56770.com
'**************************************
Dim error,CookiesId,id,list_id,basket_chima,basket_count,basket_color,pro_num,pro_color,pro_size,pro_p_chima_id,pro_p_color_id,sum2,sum3,rsp,ppprice,pprice,pfpprice,basket_price,product_type
Showpath = "<a href='"& Eshop_url & LangPath &"'>"& Lebi_word(0) &"</a> → "& Lebi_word(7)
id = trim(request("id"))
If not isempty(id) Then
        id=replace(id," ","")
Else
        id = 0
End If
list_id = CheckNum(request("list_id"),0)
'checkuser()
GetUserId()
CookiesId = CheckNum(request.cookies(cookiesname&"_user")("cookiesid"),GetUserId())
If CookiesId = 0 Then
        response.redirect Eshop_url & PagePath(1) &"?action=nocookies"
		response.End
End If
If CInt(getGradePurview(0)) <> 1 Then
		response.redirect Eshop_url & PagePath(1) &"?action=notgrade&HTTP_REFERER="& server.urlencode(Eshop_url & PagePath(3)) &""
		response.End
End If 
rem	<-{  by 56770.WangLei
' BasketReBuy
'..................................
'读取 购物车信息-快速购买列表
'..................................
Public Function BasketReBuy()
        'On Error Resume Next
        rem 快速购买开始 by 56770.kingdge 2012-04-26 --------------------------------------------------------------
		If list_id = "" Or IsEmpty(list_id) Then
				BasketReBuy = ""
				Exit Function
		End If
		If Trim(request("product_type"))<>"unite" Then
				Set rsp=conn.execute("select p.product_name"& LangTxt &",p.bianhao,p.P_SpecificationName,p.P_SpecificationValue,p.P_SpecificationPic,p.cprice,p.cx,s.price as buyprice,p.kucun,p.id from [Lebi_product] as p,[Lebi_product_price] as s where zhuangtai=1 and s.product_id=p.id and s.grade_id="& Lebi_UserGrade &" and p.id in("& list_id &")")
				If not (rsp.eof And rsp.bof) Then
						temp = "<table align='center' cellpadding='0' cellspacing='1'><form action="""" method=""post"" name=""LEBI_FORMBUY_9999"" id=""LEBI_FORMBUY_1000"">"
						do while not rsp.eof
						temp = temp &"<tr><td class='list'><b>"&rsp(0)&"</b> ("&rsp(1)&")</td></tr>"
						P_SpecificationName=rsp(2)
						P_SpecificationValue=rsp(3)
						P_SpecificationPic=rsp(4)
						If InStr(P_SpecificationPic,"|")=0 Then P_SpecificationPic = "||||||||||||||||||||||||||||||||||||||||"
						If rsp(6) = 1 Then
								price = rsp(5)
						Else
								price = rsp(7)
						End If
						stock = rsp(8)
						id = rsp(9)
						temp = temp &"<tr><td class='list'><div class=""choosesp"">"
						If P_SpecificationName <> "" Then 
								If InStr(P_SpecificationName,",") = 0 Then 
										n = 0
										P_SpecificationValue = Replace(P_SpecificationValue,"|",",")
										If Right(P_SpecificationValue,1) = "|" Then P_SpecificationValue = cut_Right(P_SpecificationValue)
										If Right(P_SpecificationValue,1) = "," Then P_SpecificationValue = cut_Right(P_SpecificationValue)
										Set rs = conn.execute("select s_name"& LangTxt &" from [Lebi_SelectName] where s_id = "& checknum(P_SpecificationName,0) &"")
										If Not rs.eof Then 
												SName = rs(0)
												temp = temp &"<dl><dt>"& SName &"：</dt>"
										End If 
										rs.close : Set rs = Nothing
										Set rs = conn.execute("select s_value"& LangTxt &",id from [Lebi_SelectValue] where s_id = "& checknum(P_SpecificationName,0) &" and id in("& P_SpecificationValue &")")
										If Not rs.eof Then 
										j = 0
										temp = temp &"<dd>"
										Do While Not rs.eof 
												p = getN(Replace(P_SpecificationValue,"|",","),rs(1),",")
												if Split(P_SpecificationPic,"|")(p) <> "" Then
														temp = temp &"<div><a id=""sv_"& id &"_"& n &"_"& j &""" name=""sv_n_"& id &"_"& n &""" class=""spva-img"" title="""& rs(0) &""" onclick=""select_sp('"& id &"','"& n &"','"& j &"','"& SName &"|"& rs(0) &"','"& price &"','9999',"& getGradePurview(17) &");""><img src="""&Eshop_url&PicPath&"/"&Split(P_SpecificationPic,"|")(p)&""" /><span></span></a></div>"
												Else 
														temp = temp &"<div><a id=""sv_"& id &"_"& n &"_"& j &""" name=""sv_n_"& id &"_"& n &""" class=""spva"" onclick=""select_sp('"& id &"','"& n &"','"& j &"','"& SName &"|"& rs(0) &"','"& price &"','9999',"& getGradePurview(17) &");"">"& rs(0) &"</a></div>"
												End If 
										rs.movenext
										j = j + 1
										Loop
										temp = temp &"</dd>"
										End If 
										rs.close : Set rs = Nothing
										temp = temp &"<input type=""hidden"" name=""hidv_9999_"& id &""" id=""hidv_9999_"& id &"_0""></dl>"
								Else
										For n = 0 To UBound(Split(P_SpecificationName,","))
										Set rs = conn.execute("select s_name"& LangTxt &" from [Lebi_SelectName] where s_id = "& checknum(Split(P_SpecificationName,",")(n),0) &"")
										If Not rs.eof Then 
												SName = rs(0)
												temp = temp &"<dl><dt>"& SName &"：</dt>"
										End If 
										rs.close : Set rs = Nothing
										Set rs = conn.execute("select s_value"& LangTxt &",id from [Lebi_SelectValue] where s_id = "& checknum(Split(P_SpecificationName,",")(n),0) &" and id in("& Split(P_SpecificationValue,"|")(n) &")")
										If Not rs.eof Then 
										j = 0
										temp = temp &"<dd>"
										Do While Not rs.eof 
												p = getN(Replace(P_SpecificationValue,"|",","),rs(1),",")
												if Split(P_SpecificationPic,"|")(p) <> "" Then
														temp = temp &"<div><a id=""sv_"& id &"_"& n &"_"& j &""" name=""sv_n_"& id &"_"& n &""" class=""spva-img"" title="""& rs(0) &""" onclick=""select_sp('"& id &"','"& n &"','"& j &"','"& SName &"|"& rs(0) &"','"& price &"','9999',"& getGradePurview(17) &");""><img src="""&Eshop_url&PicPath&"/"&Split(P_SpecificationPic,"|")(p)&""" /><span></span></a></div>"
												Else 
														temp = temp &"<div><a id=""sv_"& id &"_"& n &"_"& j &""" name=""sv_n_"& id &"_"& n &""" class=""spva"" onclick=""select_sp('"& id &"','"& n &"','"& j &"','"& SName &"|"& rs(0) &"','"& price &"','9999',"& getGradePurview(17) &");"">"& rs(0) &"</a></div>"
												End If 
										rs.movenext
										j = j + 1
										Loop
										temp = temp &"</dd>"
										End If 
										rs.close : Set rs = Nothing
										temp = temp &"<input type=""hidden"" name=""hidv_9999_"& id &""" id=""hidv_9999_"& id &"_"& n &"""></dl>"
										Next 
								End If 
						End If 
						temp = temp &"<dl><dt>"& Lebi_cart(22) &"：</dt><dd><input type=""text"" name=""pro_num_9999_"& id &""" id=""pro_num_9999_"& id &""" value=""1"" size=""3"" class=""form""></dd></dl>"
						temp = temp &"<div class=""choosesp-btn"">"
						If CLng(getGradePurview(17)) = 1 Or (CLng(getGradePurview(17)) = 0 And CLng(stock) > 0) Then 
								temp = temp &"<input type=""button"" name=""button_9999_"& id &""" id=""button_9999_"& id &""" value="""& Lebi_cart(108) &""" onClick=""javascript:addtobasket('"& id &"','9999','',1,1)"" class=""button""></div><div id=""result_9999_"& id &""" class=""result""></div>"
						Else
								temp = temp & Lebi_pro(39)
						End If 
						temp = temp &"</div>"
						temp = temp &"</div></td></tr>"
						rsp.movenext
						loop
						temp = temp &"</form></table>"
				End If
				rsp.close:Set rsp=Nothing
		Else
				Set rs=conn.execute("select * from [Lebi_product_unite] where id in ("& list_id &")")
				If not (rs.eof And rs.bof) Then
						temp = "<table align='center' cellpadding='0' cellspacing='1'><form action="""" method=""post"" name=""LEBI_FORMBUY_9999"" id=""LEBI_FORMBUY_1000"">"
						do while not rs.eof
								id = rs("id")
								temp = temp &"<tr><td class='list'><b>"&rs("product_name"& LangTxt)&"</b> ("&rs("bianhao")&")</td></tr>"
								temp = temp &"<tr><td class='list'><div class=""choosesp"">"
								temp = temp &"<dl><dt>"& Lebi_cart(22) &"：</dt><dd><input type=""text"" name=""pro_num_9999_"& id &""" id=""pro_num_9999_"& id &""" value=""1"" size=""3"" class=""form""></dd></dl>"
								temp = temp &"<div class=""choosesp-btn"">"
								If CLng(getGradePurview(17)) = 1 Or (CLng(getGradePurview(17)) = 0 And CLng(rs("kucun")) > 0) Then 
										temp = temp &"<input type=""button"" name=""button_9999_"& id &""" id=""button_9999_"& id &""" value="""& Lebi_cart(108) &""" onClick=""javascript:addtobasket('"& id &"','9999','unite',1,1)"" class=""button"">"
								Else
										temp = temp & Lebi_pro(39)
								End If 
								temp = temp &"</div>"
								temp = temp &"</div></td></tr>"
						rs.movenext
						loop
						temp = temp &"</form></table>"
				End If
				rs.close:Set rs=Nothing
		End If
		BasketReBuy = temp
        rem 快速购买结束 by 56770.kingdge 2006-5-27 --------------------------------------------------------------
End Function

'..................................
'读取 购物车信息
'..................................
Public Function BasketList()
        Dim strFile,jifen,sum_weight,Gift_weight,basketlastprice,coupon_num,coupon_type,coupon_price, rspr,str_kucun,str_pic,str_pic_size,str_showpicsize,showpic_width,showpic_height,rspro,rss,rsss, sum1,sum2,sum3,js,jifen1,jifen2,Quatity,Scoupon,coupon_discount,LoadBasketList,loop_gift,advance_money, is_booking,sum4,propertyItem,t_propertyItem,pLoop,pLoop2,t_uLoop,bookingstr,BasketList_fapiao,loadstr, propertyTitle,uLoop,t_pLoop,BasketList_color,BasketList_size,ustr,str_filename,stock,specification_item
		strFile = Eshop_url& Style_Folder &"Lebi.BasketList."
		BasketList=""
		advance_money = 0
		Sum1 = 0
		Sum2 = 0
		sum3 = 0
		sum4 = 0
		js = 0
		jifen = 0
		sum_weight = 0
		is_booking = 0
		set checkbasket = conn.execute("select cpid from [Lebi_lsbuy] where Isgift = 0 and (sessionid="& CookiesId &" or (User_Id = '"& Lebi_UserId &"' and User_Id <> ''))")
		If Not checkbasket.eof Then 
				LoadBasketList = splits(LoadStyle(strFile&"0.style"))
				ReplaceStyle "id",id,LoadBasketList
		Else
				LoadBasketList = splits(LoadStyle(strFile&"0.style"))
				ReplaceStyle "id",id,LoadBasketList
		End If 
		checkbasket.close : Set checkbasket = Nothing 
		pLoop = splits(LoadStyle(strFile&"2.style"))
		pLoop2 = splits(LoadStyle(strFile&"4.style"))
		uLoop = splits(LoadStyle(strFile&"5.style"))
        set rs = conn.execute("select l.p_jifen,l.p_weight,l.id,l.cpid,l.Basket_count,p.product_name"& LangTxt &",l.bianhao,l.chima,l.color,l.price,l.sprice,l.Isgift,l.is_booking,l.advance_money,p.categoryid,p.pic,p.kucun,p.p_color,p.p_chima,p.p_filename,l.spname,l.spvalue from [Lebi_lsbuy] as l,[Lebi_product] as p where l.cpid = p.id and l.product_type<>'unite' and l.product_type<>'groupon' and (l.sessionid="& CookiesId &" or (l.User_Id = '"& Lebi_UserId &"' and l.User_Id <> '')) and l.father=1 and l.Isgift = 0 order by l.Basket_date desc")
	    If Not rs.eof Then
				Do While Not rs.EOF
				t_pLoop = pLoop
				stock = rs("kucun")
				Sum1 = Sum1 + (rs("sprice")/moneyhl) * rs("Basket_count")
				Sum2 = Sum2 + (rs("price")/moneyhl) * rs("Basket_count")
				Sum1=FormatNumber2(Sum1)
				Sum2=FormatNumber2(Sum2)
				Sum3 = Sum3 + (rs("price")*rs("Basket_count"))
				jifen1 = jifen1 + rs("p_jifen") * rs("Basket_count")
				rem <-{获取父级类别，计算积分返还比率 2011-2-3 by 56770.kingdge
				c_rate = GetCategoryRate(rs("categoryid"))
				If InStr(c_rate,"|") = 0 Then c_rate = "1|1|1|1|1|1|1|1|1|1|1|1|1|1|1|1"
				If IsNumeric(Split(c_rate,"|")(Lebi_UserGrade-1)) Then 
						jifen2 = jifen2 + (rs("price")*rs("Basket_count") * Split(c_rate,"|")(Lebi_UserGrade-1))
				Else
						jifen2 = jifen2 + (rs("price")*rs("Basket_count") * getGradePurview(2))
				End If 
				rem }->
				rem 修正重量计算 2007-11-17 by 5670.kingdge
				If Config_Lebi_Eshop(15) = 1 Then
						sum_weight = sum_weight + rs("p_weight") * rs("Basket_count")
				Else
						sum_weight = 0
				End If
				rem	<-{ 预订 by 56770.WangLei
				If rs("is_booking") = 1 And CInt(getGradePurview(19))=1 Then
						advance_money = advance_money + (rs("advance_money") * rs("Basket_count")/moneyhl)
						is_booking = 1
				ElseIf rs("is_booking") = 1 And CInt(getGradePurview(19))=0 Then
						advance_money = advance_money + 0
						is_booking = 1
				Else
						advance_money = advance_money + (rs("price") * rs("Basket_count")/moneyhl)
						' sum4 为 预订产品 购买价之和，用来计算最低支付金额
						sum4 = sum4 + (rs("price")/moneyhl) * rs("Basket_count")
				End If
				rem	}->
				Quatity = rs("Basket_count")
				If Quatity <= 0 Then Quatity = 1
				Dim BasketList_url,BasketList_price,BasketList_xprice
				Select Case show_html
					   Case "0"
							Select Case ISAPI_Rewrite
								   Case "0" BasketList_url=PagePath(10) &"?id="& rs("cpid")
								   Case "1" BasketList_url=LangPath &"product-"& rs("cpid")	&".html"
							End Select
					   Case "1" BasketList_url=LangPath & Folder(0) & rs("p_filename") &".1."& Sys_Ext
				End Select
				BasketList_price = FormatNumber2(rs("price")/moneyhl)
				BasketList_xprice = FormatNumber2(rs("price")*Quatity/moneyhl)
				pName = rs(5)
				property_item = ""
				If rs("spname") <> "" Then 
						property_item = splits(LoadStyle(strFile&"3.style"))
						spstr = ""
						If InStr(rs("spname"),",") > 0 Then 
								arr_spname = Split(rs("spname"),",")
								arr_spvalue = Split(rs("spvalue"),",")
								For s = 0 To UBound(arr_spname)
										spstr = spstr & arr_spname(s) &"："& arr_spvalue(s)
										If s < UBound(arr_spname) Then spstr = spstr & "&nbsp;&nbsp;"
								Next 
						Else
								spstr = rs("spname") &"："& rs("spvalue")
						End If 
						ReplaceStyle "property_item",spstr,property_item
						Set rsstock = conn.execute("select p_stock from [Lebi_Product_Stock] where p_id = "& rs("cpid") &" and s_value"& LangTxt &"='"& rs("spvalue") &"'")
						If Not rsstock.eof Then 
								stock = rsstock(0)
						End If 
						rsstock.close : Set rsstock = Nothing
				End If 
				ReplaceStyle "property_item",property_item &"<input type=""hidden"" name=""I_spvalue_"& rs("id") &""" value="""& rs("spvalue") &""" />",t_pLoop
				ReplaceStyle "name",rs(5),t_pLoop
				ReplaceStyle "pid",rs("cpid"),t_pLoop
				ReplaceStyle "id",rs("id"),t_pLoop
				ReplaceStyle "del_url",PagePath(24) &"?action=del&del_id="&rs("id"),t_pLoop
				ReplaceStyle "reset_url",PagePath(3) &"?list_id="&rs("cpid"),t_pLoop
				ReplaceStyle "pic_url",PicturePath & rs("pic"),t_pLoop
				ReplaceStyle "url",BasketList_url,t_pLoop
				ReplaceStyle "stock",stock,t_pLoop
				ReplaceStyle "number",rs("bianhao"),t_pLoop
				ReplaceStyle "market_price",FormatNumber2(rs("sprice")/moneyhl),t_pLoop
				ReplaceStyle "buy_price",BasketList_price,t_pLoop
				ReplaceStyle "count",Quatity,t_pLoop
				ReplaceStyle "sum_price",BasketList_xprice,t_pLoop
				ReplaceStyle "ico_del","images/-.gif",t_pLoop
				ReplaceStyle "ico_reset","images/+.gif",t_pLoop
				ReplaceStyle "score",formatnumber2(rs("p_jifen")*rs("Basket_count")/moneyhl),t_pLoop
				LoadBasketList = LoadBasketList & t_pLoop
				rem <-{循环显示 本产品的不同颜色和尺码组合 by 56770.kingdge 2006-5-28
				Dim t_pLoop2
				set rss = conn.execute("select l.id,l.cpid,l.Basket_count,l.color,l.chima,l.price,p.p_color,p.p_chima from [Lebi_lsbuy] as l,[lebi_product] as p where l.cpid="&rs("cpid")&" and l.cpid = p.id and l.father=0 and (l.sessionid="& CookiesId &" or (l.User_Id = '"& Lebi_UserId &"' and l.User_Id <> '')) and l.Isgift = 0 order by l.Basket_date desc")
				If Not rss.eof Then
						Do While Not rss.EOF
						t_pLoop2 = pLoop2
						Quatity = rss("Basket_count")
						If Quatity <= 0 Then Quatity = 1
						t_propertyItem = ""
						If EshopUseType = "1" Then
								t_propertyItem = propertyItem
								BasketList_color=""
								BasketList_size=""
								d_color = Replace(Trim(rss("p_color"))," ","")
								If d_color<>",," And d_color<>"" Then
										sql = "select c_id,c_name"& LangTxt &" from [Lebi_color] where"
										if IsSqlDataBase ="1" then sql = sql+" CharIndex(','+rtrim(c_id)+',',',"& d_color &",')>0"
										if IsSqlDataBase ="0" then sql = sql+" instr(',"& d_color &",',','+rtrim(c_id)+',')>0"
										sql = sql+" order by c_paixu desc"
										set rsss = conn.execute(sql)
										If not rsss.eof Then
												BasketList_color=BasketList_color&"<select name='I_color_"& rss("id") &"'>"
												BasketList_color=BasketList_color&"<option value='-'>"& Lebi_cart(151) &"</option>"
												do while not rsss.eof
												BasketList_color=BasketList_color&"<option value='"& Trim(rsss(1)) &"'"
												If CStr(Trim(rsss(1)))=CStr(Trim(rss("color"))) Then BasketList_color=BasketList_color&" selected"
												BasketList_color=BasketList_color&">"& Trim(rsss(1)) &"</option>"
												rsss.movenext
												Loop
												BasketList_color=BasketList_color&"</select>"
										End If
										rsss.close:Set rsss=Nothing
								Else
										BasketList_color=BasketList_color& rss("color")&"<input type='hidden' name='I_color_"& rss("id") &"' value='"& rss("chima") &"'>"
								End If
								d_chima = Replace(Trim(rss("p_chima"))," ","")
								If d_chima<>",," And d_chima<>"" Then
										sql = "select c_id,c_name"& LangTxt &" from [Lebi_chima] where"
										if IsSqlDataBase ="1" then sql = sql+" CharIndex(','+rtrim(c_id)+',',',"& d_chima &",')>0"
										if IsSqlDataBase ="0" then sql = sql+" instr(',"& d_chima &",',','+rtrim(c_id)+',')>0"
										sql = sql+" order by c_paixu desc"
										set rsss = conn.execute(sql)
										If not rsss.eof Then
												BasketList_size=BasketList_size&"<select name='I_size_"& rss("id") &"'>"
												BasketList_size=BasketList_size&"<option value='-'>"& Lebi_cart(151) &"</option>"
												do while not rsss.eof
												BasketList_size=BasketList_size&"<option value='"& Trim(rsss(1)) &"'"
												If CStr(Trim(rsss(1)))=CStr(Trim(rss("chima"))) Then BasketList_size=BasketList_size&" selected"
												BasketList_size=BasketList_size&">"& Trim(rsss(1)) &"</option>"
												rsss.movenext
												Loop
												BasketList_size=BasketList_size&"</select>"
										End If
										rsss.close:Set rsss=Nothing
								Else
										BasketList_size=BasketList_size& rss("chima")&"<input type='hidden' name='I_size_"&rss("id")&"' value='"&rss("chima")&"'>"
								End If
								ReplaceStyle "color",BasketList_color,t_propertyItem
								ReplaceStyle "size",BasketList_size,t_propertyItem
						End If
						ReplaceStyle "property_item",t_propertyItem,t_pLoop2
						BasketList_xprice=""&FormatNumber2(rs("price")*Quatity/moneyhl)&""
						rem	<-{ 2008-6-20 by 56770.WangLei
						Sum1 = FormatNumber2(CDbl(Sum1) + CDbl(rs("sprice")*Quatity/moneyhl))
						Sum2 = FormatNumber2(CDbl(Sum2) + CDbl(rs("price")*Quatity/moneyhl))
						Sum3 = Sum3 + (rs("price")*Quatity)
						If Lebi_UserId <>"" Then
							   jifen1 = jifen1 + rs("p_jifen") * Quatity
						Else
							   jifen1 = 0
						End If
						If Config_Lebi_Eshop(15) = 1 Then
								sum_weight = sum_weight + rs("p_weight") * Quatity
						Else
								sum_weight = 0
						End If
						rem	}->
						rem	<-{ 预订 by 56770.WangLei
						If rss("is_booking") = 1 And CInt(getGradePurview(19))=1 Then
								advance_money = advance_money + (rss("advance_money") * Quatity/moneyhl)
								is_booking = 1
						ElseIf rss("is_booking") = 1 And CInt(getGradePurview(19))=0 Then
								advance_money = advance_money + 0
								is_booking = 1
						Else
								advance_money = advance_money + (rs("price") *Quatity/moneyhl)
								' sum4 为 预订产品 购买价之和，用来计算最低支付金额
								sum4 = sum4 + (rs("price")/moneyhl) * Quatity
						End If
						rem	}->
						ReplaceStyle "id",rss("id"),t_pLoop2
						ReplaceStyle "del_url",PagePath(24) &"?action=del&del_id="&rss("id"),t_pLoop2
						ReplaceStyle "count",Quatity,t_pLoop2
						ReplaceStyle "sum_price",BasketList_xprice,t_pLoop2
						ReplaceStyle "ico_del","images/-.gif",t_pLoop2
						ReplaceStyle "score",formatnumber2(rss("p_jifen")*rss("Basket_count")/moneyhl),t_pLoop2
						LoadBasketList = LoadBasketList & t_pLoop2
						rss.movenext
						loop
				End If
				rss.close:Set rss=Nothing
				rem }->
				rs.movenext 
				Loop
		End If 
		rs.close : Set rs = Nothing 
		If Groupon_State = 1 Then 
        set rs = conn.execute("select l.p_jifen,l.p_weight,l.id,l.cpid,l.Basket_count,p.product_name"& LangTxt &",l.bianhao,l.chima,l.color,l.price,l.sprice,l.Isgift,l.is_booking,l.advance_money,p.categoryid,p.pic,p.kucun from [Lebi_lsbuy] as l,[Lebi_groupon_product] as p where l.cpid = p.id and l.product_type='groupon' and (l.sessionid="& CookiesId &" or (l.User_Id = '"& Lebi_UserId &"' and l.User_Id <> '')) and l.father=1 and l.Isgift = 0 order by l.Basket_date desc")
	    If Not rs.eof Then
				Do While Not rs.EOF
				t_gLoop = pLoop
				stock = rs("kucun")
				Sum1 = Sum1 + (rs("sprice")/moneyhl) * rs("Basket_count")
				Sum2 = Sum2 + (rs("price")/moneyhl) * rs("Basket_count")
				Sum1=FormatNumber2(Sum1)
				Sum2=FormatNumber2(Sum2)
				Sum3 = Sum3 + (rs("price")*rs("Basket_count"))
				jifen1 = jifen1 + rs("p_jifen") * rs("Basket_count")
				rem 修正重量计算 2007-11-17 by 5670.kingdge
				If Config_Lebi_Eshop(15) = 1 Then
						sum_weight = sum_weight + rs("p_weight") * rs("Basket_count")
				Else
						sum_weight = 0
				End If
				rem	<-{ 预订 by 56770.WangLei
				If rs("is_booking") = 1 And CInt(getGradePurview(19))=1 Then
						advance_money = advance_money + (rs("advance_money") * rs("Basket_count")/moneyhl)
						is_booking = 1
				ElseIf rs("is_booking") = 1 And CInt(getGradePurview(19))=0 Then
						advance_money = advance_money + 0
						is_booking = 1
				Else
						advance_money = advance_money + (rs("price") * rs("Basket_count")/moneyhl)
						' sum4 为 预订产品 购买价之和，用来计算最低支付金额
						sum4 = sum4 + (rs("price")/moneyhl) * rs("Basket_count")
				End If
				rem	}->
				Quatity = rs("Basket_count")
				If Quatity <= 0 Then Quatity = 1
				BasketList_url="groupon/detail/?id="& rs("cpid")
				BasketList_price = FormatNumber2(rs("price")/moneyhl)
				BasketList_xprice = FormatNumber2(rs("price")*Quatity/moneyhl)
				pName = rs(5)
				ReplaceStyle "property_item","",t_gLoop
				ReplaceStyle "name",rs(5),t_gLoop
				ReplaceStyle "pid",rs("cpid"),t_gLoop
				ReplaceStyle "id",rs("id"),t_gLoop
				ReplaceStyle "del_url",PagePath(24) &"?action=del&del_id="&rs("id"),t_gLoop
				ReplaceStyle "reset_url","basket/#",t_gLoop
				ReplaceStyle "pic_url",PicturePath & rs("pic"),t_gLoop
				ReplaceStyle "url",BasketList_url,t_gLoop
				ReplaceStyle "stock",stock,t_gLoop
				ReplaceStyle "number",rs("bianhao"),t_gLoop
				ReplaceStyle "market_price",FormatNumber2(rs("sprice")/moneyhl),t_gLoop
				ReplaceStyle "buy_price",BasketList_price,t_gLoop
				ReplaceStyle "count",Quatity,t_gLoop
				ReplaceStyle "sum_price",BasketList_xprice,t_gLoop
				ReplaceStyle "ico_del","images/-.gif",t_gLoop
				ReplaceStyle "ico_reset","images/+.gif",t_gLoop
				ReplaceStyle "score",formatnumber2(rs("p_jifen")*rs("Basket_count")/moneyhl),t_gLoop
				LoadBasketList = LoadBasketList & t_gLoop
				rs.movenext 
				Loop
		End If 
		rs.close : Set rs = Nothing 
		End If 
        set rs = conn.execute("select l.p_jifen,l.p_weight,l.id,l.cpid,l.Basket_count,p.product_name"& LangTxt &",l.bianhao,l.chima,l.color,l.price,l.sprice,l.Isgift,l.product_type,l.is_booking,l.advance_money,p.pic,p.kucun,p.p_filename from [Lebi_lsbuy] as l,[Lebi_product_unite] as p where l.cpid = p.id and l.product_type='unite' and (l.sessionid="& CookiesId &" or (l.User_Id = '"& Lebi_UserId &"' and l.User_Id <> '')) and l.father=1 and l.Isgift = 0 order by l.Basket_date desc")
	    If Not rs.eof Then
				Do While Not rs.EOF
				Sum1 = Sum1 + (rs("sprice")/moneyhl) * rs("Basket_count")
				Sum2 = Sum2 + (rs("price")/moneyhl) * rs("Basket_count")
				Sum1=FormatNumber2(Sum1)
				Sum2=FormatNumber2(Sum2)
				Sum3 = Sum3 + (rs("price") * rs("Basket_count"))
				jifen1 = jifen1 + rs("p_jifen") * rs("Basket_count")
				jifen2 = jifen2 + (rs("price")*rs("Basket_count") * getGradePurview(2))
				If Config_Lebi_Eshop(15) = 1 Then
						sum_weight = sum_weight + rs("p_weight") * rs("Basket_count")
				End If
				rem	<-{ 预订 by 56770.WangLei
				If rs("is_booking") = 1 And CInt(getGradePurview(19))=1 Then
						advance_money = advance_money + (rs("advance_money") * rs("Basket_count")/moneyhl)
						is_booking = 1
				ElseIf rs("is_booking") = 1 And CInt(getGradePurview(19))=0 Then
						advance_money = advance_money + 0
						is_booking = 1
				Else
						advance_money = advance_money + (rs("price") * rs("Basket_count")/moneyhl)
						' sum4 为 预订产品 购买价之和，用来计算最低支付金额
						sum4 = sum4 + (rs("price")/moneyhl) * rs("Basket_count")
						is_booking = 0
				End If
				rem	}->
				rem	<-{ 预订 by 56770.WangLei
				If rs("is_booking") = 1 And CInt(getGradePurview(19))=1 Then
						advance_money = advance_money + (rs("advance_money") * rs("Basket_count")/moneyhl)
						is_booking = 1
				ElseIf rs("is_booking") = 1 And CInt(getGradePurview(19))=0 Then
						advance_money = advance_money + 0
						is_booking = 1
				Else
						advance_money = advance_money + (rs("price") * rs("Basket_count")/moneyhl)
						' sum4 为 预订产品 购买价之和，用来计算最低支付金额
						sum4 = sum4 + (rs("price")/moneyhl) * rs("Basket_count")
				End If
				rem	}->
				t_uLoop = uLoop
				BasketList_price = FormatNumber2(rs("price")/moneyhl)
				BasketList_xprice = FormatNumber2(rs("price") * rs("Basket_count")/moneyhl)
				Select Case show_html
					   Case "0"
							Select Case ISAPI_Rewrite
								   Case "0" BasketList_url=PagePath(8) &"?id="& rs("cpid")
								   Case "1" BasketList_url=LangPath &"unite_show-"& rs("cpid")	&".html"
							End Select
					   Case "1" BasketList_url=LangPath & Folder(9) & rs("p_filename") &".1."& Sys_Ext
				End Select
				ReplaceStyle "id",rs("id"),t_uLoop
				ReplaceStyle "pid",rs("cpid"),t_uLoop
				ReplaceStyle "name",rs(5),t_uLoop
				ReplaceStyle "url",BasketList_url,t_uLoop
				ReplaceStyle "del_url",PagePath(24) &"?action=del&del_id="&rs("id"),t_uLoop
				ReplaceStyle "reset_url",PagePath(3) &"?list_id="&rs("cpid")&"&product_type=unite",t_uLoop
				ReplaceStyle "pic_url",PicturePath & rs("pic"),t_uLoop
				ReplaceStyle "ico_unite","images/unite.gif",t_uLoop
				ReplaceStyle "number",rs("bianhao"),t_uLoop
				ReplaceStyle "child_list",getUniteChild(rs("cpid"),0," <FONT COLOR=""#FF0000"">＋</FONT> "),t_uLoop
				ReplaceStyle "market_price",FormatNumber2(rs("sprice")/moneyhl),t_uLoop
				ReplaceStyle "buy_price",BasketList_price,t_uLoop
				ReplaceStyle "count",rs("Basket_count"),t_uLoop
				ReplaceStyle "sum_price",BasketList_xprice,t_uLoop
				ReplaceStyle "ico_del","images/-.gif",t_uLoop
				ReplaceStyle "ico_reset","images/+.gif",t_uLoop
				ReplaceStyle "stock",rs("kucun"),t_uLoop
				ReplaceStyle "score",formatnumber2(rs("p_jifen") * rs("Basket_count")/moneyhl),t_uLoop
				If EshopUseType = "1" Then
						ReplaceStyle "property_item","<td class=""list"">-</td><td class=""list"">-</td>",t_uLoop
				Else
						ReplaceStyle "property_item","",t_uLoop
				End If
				LoadBasketList = LoadBasketList & t_uLoop
				rs.MoveNext
				Loop
        End If
        rs.close:Set rs=Nothing
		rem 显示换购礼品 2007-9-26 by 56770.kingdge
		set rs = conn.execute("select p_weight,id,cpid,Basket_count,product_name,price from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& Lebi_UserId &"' and User_Id <> '')) and Isgift = 1 order by Basket_date desc")
		If Not rs.eof Then
				LoadBasketList = LoadBasketList & splits(LoadStyle(strFile&"6.style"))
				uLoop = splits(LoadStyle(strFile&"7.style"))
				Do While Not rs.eof
						t_uLoop = uLoop
						Gift_weight = Gift_weight + rs("p_weight")
						ReplaceStyle "gift_name",rs("product_name"),t_uLoop
						ReplaceStyle "gift_id",rs("id"),t_uLoop
						ReplaceStyle "del_url",PagePath(24) &"?action=GiftDel&del_id="&rs("id"),t_uLoop
						ReplaceStyle "gift_weight",rs("p_weight"),t_uLoop
						ReplaceStyle "gift_price",formatnumber2(rs("price")/moneyhl),t_uLoop
						ReplaceStyle "gift_count",rs("basket_count"),t_uLoop
						ReplaceStyle "gift_sum_price",formatnumber2(rs("price")*rs("basket_count")/moneyhl),t_uLoop
						ReplaceStyle "ico_del","images/-.gif",t_uLoop
						LoadBasketList = LoadBasketList & t_uLoop
				rs.movenext
				Loop
				LoadBasketList = LoadBasketList & LoadStyle(strFile&"8.style")
		End If
		rs.close:Set rs=Nothing
        Dim z_price,z_discount,strdiscount,z_str1,z_str2,z_str3
		If IsSqlDataBase = 1 Then
	            Set rs=conn.execute("select top 1 * from [Lebi_discount] where z_price<="& sum3 &" and charindex('"& Lebi_UserGrade &"',z_flag)>0 order by z_id desc")
        Else
		        Set rs=conn.execute("select top 1 * from [Lebi_discount] where z_price<="& sum3 &" and instr(z_flag,"& Lebi_UserGrade &")>0 order by z_id desc")
		End If
	    If rs.eof And rs.bof Then
	            z_price="0"
	            z_discount="1.00"
        Else
                z_price=rs("z_price")
		        z_discount=rs("z_discount")
		        strdiscount = inttotext(1-rs("z_discount"))
        End If
        rs.close:Set rs=Nothing
        z_str1=dw & formatnumber2(z_price/moneyhl) & dw2
        z_str2=strdiscount
        z_str3=dw & formatnumber2(sum2*z_discount) & dw2
		Dim BasketList_jsprice,BasketList_jifen,BasketList_coupon,BasketList_discount
		rem	<-{ 2008-6-20 by 56770.WangLei
		js=FormatNumber2(CDbl(Sum1)-CDbl(Sum2))
		If left(js,2)="0-" Then
			   js="-"&FormatNumber2(CDbl(Sum1)-CDbl(Sum2))
		Else
			   js=js
		End If
		jifen = CLng(jifen1 + (jifen2 * z_discount))
		rem	}->
		BasketList_price = Sum2
		BasketList_jsprice = js
		BasketList_jifen = jifen
		Set rs = conn.execute("select coupon_num from [Lebi_lshy] where sessionid="& CookiesId &"")
		If Not rs.eof Then
				If Trim(rs(0)) <> "" Then
						coupon_num = rs(0)
						Set Scoupon = conn.execute("select c_type,c_price,c_discount from [Lebi_coupon] where c_num = '"& coupon_num &"'")
						coupon_type = Scoupon(0)
						coupon_price = Scoupon(1)/moneyhl
						coupon_discount = Scoupon(2)
						Scoupon.close : Set Scoupon = Nothing
						If coupon_type = 0 Then basketlastprice = dw & formatnumber2((sum2*z_discount) - coupon_price) & dw2
						If coupon_type = 1 Then basketlastprice = dw & formatnumber2((sum2*z_discount) * coupon_discount/100) & dw2
						If coupon_type = 0 Then BasketList_coupon = Lebi_cart(137) &" "&Lebi_cart(138)&" "& dw & formatnumber2(coupon_price) & dw2
						If coupon_type = 1 Then BasketList_coupon = Lebi_cart(137) &" "&Lebi_cart(139)&" "& coupon_discount &"%"
				Else
						basketlastprice = z_str3
						BasketList_coupon=""& Lebi_cart(128) &"：<input type=""text"" name=""c_num"" id=""c_num"" value="""& coupon_num &""" size=""20"" class=""form"" /> <input type=""button"" name=""bt"" value="""& Lebi_cart(129) &""" onClick=""javascript:usecoupon()"" class=""button"" />"
				End If
		Else
				basketlastprice = z_str3
				BasketList_coupon=""& Lebi_cart(128) &"：<input type=""text"" name=""c_num"" id=""c_num"" value="""& coupon_num &""" size=""20"" class=""form"" /> <input type=""button"" name=""bt"" value="""& Lebi_cart(129) &""" onClick=""javascript:usecoupon()"" class=""button"" />"
		End If
		rs.close : Set rs = Nothing
		loadstr = splits(LoadStyle(strFile&"9.style"))
		bookingstr = ""
		If is_booking = 1 And CInt(getGradePurview(19)) = 1 Then
				bookingstr = splits(LoadStyle(strFile&"10.style"))
				ReplaceStyle "low_price",FormatNumber2((advance_money)/moneyhl),bookingstr
				ReplaceStyle "save_price",FormatNumber2((BasketList_price-advance_money)/moneyhl),bookingstr
		End If
		ReplaceStyle "booking",bookingstr,loadstr
		BasketList_discount=""
		If z_price>0 Then
				BasketList_discount = LoadStyle(strFile&"11.style")
				ReplaceStyle "order_discount", Replace(replace(Replace(Lebi_cart(28),"[z_str1]",z_str1),"[z_str2]",z_str2),"[z_str3]","<span class='discountprice'>"&z_str3&"</span>") , BasketList_discount
		End If
		ReplaceStyle "order_discount",BasketList_discount,loadstr
		BasketList_fapiao=""
		If Config_Lebi_Eshop(2)="1" Then
				BasketList_fapiao = LoadStyle(strFile&"12.style")
                ReplaceStyle "order_invoice", Replace(Lebi_cart(29),"[fapiao_bl]","<font color='#ff3333'>"&Config_Lebi_Eshop(14)&"</font>") , BasketList_fapiao
	    End If
		ReplaceStyle "invoice",BasketList_fapiao,loadstr
		ReplaceStyle "order_market_pirce",formatnumber2(Sum1),loadstr
		ReplaceStyle "order_pirce",formatnumber2(BasketList_price),loadstr
		ReplaceStyle "order_save_pirce",BasketList_jsprice,loadstr
		ReplaceStyle "order_score",BasketList_jifen,loadstr
		ReplaceStyle "order_weight",sum_weight+Gift_weight,loadstr
		ReplaceStyle "order_coupon",BasketList_coupon,loadstr
		ReplaceStyle "order_total_price",basketlastprice,loadstr
		BasketList = "<form name=""form"" action="""& Eshop_url & PagePath(24) &"?action=update_cart"" method=""post"">"& LoadBasketList & loadstr & LoadStyle(strFile&"13.style") &"</form>"
End Function
%>