<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--#include file="../Include/Lebi_config.asp"-->
<!--#include file="../include/Lebi_email_cls.asp"-->
<%
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 Admin_orders_cart.asp
'* 最后更新 2012-11-26 by 56770.kingdge
'*****************************************
Dim admin_flag
admin_flag=",1.5,"
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_order.inc"
include "lang/"& LangFilePath &"/lang_buy.inc"
CurrentId = 2
CurrentUrl = "admin_order_quick.asp"
LB_Head()
LB_Menu()%>
<div class="tabmenu mainwidth">
      <ul>
        <li><a href="admin_order_quick.asp"><span><%=Lang_Menu(87)%></span></a></li>
        <li class="current"><a href="Admin_order_cart.asp"><span><%=Lang_Order(39)%></span></a></li>
      </ul>
</div>
<%
Response.Write("<div class=""tab-mainbody"">")
Response.Write("<div class=""tab-mainbody2"">")
If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
		adminflag()
Else
		If OutSubmit = 1 Then CheckOutSubmit()
		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,uGrade,User_Id
		id = safereplace(request("id"))
		If not isempty(id) Then
				id=replace(trim(id)," ","")
				If instr(id,",")>0 Then
						id = id
				Else
						id = id
				End If
		Else
				id = 0
		End If
		list_id = CheckNum(request("list_id"),0)
		userid = request.cookies(cookiesname&"_basket")("order_userid")
		If userid = "" Then userid = Session(cookiesname&"_basket"&"order_userid")
		order_user_id = safereplace(request.cookies(cookiesname&"_basket")("order_"& userid &"_id"))
		If order_user_id = "" Then order_user_id = safereplace(Session(cookiesname&"_basket"&"order_"& userid &"_id"))
		order_user_name = safereplace(request.cookies(cookiesname&"_basket")("order_"& userid &"_name"))
		If order_user_name = "" Then order_user_name = safereplace(Session(cookiesname&"_basket"&"order_"& userid &"_name"))
		order_user_grade = checknum(safereplace(request.cookies(cookiesname&"_basket")("order_"& userid &"_grade")),1)
		If order_user_grade = 1 Then order_user_grade = Session(cookiesname&"_basket"&"order_"& userid &"_grade")
		order_user_grade_name = safereplace(request.cookies(cookiesname&"_basket")("order_"& userid &"_grade_name"))
		If order_user_grade_name = "" Then order_user_grade_name = safereplace(Session(cookiesname&"_basket"&"order_"& userid &"_grade_name"))
		CookiesId = CheckNum(request.cookies(cookiesname&"_basket")("order_"& userid &"_cookiesid"),0)
		If CookiesId = 0 Then CookiesId = CheckNum(Session(cookiesname&"_basket"&"order_"& userid &"_cookiesid"),0)
		If CookiesId = 0 Then
				Write_Lebi_Eshop("<SCRIPT language=JavaScript>alert('"& Lang_Order(33) &"');javascript:history.go(-1)</SCRIPT>")
				response.End
		End If
		uGrade = CheckNum(order_user_grade,1) : If uGrade=0 Then uGrade = 1
		User_Id = order_user_id
		Select Case request("action")
			   Case "buy" : buy()
			   Case "del" : del()
			   Case "del_all" : del_all()
			   Case "update_cart" : update_cart()
			   Case "shoucang" : shoucang()
			   Case "cash" : cash()
			   Case "cashview" : cashview()
			   Case "cashsave" : cashsave()
			   Case Else
					main()
		End Select
End If
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()

Sub buy()
		Dim is_booking,advance_money
		is_booking = 0
		advance_money = 0
		product_type=trim(request("product_type"))
		If product_type = "unite" Then
				buyUnite()  '捆绑促销
		Else
				id=CheckNum(request("id"),0)
				pro_num=CheckNum(trim(request("pro_num")),1)
				spname=safereplace(request("spname"))
				spvalue=safereplace(request("spvalue"))
				set rsp = conn.execute("select product_name,bianhao,sprice,cprice,cx,p_jifen,kucun,p_weight,p_color,p_chima,s.price as buyprice from [Lebi_product] as p,[Lebi_product_price] as s  where zhuangtai=1 and p.id="&id&" and s.product_id=p.id and s.grade_id="&uGrade)
		'		response.write("001=<br>")
		'		response.write("id="&id&"<br>")
		'		response.write("pro_num="&pro_num&"<br>")
		'		response.write("sql=""select product_name,bianhao,sprice,cprice,cx,p_jifen,kucun,p_weight,p_color,p_chima,s.price as buyprice from [Lebi_product] as p,[Lebi_product_price] as s  where zhuangtai=1 and p.id="&id&" and s.product_id=p.id and s.grade_id="&uGrade&"<br>")
		'		response.End
				If not rsp.eof Then
'						If clng(rsp("kucun"))<clng(pro_num) Then
'								If CInt(getGradePurview(17)) <> 1 Then
'										If rsp("kucun")<=0 Then
'												response.redirect Eshop_url & "Message/Error/?action=basket&error_type=1"
'										Else
'												response.redirect Eshop_url & "Message/Error/?action=basket&error_type=2&stock="& rsp("kucun") &""
'										End if
'										response.End
'								Else
'										is_booking = 1
'								End If
'						End If
						If rsp("cx") = 1 Then
								basket_price = rsp("cprice")
						Else
								basket_price = rsp("buyprice")
						End If
		'				rem	<-{ 预订 by 56770.WangLei
		'				If is_booking = 1 And CInt(getGradePurview(19))=1 Then
		'						advance_money = CDbl(basket_price) * CDbl(getGradePurview(20))
		'				End If
		'				rem	}->
						set rs = conn.execute("select sessionid from [Lebi_lsbuy] where cpid="&id&" and spvalue='"&spvalue&"' and (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> '')) and IsGift=0")
						If rs.eof Then
								conn.execute("Insert into [Lebi_lsbuy](cpid,product_name,bianhao,sprice,price,sessionid,basket_date,p_jifen,IsGift,p_weight,spname,spvalue,basket_count,father,is_booking,advance_money,product_type,User_Id)values("&id&",'"&rsp("product_name")&"','"&rsp("bianhao")&"',"&rsp("sprice")&","&basket_price&","& CookiesId &","&sqlnowstring&","&rsp("p_jifen")&",0,"&rsp("p_weight")&",'"&spname&"','"&spvalue&"',"&pro_num&",1,"&is_booking&","&advance_money&",'','"& user_id &"')")
						Else
								conn.execute("Update [Lebi_lsbuy] set basket_date="& sqlnowstring &",basket_count="& pro_num &",is_booking="& is_booking &",advance_money="& advance_money &" where cpid="& id &" and spvalue='"&spvalue&"' and (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> '')) and IsGift=0")
						End If
						rs.close:set rs=Nothing
				End If
				rsp.close:Set rsp=Nothing
		End If
		response.redirect "admin_order_cart.asp"
		response.End
End Sub

Sub del_all
        conn.execute("Delete from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> ''))")
        conn.execute("Delete from [Lebi_lshy] where sessionid="& Clng(CookiesId) &"")
		response.redirect "admin_order_cart.asp"
        response.end
End Sub

Sub del
        Dim del_id,rss
        del_id=CheckNum(request("del_id"),0)
	    Set rs=conn.execute("select cpid,father,product_name,bianhao from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> '')) and id="& del_id &" and IsGift=0")
	    If Not rs.eof Then
	            If rs("father")=0 Then
                        conn.execute("Delete from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> '')) and id="&del_id&" and IsGift=0")
                Else
			            set Rss = conn.execute("select top 1 id from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> '')) and cpid = "& rs("cpid") &" and father=0 order by id asc")
			            If not rss.eof Then
                                conn.execute("update [Lebi_lsbuy] set father=1,product_name='"& rs("product_name") &"',bianhao='"& rs("bianhao") &"' where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> '')) and id = "& rss("id") &"")
			            End If
		                rss.close:set rss=nothing
			            conn.execute("Delete from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> '')) and id="&del_id&" and IsGift=0")
		       End If
	    End If
	    rs.close:Set rs=Nothing
        response.redirect "admin_order_cart.asp"
		response.end
End Sub


Sub Update_cart
        dim cpid,is_booking
        set rs = conn.execute("select * from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> ''))")
        do while not rs.eof
        cpid=rs("cpid")
        id=rs("id")
		is_booking=rs("is_booking")
        basket_count=CheckNum(request("I_num_"&id&""),1)
		basket_chima=Trim(request("I_size_"&id&""))
		basket_color=Trim(request("I_color_"&id&""))
		basket_price=CheckNum(request("I_price_"&id&""),0)
        If basket_count <= 0 Then
               basket_count =rs("basket_count")
               If basket_count <= 0 Then basket_count = 1
        End If
        dim rsk,errormes
        set rsk = conn.execute("select kucun,product_name from [Lebi_product] where zhuangtai=1 and id ="&cpid&"")
        do while not rsk.eof
				' 加预订判断 2008-3-19 by 56770.WangLei
                If clng(rsk("kucun"))<clng(basket_count) And is_booking <> 1 Then
                         error=1
	                     errormes=errormes&"\n\n"& Lang_Order(5) & rsk("product_name") &"   |  "& Lang_Order(34) & rsk("kucun")
                End If
        rsk.movenext
        loop
        rsk.close:Set rsk=nothing

        If Error<>1 Then
                conn.execute("Update [Lebi_lsbuy] set basket_count = "&basket_count&",color='"&basket_color&"',chima='"&basket_chima&"',price="&basket_price&" where id="&id&"")
        End If
        rs.movenext
        loop
        rs.close
        If Error=1 Then
                Write_Lebi_Eshop("<SCRIPT language=JavaScript>alert('"& Lang_Order(35) &"\n\n"& errormes &"');javascript:history.go(-1)</SCRIPT>")
        Else
                response.redirect "admin_order_cart.asp"
        End If
End Sub

Sub shoucang
        Dim rsc
        If order_user_id <>"" Then
                set rs = conn.execute("select * from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> '')) and IsGift=0 and father=1")
                do while not rs.eof
		        set rsc=conn.execute ("select * from [Lebi_action] where id="&rs("cpid")&" and user_id='"& order_user_id &"' and product_type='"&rs("product_type")&"'")
                If rsc.eof Then
                        conn.execute"insert into [Lebi_action](id,product_name,user_id,actiondate,product_type)values("&rs("cpid")&",'"&rs("product_name")&"','"& order_user_id &"',"&sqlnowstring&",'"&rs("product_type")&"')"
		        Else
                        conn.execute("Update [Lebi_action] set actiondate="&sqlnowstring&" where id="&rs("cpid")&" and user_id='"& order_user_id &"'")
                End If
                rsc.close:set rsc=nothing
                rs.movenext
                loop
                rs.close:Set rs=Nothing
				Call Up_mes(Lang_Menu(87),"·"& Lang_Order(36),0,"javascript:history.go(-1);",0,0,2,1)
        End If
End Sub

Sub main()
%>
<script language="javascript" type="text/javascript" src="inc/js/js_link.js"></script>
<script language="javascript" type="text/javascript" src="inc/js/order_quick.js"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable-top">
<tbody>
<tr>
<td height="30" align="left" class="classhead">
<%=Lang_Order(37) & order_user_id &"/"& order_user_name%>&nbsp;&nbsp;<%=Lang_Order(38) & order_user_grade_name%>
</td>
<td align="right" class="classhead">
<%=Lang_Order(39)%> <a href="admin_order_cart.asp"><u><span id="carttotalnum" class="totalnum">0</span> <%=Lang_Order(40)%></a></u>&nbsp;&nbsp;<%=Lang_Order(41)%> ￥<span id="carttotalprice" class="totalprice">0.00</span>
<script language="javascript" type="text/javascript" src="Ajax_Cart.asp?showtype=1"></script>
</td>
</tr>
</tbody>
</table>
<%
sql="select * from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> '')) and IsGift=1"
set rs = conn.execute(sql)
If Not rs.eof Then
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="gift" class="classtable2">
<tr class="classhead"><td colspan="5" class="classhead" height="30"><%=Lang_Order(42)%></td></tr>
<tr class="classrow">
<td height="30" width="5%" align="center" class="classtop"><%=Lang_Order(43)%></td>
<td width="49%" class="classtop">&nbsp;<%=Lang_Order(44)%></td>
<td width="10%" align="center" class="classtop"><%=Lang_Order(45)%></td>
<td width="10%" align="center" class="classtop"><%=Lang_Order(46)%></td>
<td width="8%" align="center" class="classtop"><%=Lang_Order(47)%></td>
<td width="8%" align="center" class="classtop"><%=Lang_Order(48)%></td>
</td>
</tr>
<%Do While Not rs.eof
rem <-{增加缩图显示 2008-5-17 by 56770.kingdge
Set GetPic = conn.execute("select pic from [Lebi_vipproduct] where id = "& rs("id") &"")
If Not GetPic.eof Then
GiftPic = GetPic(0)
End If
GetPic.close : Set GetPic = Nothing
rem }->
%>
<tr class="classrow">
<td align="center" class="classrow"><img src='images/img.gif' align='absmiddle' onMouseover="fixedtooltip('<img src=../<%=GiftPic%> height=100>', this, event, '100px')" onMouseout="delayhidetip()"></td>
<td height="30" class="classrow"><%=rs("product_name")%></td>
<td align="center" class="classrow"><%=rs("price")%></td>
<td align="center" class="classrow"><%=rs("basket_count")%></td>
<td align="center" class="classrow"><%=rs("price")*rs("basket_count")%></td>
<td align="center" class="classrow"><a href="?action=del_gift&b_id=<%=rs("basket_id")%>&id=<%=id%>" onClick="return ConfirmDel();"><img src="images/icon_del.gif" title="<%=Lang_sys(15)%>" border="0" align="absmiddle"></a></td>
</tr>
<%
rs.movenext
Loop
%>
</table>
<script>tdshow("gift");</script>
<%
End If
rs.close : Set rs = Nothing
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="product" class="classtable2">
<tr>
   <td height="30" colspan="9" align="left" class="classhead">
        <input type="image" src="lang/<%=LangFilePath%>/images/bt_cash.gif" title=" <%=Lang_sys(10)%> " onclick="location.href='?action=cash';return false;" align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_bak.gif" title=" <%=Lang_sys(3)%> " onclick="location.href='javascript:history.back();';return false;" align="absmiddle">
   </td>
</tr>
<form name="form1" method="post" action="?action=update_cart">
<tr class="classrow">
<td height="30" width="12%" class="classtop"><%=Lang_Order(49)%></td>
<td width="47%" class="classtop"><%=Lang_Order(50)%></td>
<td width="5%" class="classtop"><%=Lang_Order(43)%></td>
<td width="10%" class="classtop"><%=Lang_Order(46)%></td>
<td width="10%" class="classtop"><%=Lang_Order(53)%></td>
<td width="8%" class="classtop"><%=Lang_Order(47)%></td>
<td width="8%" class="classtop"><%=Lang_Order(48)%></td>
</td>
</tr>
<%
sql="select * from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> '')) and father=1 and IsGift=0 order by basket_count desc,cpid desc"
set rs2 = conn.execute(sql)
If Not rs2.eof Then
do while not rs2.eof  'WangLei 2008-1-14
rem <-{增加缩图显示 2008-5-17 by 56770.kingdge
Set GetPic = conn.execute("select pic from [Lebi_product] where id = "& rs2("cpid") &"")
If Not GetPic.eof Then
ProPic = GetPic(0)
End If
GetPic.close : Set GetPic = Nothing
rem }->
        pro_bianhao = rs2("bianhao")
		pro_price = FormatNumber2(rs2("price"))
		pro_totalprice = FormatNumber2(rs2("price")*rs2("basket_count"))
		pro_product_type = rs2("product_type")
		If pro_product_type = "unite" Then
			pro_viewurl = "<a target='_blank' href='../product/unite/show/?id="& rs2("cpid") &"'><img src=""images/icon_view.gif"" width=""16"" height=""16"" title="""& Lang_sys(59) &""" border=""0"" align=""absmiddle""></a>"
			pName = "<img src=""images/unite.gif"" title="""& Lang_sys(59) &""" border=""0"">"&rs2("product_name")&"("&getUniteChild(rs2("cpid"),0,"&nbsp;|&nbsp;")&")"
		Else
			pro_viewurl = "<a target='_blank' href='../product/?id="& rs2("cpid") &"'><img src=""images/icon_view.gif"" width=""16"" height=""16"" title="""& Lang_sys(59) &""" border=""0"" align=""absmiddle""></a>"
			pName = rs2("product_name")
		End If
		If rs2("spname") <> "" Then 
				spstr = ""
				If InStr(rs2("spname"),",") > 0 Then 
						arr_spname = Split(rs2("spname"),",")
						arr_spvalue = Split(rs2("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 = rs2("spname") &"："& rs2("spvalue")
				End If 
		End If 
		If spstr <> "" Then pName = pName &"<em>"& spstr &"</em>"
%>
<input type="hidden" name="b_id" value="<%=rs2("id")%>">
<input type="hidden" name="p_id" value="<%=rs2("cpid")%>">
<tr class="classrow">
<td height="30" class="classrow"><%If rs2("is_booking")=1 Then response.write "<FONT COLOR=red>["& Lang_Order(13) &"]</FONT>"%><%= pro_bianhao%></td>
<td class="classrow"><%=pName%></td>
<td class="classrow"><img src='images/img.gif' align='absmiddle' onMouseover="javascript:ddrivetip('<img src=../<%= PicPath %>/<%=ProPic%> width=<%=Upload_SPicWidth%> height=<%=Upload_SPicHeight%>>', '#ffffff', '<%=Upload_SPicWidth%>')" onMouseout="hideddrivetip()"></td>
<td class="classrow"><input type="text" name="I_num_<%=rs2("id")%>" value="<%=rs2("basket_count")%>" size="5" class="form" onkeyup="value=value.replace(/[^\d\.]/g,'');"></td>
<td class="classrow"><input type="text" name="I_price_<%=rs2("id")%>" value="<%=Replace(FormatNumber(rs2("price"),2),",","")%>" size="5" class="form" onkeyup="value=value.replace(/[^\d\.]/g,'');"></td>
<td class="classrow"><%=rs2("price")*rs2("basket_count")%></td>
<td class="classrow"><%=pro_viewurl%> <a href="?action=del&del_id=<%=rs2("id")%>" onClick="return ConfirmDel();"><img src="images/icon_del.gif" title="<%=Lang_sys(15)%>" width="16" height="16" border="0" align="absmiddle"></a></td>
</tr>
<%
sql_s="select * from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> '')) and cpid="&rs2("cpid")&" and father=0 and IsGift=0 order by id asc"
set rs = conn.execute(sql_s)
do while not rs.eof
%>
<input type="hidden" name="b_id" value="<%=rs("id")%>">
<input type="hidden" name="p_id" value="<%=rs("cpid")%>">
<tr class="classrow">
<td height="30" class="classrow">--</td>
<td height="30" class="classrow"></td>
<td height="30" class="classrow"></td>
<td class="classrow"><input type="text" name="I_num_<%=rs("id")%>" value="<%=rs("basket_count")%>" size="5" class="form" onkeyup="value=value.replace(/[^\d\.]/g,'');"></td>
<td class="classrow"><input type="text" name="price_<%=rs("id")%>" value="<%=Replace(FormatNumber(rs("price"),2),",","")%>" size="5" class="form" onkeyup="value=value.replace(/[^\d\.]/g,'');"></td>
<td class="classrow"><%=rs("price")*rs("basket_count")%></td>
<td class="classrow"><a href="?action=del&del_id=<%=rs("id")%>" onClick="return ConfirmDel();"><img src="images/icon_del.gif" title="<%=Lang_sys(15)%>" width="16" height="16" border="0" align="absmiddle"></a></td>
<%
rs.movenext
loop
rs.close:set rs=nothing
rs2.movenext
b_num=b_num+1
Loop
rs2.close:set rs2=nothing
%>
<%
End If
%>
<tr>
   <td height="30" colspan="9" align="left" class="classfooter">
        <input type="image" name="EmptyBasket" src="lang/<%=LangFilePath%>/images/bt_empty.gif" title=" <%=Lang_sys(16)%> " onclick="EmptyBasket();return false;" align="absmiddle">&nbsp;<input type="image" name="FavBasket" src="lang/<%=LangFilePath%>/images/bt_fav.gif" title=" <%=Lang_sys(17)%> " onclick="FavBasket();;return false;" align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">&nbsp;<input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">
   </td>
</tr>
</form>
</table>
<script>tdshow("product");</script>
<%
End Sub

Sub cash
set rs = conn.execute("select * from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> '')) order by id")
do While Not rs.EOF
		Sum1 = Sum1 + rs("sprice") * rs("basket_count")
		If rs("IsGift") = 0 Then
				Sum2 = Sum2 + (rs("price") * rs("basket_count"))
				Sum3 = Sum3 + (rs("price")*rs("basket_count"))
		End If
		Sum1=FormatNumber2(Sum1/moneyhl)
		Sum2=FormatNumber2(Sum2/moneyhl)
		strsum3=sum3
		js=FormatNumber2(Sum1-Sum2)
		If safereplace(request.cookies(cookiesname&"_basket")("user_id"))<>"" Then
				jifen1 = jifen1 + rs("p_jifen") * rs("basket_count")
		Else
				jifen1 = 0
		End If
		p_weight= p_weight + (rs("p_weight")*rs("basket_count")/1000)
		Jifen2=clng(Sum3*getGradePurview(2))
		jifen=jifen1+jifen2
rs.MoveNext
loop
rs.close : Set rs=Nothing
Set rs = conn.execute("select user_name,user_tel,user_mail,user_postalcode,user_adds,fapiao_company,fapiao_adds,fapiao_zip from lebi_user where user_id = '"& order_user_id &"'")
If Not rs.eof Then
		user_name = rs(0)
		user_tel = rs(1)
		user_mail = rs(2)
		user_zip = rs(3)
		user_adds = rs(4)
		fapiao_company = rs(5)
		fapiao_adds = rs(6)
		fapiao_zip = rs(7)
End If
rs.close : Set rs = Nothing
%>
<script language="javascript" type="text/javascript" src="inc/js/order_quick.js"></script>
<script language="javascript" type="text/javascript" src="inc/js/js_link.js"></script>
<script>function killerrors() {return true;}window.onerror = killerrors;dd</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable-top">
<tbody>
<tr>
<td height="30" align="left" class="classhead">
<%=Lang_Order(37) & order_user_id &"/"& order_user_name%>&nbsp;&nbsp;<%=Lang_Order(38) & order_user_grade_name%>
</td>
<td align="right" class="classhead">
<%=Lang_Order(39)%> <a href="admin_order_cart.asp"><span id="carttotalnum" class="totalnum">0</span> <%=Lang_Order(40)%></a>&nbsp;&nbsp;<%=Lang_Order(41)%> ￥<span id="carttotalprice" class="totalprice">0.00</span>
<script language="javascript" type="text/javascript" src="Ajax_Cart.asp?showtype=1"></script>
</td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="cashview" class="classtable2">
<form name="checkcase" method="post" action="?action=cashview">
<tr class="classhead">
  <td height="30" colspan="2" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_bak.gif" border="0" title=" <%=Lang_sys(3)%> " onclick="location.href='javascript:history.back()';return false;" align="absmiddle"></td>
 </tr>
<tr>
<td height="30" class="classtop" colspan="2"><%=Lang_Order(19)%></td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(54)%></td>
<td class="classrow"><input type="text" name="from_name" value="<%= user_name %>" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(9)%></td>
<td class="classrow"><input type="text" name="from_tel" value="<%= user_tel %>" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(10)%></td>
<td class="classrow"><input type="text" name="from_email" value="<%= user_mail %>" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(12)%></td>
<td class="classrow"><input type="text" name="from_zip" value="<%= user_zip %>" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(11)%></td>
<td class="classrow"><input type="text" name="from_adds" value="<%= user_adds %>" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(55)%></td>
<td class="classrow"><textarea name="from_other" cols="50" rows="2" wrap="physical" onKeyDown="from_checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)" class="text"></textarea>&nbsp;<input readonly type="text" name="from_remLen" size="3" value="200" style="width:30px;border:none;">
</td>
</tr>
<tr>
<td height="30" class="classtop" colspan="2"><%=Lang_Order(20)%> <input type="checkbox" name="copy" value="1" onclick="LebiCopy(this.form)"><%=Lang_sys(14)%></td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(54)%></td>
<td class="classrow"><input type="text" name="to_name" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(9)%></td>
<td class="classrow"><input type="text" name="to_tel" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(56)%></td>
<td class="classrow"><input type="text" name="to_tel2" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(12)%></td>
<td class="classrow"><input type="text" name="to_zip" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(11)%></td>
<td class="classrow"><input type="text" name="to_adds" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(55)%></td>
<td class="classrow"><textarea name="to_other" cols="50" rows="2" wrap="physical" onKeyDown="checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)" class="text"></textarea>&nbsp;<input readonly type="text" name="remLen" size="3" value="200" style="width:30px;border:none;">
</td>
</tr>
<tr>
<td height="30" class="classtop" colspan="2"><%=Lang_Order(57)%></td>
</tr>
<%
Set rs = conn.execute("select id,zf_fs,bank from [Lebi_bank]")
if rs.eof And rs.bof then
	   Response.Write("<tr class=""classrow""><td class=""classrow"" height=""25"" colspan=""2""><input type=""radio"" name='paymenttype' value='"& Lang_Order(58) &"' checked>"& Lang_Order(58) &"</td></tr>")
Else
	   payment_num = 1
	   do while not rs.eof
	   rem 增加支付信息换行功能 2007-11-8 by 56770.kingdge
	   payment_content = Replace(rs(2),chr(13),"<br>")
	   Response.Write("<tr class=""classrow""><td class=""classrow"" height=""25"" colspan=""2"" id=""payment_"&payment_num&"""><input type=""radio"" name='paymenttype' value='"&rs(1)&"' onclick='turnit(Content_"&payment_num&",payment_"&payment_num&");")
	   If payment_num > 1 Then Response.Write("document.getElementById(""Content_1"").style.display=""none"";")
	   Response.Write("' style='CURSOR: hand'")
	   If payment_num = 1 Then Response.Write(" checked")
	   Response.Write("><strong>"&rs(1)&"</strong></td></tr><tr class=""classrow"" id=""Content_"&payment_num&"""")
	   If payment_num > 1 Then Response.Write(" style=""display:none;""")
	   Response.Write(" ><td class=""classrow"" colspan=""2"" style=""padding:10px;"">"& payment_content &"</td></tr>")
	   rs.movenext
	   payment_num = payment_num + 1
	   loop
end if
rs.close:set rs=Nothing
If chinabank_state=1 Then Response.Write("<tr class=""classrow""><td class=""classrow"" height=""25"" colspan=""2"" id=""payment_chinabank""><input type=""radio"" name='paymenttype' value='001' onclick='turnit(Content_chinabank,payment_chinabank);document.getElementById(""Content_1"").style.display=""none"";' style='CURSOR: hand'><strong>网银在线支付</strong></td></tr><tr class=""classrow"" id=""Content_chinabank"" style=""display:none;""><td class=""classrow"" colspan=""2"" style=""padding:10px;"">"& chinabank_info &"</td></tr>")
If alipay_state=1 Then Response.Write("<tr class=""classrow""><td class=""classrow"" height=""25"" colspan=""2"" id=""payment_alipay""><input type=""radio"" name='paymenttype' value='002' onclick='turnit(Content_alipay,payment_alipay);document.getElementById(""Content_1"").style.display=""none"";' style='CURSOR: hand'><strong>支付宝支付</strong></td></tr><tr class=""classrow"" id=""Content_alipay"" style=""display:none;""><td class=""classrow"" colspan=""2"" style=""padding:10px;"">"& alipay_info &"</td></tr>")
If paypal_state=1 Then Response.Write("<tr class=""classrow""><td class=""classrow"" height=""25"" colspan=""2"" id=""payment_paypal""><input type=""radio"" name='paymenttype' value='003' onclick='turnit(Content_paypal,payment_paypal);document.getElementById(""Content_1"").style.display=""none"";' style='CURSOR: hand'><strong>PAYPAL支付</strong></td></tr><tr class=""classrow"" id=""Content_paypal"" style=""display:none;""><td class=""classrow"" colspan=""2"" style=""padding:10px;"">"& paypal_info &"</td></tr>")
If bill_state=1 Then Response.Write("<tr class=""classrow""><td class=""classrow"" height=""25"" colspan=""2"" id=""payment_bill""><input type=""radio"" name='paymenttype' value='004' onclick='turnit(Content_bill,payment_bill);document.getElementById(""Content_1"").style.display=""none"";' style='CURSOR: hand'><strong>快钱支付</strong></td></tr><tr class=""classrow"" id=""Content_bill"" style=""display:none;""><td class=""classrow"" colspan=""2"" style=""padding:10px;"">"& bill_info &"</td></tr>")
If tenpay_state=1 Then Response.Write("<tr class=""classrow""><td class=""classrow"" height=""25"" colspan=""2"" id=""payment_tenpay""><input type=""radio"" name='paymenttype' value='005' onclick='turnit(Content_tenpay,payment_tenpay);document.getElementById(""Content_1"").style.display=""none"";' style='CURSOR: hand'><strong>财付通支付-即时到帐</strong></td></tr><tr class=""classrow"" id=""Content_tenpay"" style=""display:none;""><td class=""classrow"" colspan=""2"" style=""padding:10px;"">"& tenpay_info &"</td></tr>")
If tenpay2_state=1 Then Response.Write("<tr class=""classrow""><td class=""classrow"" height=""25"" colspan=""2"" id=""payment_tenpay2""><input type=""radio"" name='paymenttype' value='006' onclick='turnit(Content_tenpay2,payment_tenpay2);document.getElementById(""Content_1"").style.display=""none"";' style='CURSOR: hand'><strong>财付通支付-担保交易</strong></td></tr><tr class=""classrow"" id=""Content_tenpay2"" style=""display:none;""><td class=""classrow"" colspan=""2"" style=""padding:10px;"">"& tenpay2_info &"</td></tr>")
rem <-{添加收汇宝支付 2008-7-8 by 56770.kingdge
If shb_state=1 Then Response.Write("<tr class=""classrow""><td class=""classrow"" height=""25"" colspan=""2"" id=""payment_shb""><input type=""radio"" name='paymenttype' value='007' onclick='turnit(Content_shb,payment_shb);document.getElementById(""Content_1"").style.display=""none"";' style='CURSOR: hand'><strong>Credit Card (Visa,Master)</strong></td></tr><tr class=""classrow"" id=""Content_shb"" style=""display:none;""><td class=""classrow"" colspan=""2"" style=""padding:10px;"">"& shb_info &"</td></tr>")
rem }->
%>
<tr>
<td height="30" class="classtop" colspan="2"><%=Lang_Order(59)%></td>
</tr>
<%
Set rs=conn.execute("SELECT id,area_name FROM [Lebi_deliver_area] where parent_id=0 ORDER BY area_order desc,id asc")
area_list_num = 1
AreaId = rs("id")
do while not rs.eof
	area_list_str = area_list_str & "<option value="""&rs("id")&""""
	If area_list_num = 1 Then area_list_str = area_list_str & " selected"
	area_list_str = area_list_str & ">"&rs("area_name")&"</option>"
	rs.movenext
	area_list_num = area_list_num + 1
Loop
rs.close: Set rs = Nothing
Dim FirstDeliver,bw_price,b_weight,o_price,deliver_name
sql="SELECT a.id,a.deliver_id,a.is_end_pay,a.basic_weight_price,a.basic_weight,a.overstep_price, b.deliver_name,b.deliver_info,b.deliver_price,a.last_price,a.free_price FROM [Lebi_deliver_list] as a,[Lebi_deliver] as b where a.area_id="&areaid&" and a.deliver_id=b.id ORDER BY a.d_order desc"
Set rs= conn.execute(SQL)
If Not rs.eof Then
i = 0
bw_price = rs("basic_weight_price")
b_weight = rs("basic_weight")
o_price = rs("overstep_price")
deliver_name = rs("deliver_name")
l_price = rs("last_price")
f_price = rs("free_price")
do while not rs.eof
	FirstDeliver = FirstDeliver &"<tr class='classrow'><td class='classrow' colspan='2'><input type='radio' value='"&rs("deliver_id")&"'  name='deliver_id' onclick='getDeliverPrice("&i&");'"
	If i = 0 Then FirstDeliver = FirstDeliver &" checked"
	FirstDeliver = FirstDeliver &"> "&rs("deliver_name")&"</td></tr>"
	FirstDeliver = FirstDeliver &"<tr class='classrow'><td class='classrow' colspan='2'>"&rs("deliver_info")&"</td></tr><INPUT TYPE=""hidden"" value="""&rs("is_end_pay")&""" name=""is_end_pay""><INPUT TYPE=""hidden"" value="""&rs("deliver_name")&""" name=""deliver_name""><INPUT TYPE=""hidden"" value="""&rs("basic_weight")&""" name=""basic_weight""><INPUT TYPE=""hidden"" value="""&rs("overstep_price")&""" name=""overstep_price""><INPUT TYPE=""hidden"" value="""&rs("last_price")&""" name=""last_price""><INPUT TYPE=""hidden"" value="""&rs("free_price")&""" name=""free_price"">"
	If CInt(Config_Lebi_Eshop(15)) = 0 Then
		FirstDeliver = FirstDeliver &"<INPUT TYPE=""hidden"" value="""&rs("deliver_price")&""" name=""basic_weight_price"">"
	Else
		FirstDeliver = FirstDeliver &"<INPUT TYPE=""hidden"" value="""&rs("basic_weight_price")&""" name=""basic_weight_price"">"
	End If
	rs.movenext
	i = i+1
Loop
End If
rs.close:set rs=Nothing
%>
		<tr class="classrow">
			<td class="classrow" colspan="2"><%=Lebi_cart(180)%>：<select size="1" name="area_id" onchange="ajaxSub(0,'Ajax_data.asp?action=getDeliverArea2&parentid='+this.value);ajaxSub1(1,'Ajax_data.asp?action=getDeliverList&areaid='+this.value+'&parentid=0');ajaxSub2(1,'Ajax_data.asp?action=getDeliverList&isdefault=1&areaid='+this.value);"><option value="0"><%=Lebi_pro(15)%></option><%=area_list_str%></select>
			<span id="deliver_area_2">
			<%
			Set rs= conn.execute("SELECT id,area_name FROM [Lebi_deliver_area] where parent_id="&AreaId&" ORDER BY area_order desc,id asc")
			If Not rs.eof Then
			        Response.write("<select size=1 name=""area2_id"" onchange=""ajaxSub1(1,'Ajax_data.asp?action=getDeliverList&areaid='+this.value+'&parentid="& AreaId &"');ajaxSub2(1,'Ajax_data.asp?action=getDeliverList&isdefault=1&areaid='+this.value+'&parentid="& AreaId &"');""><option value=""0"">"& Lebi_pro(15) &"</option>")
					do while not rs.eof
					Response.write("<option value="""&rs("id")&""">"&rs("area_name")&"</option>")
					rs.movenext
					Loop
					Response.write("</select>")
			End If
			rs.close:set rs=Nothing
			%>
			</span></td>
		</tr>
		<tr class="classrow">
			<td class="classrow" colspan="2"><span id="div_deliver_show"><table cellspacing=0 cellpadding=3 border=0 width=100% class="classtable"><%=FirstDeliver%></table></span></td>
		</tr>
		<tr class="classrow">
			<td height="30" class="classrow" colspan="2">
<%
			If (p_weight) <= b_weight Or Config_Lebi_Eshop(15) = 0 Then
					deliver_price = bw_price
			Else
					If b_weight = 0 Then
							deliver_price = bw_price
					Else
							basic_weight = (p_weight - b_weight) / b_weight
							If InStr(basic_weight,".") > 0 Then basic_weight = Split(basic_weight,".")(0) + 1
							deliver_price = bw_price + (basic_weight * o_price)
					End If
					If l_price > 0 And CLng(deliver_price) >= CLng(l_price) Then deliver_price = l_price
			End If
			If f_price > 0 And CLng(Sum3) >= CLng(f_price) Then deliver_price = 0
%>
			<INPUT TYPE="hidden" NAME="p_weight" value="<%=p_weight%>"><INPUT TYPE="hidden" NAME="sendtype" value="<%=deliver_name%>"><INPUT TYPE="hidden" NAME="stype" value="<%=Config_Lebi_Eshop(15)%>"><input type="hidden" name="deliver_price" value="<%=deliver_price%>"><span id="weightmoney">
			<script language="javascript" type="text/javascript">
			document.write("<%=Lebi_cart(26)%>：<font color=red><%=formatnumber2(p_weight)%></font> Kg&nbsp;&nbsp;<%=Lebi_cart(59)%>：<font color=red><%= dw & formatnumber2(deliver_price/moneyhl)%></font>");
			</script></span></td>
		</tr>
<tr>
<td height="30" class="classtop" colspan="2"><%=Lang_Order(60)%></td>
</tr>
<%
Response.Write("<tr class=""classrow""><td class=""classrow"" height=""30"" colspan=""2""><input type=radio checked value=""0"" name=packing_id onclick=""setPackingPrice('0');""><INPUT TYPE=""hidden"" NAME=""packing_price""> "& Lang_Order(61) &"</td></tr>")
Set p_rs= conn.execute("select * from [Lebi_packing] where packing_type<>0 order by id desc")
do while not p_rs.eof
		Response.Write("<tr class=""classrow""><td class=""classrow"" height=""30"" colspan=""2""><input type=radio value="""&p_rs("id")&"""  name=packing_id onclick=""setPackingPrice('"&p_rs("packing_price")&"');""> <img src='images/img.gif' align='absmiddle' onMouseover=""javascript:ddrivetip('<img src=../"&trim(p_rs("pic"))&" height=100>', '#ffffff', '100')"" onMouseout=""hideddrivetip()"">&nbsp;"&p_rs("packing_name")&"&nbsp;&nbsp;"&Lebi_cart(162)&"：" &_
		"<FONT COLOR=red>"& dw &""& formatnumber2(p_rs("packing_price")) &"</FONT></td></tr>" &_
		"<tr class=""classrow""><td class=""classrow"" colspan=2>"&p_rs("packing_info")&"</td></tr>")
		p_rs.movenext
		i = i+1
Loop
p_rs.close : Set p_rs = Nothing
%>
<%if Config_Lebi_Eshop(2) = 1 then%>
<tr>
<td height="30" class="classtop" colspan="2"><%=Lang_Order(62)%></td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(63)%></td>
<td class="classrow"><input type="radio" name="iffapiao" value="0" onClick="javascript:no_fapiao()" checked><%=Lang_Order(66)%>&nbsp;<input type="radio" name="iffapiao" value="1" onClick="javascript:yes_fapiao()"><%=Lang_Order(67)%></td>
</tr>
<tr class="classrow" id="fapiao_company" style="display:none;">
<td width="15%" height="30" class="classrow"><%=Lang_Order(64)%></td>
<td class="classrow"><input type="text" name="fapiao_company" size="35" class="form" value="<%=fapiao_company%>"></td>
</tr>
<tr class="classrow" id="fapiao_adds" style="display:none;">
<td width="15%" height="30" class="classrow"><%=Lang_Order(65)%></td>
<td class="classrow"><input type="text" name="fapiao_adds" size="35" class="form" value="<%=fapiao_adds%>"></td>
</tr>
<tr class="classrow" id="fapiao_zip" style="display:none;">
<td width="15%" height="30" class="classrow"><%=Lang_Order(12)%></td>
<td class="classrow"><input type="text" name="fapiao_zip" size="10" class="form" value="<%=fapiao_zip%>"></td>
</tr>
<%else%>
<input type="hidden" name="iffapiao" value="0">
<%end if%>
<tr class="classfooter">
  <td height="30" colspan="2" align="left" class="classfooter"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_bak.gif" title=" <%=Lang_sys(3)%> " onclick="location.href='javascript:history.back()';return false;" align="absmiddle"><input TYPE="hidden" name="jifen" value="<%=jifen%>"></td>
 </tr>
</table>
<script>
tdshow("cashview");
function getDeliverList() {
  if (xmlHttp1.readyState < 4) {
	document.getElementById('div_deliver_show').innerHTML="<span>loading...</span>";
  }
  if (xmlHttp1.readyState == 4) {
	var response = xmlHttp1.responseText;
	if (response == "")
	{
		var pweight = document.getElementsByName('p_weight')[0].value/1;
		document.getElementById('div_deliver_show').innerHTML="";
		document.getElementById('weightmoney').innerHTML = "<%=Lebi_cart(26)%>：<font color=red>"+(pweight).toFixed(2)+"</font> Kg&nbsp;&nbsp;<%=Lebi_cart(59)%>：<font color=red><%= dw%>0.00</font> ";
		document.getElementsByName('deliver_price')[0].value = 0;
		document.getElementsByName('sendtype')[0].value = '-';
	}else
	{
		document.getElementById('div_deliver_show').innerHTML="<table cellspacing=0 cellpadding=3 border=0 width=100% class=\"classtable\">"+ response +"</table>";
//		document.getElementById('weightmoney').innerHTML = "<font color=\"red\"><%=Lang_Order(68)%></font>";
		document.getElementById('weightmoney').innerHTML = "";
		document.getElementsByName('deliver_price')[0].value = '';
		document.getElementsByName('sendtype')[0].value = '';
	}
  }
}
function ajaxSub2(t,url)
{
	 webRequest(url+'&t000='+Math.random(), "", "GET", true, function() {
		var xmlhttp = arguments[0];
		var args = new Array();
		if (xmlhttp.readyState == 4) {
			var returntxt = xmlhttp.responseText;
			var deliverPrice = 0
			var pweight = document.getElementsByName('p_weight')[0].value/1;
			var bw_price = returntxt.split("|")[6]/1;
			var b_weight = returntxt.split("|")[2]/1;
			var o_price = returntxt.split("|")[3]/1;
			var d_name = returntxt.split("|")[0];
			var l_price = returntxt.split("|")[4]/1;
			var f_price = returntxt.split("|")[5]/1;
			var s_type = document.getElementsByName('s_type').value/1;
			if ((pweight <= b_weight) || (s_type==0))
			{
				deliverPrice = bw_price;
			}else
			{
				if (b_weight==0)
				{
					deliverPrice = bw_price/1;
				}else{
					deliverPrice = bw_price/1 + (Math.ceil((pweight-b_weight)/b_weight)) * o_price;
				}
				if (l_price >0 && deliverPrice >= l_price){deliverPrice = l_price}
			}
			if (f_price >0 && <%=sum3%> >= f_price){deliverPrice = 0}
			document.getElementById('weightmoney').innerHTML = "<%=Lang_Order(175)%>：<font color=red>"+(pweight).toFixed(2)+"</font> Kg&nbsp;&nbsp;<%=Lang_Order(176)%>：<font color=red><%= dw%>"+(deliverPrice).toFixed(2)+"</font>";
			document.getElementsByName('sendtype')[0].value = d_name;
			document.getElementsByName('deliver_price')[0].value = deliverPrice;
		}
	 }, "");
}
function getDeliverPrice(i)
{
	var deliverPrice = 0
	var pweight = document.getElementsByName('p_weight')[0].value/1;
	var bw_price = document.getElementsByName('basic_weight_price')[i].value/1;
	var b_weight = document.getElementsByName('basic_weight')[i].value/1;
	var o_price = document.getElementsByName('overstep_price')[i].value/1;
	var d_name = document.getElementsByName('deliver_name')[i].value;
	var l_price = document.getElementsByName('last_price')[i].value/1;
	var f_price = document.getElementsByName('free_price')[i].value/1;
	var s_type = document.getElementsByName('s_type').value/1;
	if ((pweight <= b_weight) || (s_type==0))
	{
		deliverPrice = bw_price;
	}else
	{
		if (b_weight==0)
		{
			deliverPrice = bw_price/1;
		}else{
			deliverPrice = bw_price/1 + (Math.ceil((pweight-b_weight)/b_weight)) * o_price;
		}
		if (l_price >0 && deliverPrice >= l_price){deliverPrice = l_price}
	}
	if (f_price >0 && <%=sum3%> >= f_price){deliverPrice = 0}
	document.getElementById('weightmoney').innerHTML = "<%=Lang_Order(175)%>：<font color=red>"+(pweight).toFixed(2)+"</font> Kg&nbsp;&nbsp;<%=Lang_Order(176)%>：<font color=red><%= dw%>"+(deliverPrice).toFixed(2)+"</font>";
	document.getElementsByName('sendtype')[0].value = d_name;
	document.getElementsByName('deliver_price')[0].value = deliverPrice;
}

function setPackingPrice(p)
{
	document.getElementsByName('packing_price')[0].value = p;
	//alert(document.getElementsByName('packing_price')[0].value);
}
function yes_fapiao()
{
	document.getElementById('fapiao_company').style.display="";
	document.getElementById('fapiao_adds').style.display="";
	document.getElementById('fapiao_zip').style.display="";
}
function no_fapiao()
{
	document.getElementById('fapiao_company').style.display="none";
	document.getElementById('fapiao_adds').style.display="none";
	document.getElementById('fapiao_zip').style.display="none";
}
</script>
<%
End Sub

Sub cashview()
        from_name=Safereplace(trim(request("from_name")))
        from_adds=Safereplace(trim(request("from_adds")))
        from_email=Safereplace(trim(request("from_email")))
        from_tel=Safereplace(trim(request("from_tel")))
	    from_zip=Safereplace(trim(request("from_zip")))
		from_other=Safereplace(trim(request("from_other")))
        to_name=Safereplace(trim(request("to_name")))
        to_adds=Safereplace(trim(request("to_adds")))
        to_tel=Safereplace(trim(request("to_tel")))
        to_tel2=Safereplace(trim(request("to_tel2")))
	    to_zip=Safereplace(trim(request("to_zip")))
		to_other=Safereplace(trim(request("to_other")))
'        sendtype1=Safereplace(trim(request("sendtype1")))
'		fukuan_id=Safereplace(trim(request("fukuan_id")))
        paymenttype_id=Safereplace(trim(request("paymenttype")))
		Select Case paymenttype_id
		       Case "001"
			   paymenttype=Lang_Buy(4)
			   Case "002"
			   paymenttype=Lang_Buy(5)
			   Case "003"
			   paymenttype=Lang_Buy(6)
			   Case "004"
			   paymenttype=Lang_Buy(7)
			   Case "005"
			   paymenttype=Lang_Buy(8)
			   Case "006"
			   paymenttype=Lang_Buy(9)
			   Case "007"
			   paymenttype=Lang_Buy(10)
			   Case Else
			        paymenttype=Safereplace(trim(request("paymenttype")))
		End Select
        sendtype=safereplace(trim(request("sendtype")))
		fei=CheckNum(request("deliver_price"),0)
		rem 当没有选择配送方式时 配送费用默认56770同时给予错误提示
		'If Not IsNumeric(fei) Or IsEmpty(fei) Then fei = 56770
		rem	}->
        packing_price=CheckNum(request("packing_price"),0)
		packing_id=CheckNum(request("packing_id"),0)
        fapiao_company=Safereplace(trim(request("fapiao_company")))
        fapiao_adds=Safereplace(trim(request("fapiao_adds")))
        fapiao_zip=Safereplace(trim(request("fapiao_zip")))
        iffapiao=CheckNum(request("iffapiao"),0)
        set rs = conn.execute("select l.bianhao,l.product_name,l.sprice,l.price,l.basket_count,l.color,l.chima,l.p_weight,l.cpid,l.IsGift,l.advance_money,l.is_booking,l.advance_money,l.p_jifen,p.categoryid from [Lebi_lsbuy] as l,[lebi_product] as p where l.cpid = p.id and (l.sessionid="& CookiesId &" or (l.User_Id = '"& user_id &"' and l.User_Id <> ''))")
        Sum1 = 0
        Sum2 = 0
	    If rs.eof And rs.bof Then
                Response.redirect "admin_order_cart.asp"
	    Else
                Do While Not rs.EOF
						If rs("IsGift") = 0 Then
								Sum1 = Sum1 + (rs("sprice") * rs("basket_count"))
								Sum2 = Sum2 + (rs("price") * rs("basket_count"))
								Sum3 = Sum3 + (rs("price") * rs("basket_count"))
						Else
								Sum1 = Sum1 + 0
								Sum2 = Sum2 + 0
								Sum3 = Sum3 + 0
						End If
						Sum1=FormatNumber2(Sum1)
						Sum2=FormatNumber2(Sum2)
						js=FormatNumber2((Sum1-Sum2)/moneyhl)
						If left(js,2)="0-" Then
								js=Replace(FormatNumber2((Sum1-Sum2)/moneyhl),"0-","-")
						Else
								js=js
						End If
						rem 修正商品重量计算 2007-11-17 by 56770.kingdge
						If Config_Lebi_Eshop(2) = 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 Then
								advance_money = advance_money + (rs("advance_money")/moneyhl) * rs("Basket_count")
								is_booking = 1
						Else
								advance_money = advance_money + (rs("price")/moneyhl) * rs("Basket_count")
						End If
						rem	}->
						c_rate = GetCategoryRate(rs("categoryid"))
						jifen1 = jifen1 + rs("p_jifen") * rs("basket_count")
						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,"|")(order_user_grade-1)) Then
								jifen2 = jifen2 + (rs("price") * Split(c_rate,"|")(order_user_grade-1))
						Else
								jifen2 = jifen2 + (rs("price") * cache_buy_jifen(order_user_grade))
						End If
	            rs.movenext
		        Loop
	    End If
	    rs.close()
		rem 计算购物折扣
		Dim dis_grade : dis_grade = order_user_grade
		If IsSqlDataBase = 1 Then
	    Set rs=conn.execute("select top 1 z_price,z_discount from [Lebi_discount] where z_price<="&sum3&" and charindex('"&dis_grade&"',z_flag)>0 order by z_id desc")
        Else
		Set rs=conn.execute("select top 1 z_price,z_discount from [Lebi_discount] where z_price<="&sum3&" and instr(z_flag,"&dis_grade&")>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(rs("z_discount"))
				jifen = jifen * rs("z_discount")
        End if
        rs.close:Set rs=Nothing
        z_str1=dw&""&formatnumber2(z_price/moneyhl/moneyhl)
        z_str2=strdiscount
        z_str3=dw&""&formatnumber2(sum2*z_discount/moneyhl)
        dis_sum=formatnumber2(sum3*z_discount/moneyhl)
		jifen = Clng(jifen1 + (jifen2 * z_discount))
		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)
						coupon_discount = Scoupon(2)
						Scoupon.close : Set Scoupon = Nothing
						If coupon_type = 0 Then coupon_price = coupon_price
						If coupon_type = 1 Then coupon_price = Replace(formatnumber2((sum3*z_discount) * (100-coupon_discount)/100),",","")
				Else
						basketlastprice = formatnumber2(sum2*z_discount/moneyhl)
				End If
		Else
		        basketlastprice = formatnumber2(sum2*z_discount/moneyhl)
		End If
		rs.close : Set rs = Nothing
        If Iffapiao=1 Then
		        If Config_Lebi_Eshop(2)="1" Then
				fapiao_money=(Sum2*z_discount*Config_Lebi_Eshop(14)/100)
				Else
				fapiao_money=0
				End If
		Else
		        fapiao_money=0
		End If
		pro_money=basketlastprice
		fei_money=fei/moneyhl
		sum_money=CDbl(pro_money)+CDbl(fei_money)+CDbl(fapiao_money)+CDbl(packing_price)
%>
<script language="javascript" type="text/javascript" src="inc/js/order_quick.js"></script>
<script>function killerrors() {return true;}window.onerror = killerrors;dd</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable-top">
<tbody>
<tr>
<td height="30" align="left" class="classhead">
<%=Lang_Order(37) & order_user_id &"/"& order_user_name%>&nbsp;&nbsp;<%=Lang_Order(38) & order_user_grade_name%>
</td>
<td align="right" class="classhead">
<%=Lang_Order(39)%> <a href="admin_order_cart.asp"><span id="carttotalnum" class="totalnum">0</span> <%=Lang_Order(40)%></a>&nbsp;&nbsp;<%=Lang_Order(41)%> ￥<span id="carttotalprice" class="totalprice">0.00</span>
<script language="javascript" type="text/javascript" src="Ajax_Cart.asp?showtype=1"></script>
</td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="cashcheck" class="classtable2">
<form name="checkcase" method="post" action="?action=cashsave">
<tr class="classhead">
  <td height="30" colspan="2" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_bak.gif" border="0" title=" <%=Lang_sys(3)%> " onclick="location.href='javascript:history.back()';return false;" align="absmiddle"></td>
 </tr>
<tr>
<td height="30" class="classtop" colspan="2"><%=Lang_Order(69)%></td>
</tr>
<tr class="classrow">
 <td colspan="2" class="classrow">
<%if is_booking >0 then%>
		<font color="#ff3333"><%=Lebi_cart(166)%>：<%=dw%> <%=FormatNumber2(advance_money*z_discount)%>&nbsp;&nbsp;&nbsp;&nbsp;<%=Lebi_cart(170)%>：<%=dw%> <%=FormatNumber2(dis_sum+fei+packing_price+fapiao_money-(advance_money*z_discount))%></font>
<%end if%>
<font color="#FF3333"><%=Lebi_cart(77)%>：<%=dw%><%=FormatNumber2(pro_money)%>&nbsp;&nbsp;<%=Lang_Order(70)%><%=strdiscount%>&nbsp;&nbsp;<%=Lebi_cart(78)%>：<%=dw%><%=FormatNumber2(fei_money)%>&nbsp;&nbsp;<%=Lebi_cart(164)%>：<font color="#ff3333"><%=dw%><%=FormatNumber2(packing_price)%></font>&nbsp;&nbsp;
<%if iffapiao = 1 then%>
		<%=Lebi_cart(79)%>：<%=dw%><%=FormatNumber2(fapiao_money)%>&nbsp;&nbsp;
<%end if%>
<%if Config_Lebi_Eshop(2)=1 then%><%=Lebi_cart(26)%>：<%=sum_weight%>g<%end if%>
</font>
</td>
</tr>
<tr class="classrow">
 <td colspan="2" class="classrow">
<font color="#ff3333"><%=Lang_Order(71)%></font>
</td>
</tr>
<tr>
<td height="30" class="classtop" colspan="2"><%=Lang_Order(19)%></td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(54)%></td>
<td class="classrow"><input type="text" name="from_name" value="<%= from_name %>" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(9)%></td>
<td class="classrow"><input type="text" name="from_tel" value="<%= from_tel %>" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(10)%></td>
<td class="classrow"><input type="text" name="from_email" value="<%= from_email %>" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(12)%></td>
<td class="classrow"><input type="text" name="from_zip" value="<%= from_zip %>" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(11)%></td>
<td class="classrow"><input type="text" name="from_adds" value="<%= from_adds %>" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(55)%></td>
<td class="classrow"><textarea name="from_other" cols="50" rows="2" wrap="physical" onKeyDown="from_checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)" class="text"><%= from_other %></textarea>&nbsp;<input readonly type="text" name="from_remLen" size="3" value="200" class="form" style="width:30px;">
</td>
</tr>
<tr>
<td height="30" class="classtop" colspan="2"><%=Lang_Order(20)%> <input type="checkbox" name="copy" value="1" onclick="LebiCopy(this.form)"><%=Lang_sys(14)%></td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(54)%></td>
<td class="classrow"><input type="text" name="to_name" value="<%= to_name %>" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(9)%></td>
<td class="classrow"><input type="text" name="to_tel" value="<%= to_tel %>" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(56)%></td>
<td class="classrow"><input type="text" name="to_tel2" value="<%= to_tel2 %>" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(12)%></td>
<td class="classrow"><input type="text" name="to_zip" value="<%= to_zip %>" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(11)%></td>
<td class="classrow"><input type="text" name="to_adds" value="<%= to_adds %>" class="form" size="30" class="form">
</td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(55)%></td>
<td class="classrow"><textarea name="to_other" cols="50" rows="2" wrap="physical" onKeyDown="checkMaxInput(this.form)" onKeyUp="checkMaxInput(this.form)" class="text"><%= to_other %></textarea>&nbsp;<input readonly type="text" name="remLen" size="3" value="200" class="form" style="width:30px;">
</td>
</tr>
<tr>
<td height="30" class="classtop" colspan="2"><%=Lang_Order(57)%></td>
</tr>
<tr class="classrow">
<td colspan="2" height="30" class="classrow"><%= paymenttype %>
</td>
</tr>
<tr>
<td height="30" class="classtop" colspan="2"><%=Lang_Order(59)%></td>
</tr>
<tr class="classrow">
<td colspan="2" height="30" class="classrow"><%= sendtype %>
</td>
</tr>
<%if iffapiao = 1 then%>
<tr>
<td height="30" class="classtop" colspan="2"><%=Lang_Order(62)%></td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(64)%></td>
<td class="classrow"><input type="text" name="fapiao_company" size="35" class="form" value="<%=fapiao_company%>"></td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(65)%></td>
<td class="classrow"><input type="text" name="fapiao_adds" size="35" class="form" value="<%=fapiao_adds%>"></td>
</tr>
<tr class="classrow">
<td width="15%" height="30" class="classrow"><%=Lang_Order(12)%></td>
<td class="classrow"><input type="text" name="fapiao_zip" size="10" class="form" value="<%=fapiao_zip%>"></td>
</tr>
<%end if%>
<tr class="classfooter">
  <td height="30" colspan="2" align="left" class="classfooter"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_bak.gif" title=" <%=Lang_sys(3)%> " onclick="location.href='javascript:history.back()';return false;" align="absmiddle">
   <INPUT TYPE="hidden" name="sendtype" value="<%=sendtype%>">
   <INPUT TYPE="hidden" name="paymenttype" value="<%=paymenttype%>">
   <INPUT TYPE="hidden" name="totalcash" value="<%=Sum3%>">
   <INPUT TYPE="hidden" name="jifen" value="<%=jifen%>">
   <INPUT TYPE="hidden" name="fei" value="<%=fei%>">
   <input type="hidden" name="z_discount" value="<%=z_discount%>">
   <input type="hidden" name="dis_sum" value="<%=dis_sum%>">
   <INPUT TYPE="hidden" name="fapiao_money" value="<%=fapiao_money%>">
   <INPUT TYPE="hidden" name="paymenttype_id" value="<%=paymenttype_id%>">
   <INPUT TYPE="hidden" name="sum_weight" value="<%=sum_weight%>">
   <INPUT TYPE="hidden" name="packing_price" value="<%=FormatNumber2(packing_price)%>">
   <INPUT TYPE="hidden" name="packing_id" value="<%=packing_id%>">
   <INPUT TYPE="hidden" name="is_booking" value="<%=is_booking%>">
   <INPUT TYPE="hidden" name="advance_money" value="<%=FormatNumber2(advance_money*z_discount)%>">
   <INPUT TYPE="hidden" name="low_money" value="<%=FormatNumber2(advance_money*z_discount)%>">
   <INPUT TYPE="hidden" name="odd_money" value="<%=FormatNumber2(CDbl(dis_sum)+CDbl(fei)+CDbl(packing_price)+CDbl(fapiao_money)-CDbl((advance_money*z_discount)))%>">
   <INPUT TYPE="hidden" name="iffapiao" value="<%=iffapiao%>">
  </td>
 </tr>
</table>
<script>tdshow("cashcheck");</script>
<%
End Sub

Sub cashsave()
        from_name=Safereplace(trim(request("from_name")))
        from_adds=Safereplace(trim(request("from_adds")))
        from_email=Safereplace(trim(request("from_email")))
        from_tel=Safereplace(trim(request("from_tel")))
	    from_zip=Safereplace(trim(request("from_zip")))
		from_other=Safereplace(trim(request("from_other")))
        to_name=Safereplace(trim(request("to_name")))
        to_adds=Safereplace(trim(request("to_adds")))
        to_tel=Safereplace(trim(request("to_tel")))
        to_tel2=Safereplace(trim(request("to_tel2")))
	    to_zip=Safereplace(trim(request("to_zip")))
		to_other=Safereplace(trim(request("to_other")))
        sendtype=safereplace(request("sendtype"))
        paymenttype=safereplace(request("paymenttype"))
		paymenttype_id = CheckNum(request("paymenttype_id"),0)
        fei=CheckNum(Replace(request("fei"),",",""),0)
        totalcash=CheckNum(Replace(request("totalcash"),",",""),0)
        jifen=CheckNum(Replace(request("jifen"),",",""),0)
        userid=safereplace(request("userid"))
        z_discount=safereplace(request("z_discount"))
        dis_sum=safereplace(request("dis_sum"))
        fapiao_company=safereplace(request("fapiao_company"))
        fapiao_adds=safereplace(request("fapiao_adds"))
        fapiao_zip=safereplace(request("fapiao_zip"))
		fapiao_money=safereplace(request("fapiao_money"))
        iffapiao=safereplace(request("iffapiao"))
        order_number = SaveOrderNo
        user_id = order_user_id
		rem	<-{ 包装 by 56770.WangLei
		packing_price=CheckNum(request("packing_price"),0)
		packing_id=CheckNum(request("packing_id"),0)
		rem	}->
		rem	<-{ 预订 by 56770.WangLei
		is_booking=CheckNum(request("is_booking"),0)
		advance_money=CheckNum(request("advance_money"),0)
		low_money=CheckNum(request("low_money"),0)
		odd_money=CheckNum(request("odd_money"),0)
		rem	}->
	    dis_grade = order_user_grade
		Set rss = conn.execute("select coupon_num from [Lebi_lshy] where sessionid="& CLng(CookiesId) &"")
		If Not rss.eof Then
		If Trim(rss(0)) <> "" Then
				coupon_num = rss(0)
				Set Scoupon = server.CreateObject("adodb.recordset")
				Scoupon.open "select c_type,c_price,c_discount,user_id,c_state,c_ondate from [Lebi_coupon] where c_num = '"& coupon_num &"'",conn,1,3
				coupon_type = Scoupon(0)
				coupon_price = Scoupon(1)
				coupon_discount = Scoupon(2)
				If order_user_id <> "" Then
						Scoupon("user_id") = order_user_id
				End If
				Scoupon("c_state") = 1
				Scoupon("c_ondate") = Now()
				Scoupon.update
				Scoupon.close : Set Scoupon = Nothing
				If coupon_type = 0 Then coupon_price = coupon_price
				If coupon_type = 1 Then coupon_price = Replace(formatnumber2(dis_sum * (100-coupon_discount)/100),",","")
		Else
				z_str4=(totalcash*z_discount)/moneyhl
		End If
		Else
				z_str4=(totalcash*z_discount)/moneyhl
		End If
		rss.close : Set rss = Nothing
        If jmail_cashon=1 And jmail_type<>0 Then
		        Dim useremail,topic,mailbody,sendmsg,linkurl
		        Dim topic_admin,mailbody_admin
                Dim LoadMailInfo
		        rem 增加自定义邮件内容 2008-1-21 by 56770.kingdge
		        LoadMailInfo = splits(LoadStyle("../include/Lebi_data/E-mail.data"))
		        rem 获取真实URL地址 2005-12-25 by 56770.kingdge
		        linkurl="http://"& Request.ServerVariables("SERVER_NAME") & Eshop_url &"Search/Order.asp?order_number=[order_number]"
		        useremail=from_email
		        topic=Split(LoadMailInfo,"@@@")(2)
				ReplaceStyle "user_id",user_id,topic
		        topic_admin=Lebi_cart(85)
		        mailbody = Split(LoadMailInfo,"@@@")(3)
				ReplaceStyle "user_id",from_name,mailbody
		        ReplaceStyle "order_number",order_number,mailbody
		        ReplaceStyle "order_time",Now(),mailbody
				ReplaceStyle "order_price",dw & formatnumber2(dis_sum),mailbody
				ReplaceStyle "order_fei",dw & formatnumber2(fei),mailbody
				ReplaceStyle "order_total",dw & formatnumber2(CDbl(Replace(dis_sum,",",""))+CDbl(fei)+CDbl(packing_price)+CDbl(fapiao_money)-CDbl(coupon_price)),mailbody
				ReplaceStyle "order_url",linkurl,mailbody
				ReplaceStyle "from_name",from_name,mailbody
				ReplaceStyle "from_tel",from_tel,mailbody
				ReplaceStyle "from_email",from_email,mailbody
				ReplaceStyle "from_adds",from_adds,mailbody
				ReplaceStyle "from_zip",from_zip,mailbody
				ReplaceStyle "from_mes",from_other,mailbody
				ReplaceStyle "to_name",to_name,mailbody
				ReplaceStyle "to_tel",to_tel,mailbody
				ReplaceStyle "to_adds",to_adds,mailbody
				ReplaceStyle "to_zip",to_zip,mailbody
				ReplaceStyle "to_mes",to_other,mailbody
				rem	<-{  b 56770.WangLei
				ReplaceStyle "packing_price",packing_price,mailbody
				ReplaceStyle "packing_id",packing_id,mailbody
				ReplaceStyle "is_booking",is_booking,mailbody
				ReplaceStyle "advance_money",advance_money,mailbody
				ReplaceStyle "low_money",FormatNumber2(low_money),mailbody
				ReplaceStyle "odd_money",FormatNumber2(odd_money),mailbody
				ReplaceStyle "fapiao_money",FormatNumber2(fapiao_money),mailbody
				rem	}->
		        mailbody_admin = ""&Replace(Lebi_cart(92),"[user_id]",from_name)&"，<br><br> "&Lebi_cart(86)&"："&order_number&"<br> "&Lebi_cart(87)&"："&Now()&"<br> "&Lebi_cart(77)&"："&dw&""&dis_sum&"<br> "&Lebi_cart(78)&"："&dw&""&formatnumber2(fei)&"<br> "&Lebi_cart(80)&"："&dw&""&formatnumber2(z_str4+fei)&"<br><br>"&Lebi_cart(141)&"：<br> "&Lebi_cart(142)&"："&Trim(from_name)&"<br>"&Lebi_cart(43)&"："&Trim(from_tel)& "<br>"&Lebi_cart(44)&"："&Trim(from_email)& "<br> "&Lebi_cart(144)&"："&Trim(from_adds)&"<br>"&Lebi_cart(45)&"："&Trim(from_zip)&"<br>Url：<a href="&Replace(linkurl,"[order_number]",order_number)&" target=_blank>"&Replace(linkurl,"[order_number]",order_number)&"</a>"
		        Dim Email_Lebi
		        Set Email_Lebi = New Dv_SendMail
		        Email_Lebi.SendObject = jmail_type
		        Email_Lebi.ServerLoginName = jmail_sendmail
		        Email_Lebi.ServerLoginPass = jmail_sendpass
		        Email_Lebi.SendSMTP = jmail_smtp
		        Email_Lebi.SendFromEmail = jmail_frommail
		        Email_Lebi.SendFromName = jmail_sendname
		        If Email_Lebi.ErrCode = 0 Then
			            Email_Lebi.SendMail useremail,topic,mailbody	'执行发送邮件
			            Email_Lebi.SendMail jmail_frommail,topic_admin,mailbody_admin
			            If jmail_sendmail<>"" And jmail_sendpass<>"" And jmail_smtp<>"" Then
				                sendmsg = Lebi_cart(93)
			            Else
			                    sendmsg = Lebi_cart(94)
                        End If
                Else
                        sendmsg= Lebi_cart(94)
                End If
		        Set Email_Lebi = Nothing
        End If
        set rs = conn.execute("select * from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> ''))")
        If rs.eof Then
		        Write_Lebi_Eshop("<SCRIPT language=JavaScript>alert('["&Lebi_cart(39)&"]\n\n"&Lebi_cart(98)&"');javascript:history.go(-1)</SCRIPT>")
				response.End
        Else
                If order_user_id <>"" and iffapiao="1" then
                        if fapiao_company<>"" then
                                conn.execute "update [Lebi_user] set fapiao_company='"&fapiao_company&"' where user_id='"& order_user_id &"'"
                        end if
                        if fapiao_adds<>"" then
                                conn.execute "update [Lebi_user] set fapiao_adds='"&fapiao_adds&"' where user_id='"& order_user_id &"'"
                        end if
                        if fapiao_zip<>"" then
                                conn.execute "update [Lebi_user] set fapiao_zip='"&fapiao_zip&"' where user_id='"& order_user_id &"'"
                        end if
                End     If
                Set rs=Server.CreateObject("ADODB.Recordset")
                sql="select * from [Lebi_orders]"
                rs.open sql, conn, 1, 3
                rs.addnew
                        rs("order_number")=order_number
                        rs("order_time")=now()
                        rs("user_id")=user_id
                        rs("to_name")=to_name
                        rs("to_tel")=to_tel
						rs("to_tel2")=to_tel2
						rs("to_zip")=to_zip
						rs("to_adds")=to_adds
						rs("to_other")=to_other
                        rs("sendtype")=sendtype
                        rs("from_name")=from_name
                        rs("from_tel")=from_tel
						rs("from_email")=from_email
						rs("from_zip")=from_zip
						rs("from_adds")=from_adds
						rs("from_other")=from_other
                        rs("paymenttype")=paymenttype
                        rs("fei")=fei
                        rs("totalcash")=totalcash
                        rs("jifen")=jifen
                        rs("orderzt")=0
                        rs("discount")=z_discount
                        rs("dis_sum")=dis_sum
			            rs("zt")=0
						rs("coupon_num") = coupon_num
						rs("coupon_price") = coupon_price
						rem	<-{ 包装 2008-3-19 by 56770.WangLei
						rs("packing_price")=packing_price
						rs("packing_id")=packing_id
						rem	}->
						rem	<-{ 预订 2008-3-19 by 56770.WangLei
						rs("is_booking")=is_booking
						rs("advance_money")=advance_money
						rem	}->
                        '增加发票信息
                        if iffapiao=1 then
                                rs("fapiao_company")=fapiao_company
                                rs("fapiao_adds")=fapiao_adds
                                rs("fapiao_zip")=fapiao_zip
                                rs("iffapiao")=1
								rs("fapiao_money") = FormatNumber2(fapiao_money)
                        else
                                rs("iffapiao")=0
								rs("fapiao_money") = 0
                        end If
						rs("LangName") = LangName
						rs("LangTxt") = LangTxt
                        rs("lastmoney") = CDbl(dis_sum)+CDbl(fei)+CDbl(packing_price)+CDbl(fapiao_money)-CDbl(coupon_price)
                rs.update
                rs.close:Set rs=Nothing
                '取得订单ID
                sql="select id from [Lebi_orders] where order_number='"&order_number&"'"
                set Rs = conn.execute(sql)
		        If rs.eof Then
			            order_id="56770"
                Else
                        order_id=rs("id")
                End If
                rs.close:set rs=nothing
                '取得订单信息
                set rs = conn.execute("select * from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> '')) and Isgift = 0")
                If Not rs.eof Then
                        '循环保存订单信息
                        Do While Not rs.eof
                        '更新购买数（这里更新不是很准确啦，不过是给顾客看的：））
						If Config_Lebi_Eshop(23) = 0 Then '下单后扣除库存 by 56770.kingdge 2012-05-14
							If rs("product_type") = "unite" Then 'WangLei 2008-1-14
								conn.execute("update [Lebi_product_unite] set buys=buys+"&rs("basket_count")&",kucun=kucun-"&rs("basket_count")&",html=0 where id=" &rs("cpid")&"")
							Else
								conn.execute("update [Lebi_product] set buys = buys + "& rs("basket_count")&",kucun = kucun - "& rs("basket_count") &",html = 0 where id = " & rs("cpid") &"")
								conn.execute("update [Lebi_Product_Stock] set p_buys = p_buys + "& rs("basket_count") &",p_stock = p_stock - "& rs("basket_count") &" where p_id = " & rs("cpid") &" and s_value"& LangTxt &" = '"& rs("spvalue") &"'")
							End If
						End If 
                        '更新会员消费总额
                        'if  safereplace(request.cookies(cookiesname&"_basket")("user_id")) <>"" then
                        '         conn.execute "update [Lebi_user] set sumpay=sumpay+"&summoney&" where user_id='"& safereplace(request.cookies(cookiesname&"_basket")("user_id")) &"'"
                        'end If
		                Dim rsb,sqlb
                        Set rsb=Server.CreateObject("ADODB.Recordset")
                        sqlb="select * from [Lebi_basket]"
                        rsb.open sqlb, conn, 1, 3
		                rsb.addnew
		                rsb("order_number")=order_id
			            rsb("id")=rs("cpid")
		                rsb("product_name")=rs("product_name")
			            rsb("bianhao")=rs("bianhao")
			            rsb("basket_count")=rs("basket_count")
			            rsb("basket_date")=Now()
			            rsb("price")=rs("price")
			            rsb("user_id")=user_id
                        rsb("spname")=rs("spname")
                        rsb("spvalue")=rs("spvalue")
				        rsb("father")=rs("father")
						rsb("IsGift")=rs("IsGift")
						rsb("product_type") = rs("product_type")
						rsb("is_booking") = rs("is_booking")
						rsb("advance_money") = rs("advance_money")
	                    rsb.update
	                    rsb.close:Set rsb=nothing
                        rs.movenext
                        loop
                 End If
                 rs.close:Set rs=Nothing
                '取得积分换购礼品信息  2007-10-15 by 56770.kingdge
				 Dim TotalGIftScore,rsGift,Getuserinfo
                 TotalGIftScore = conn.execute("select sum(price*basket_count) from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> '')) and Isgift = 1")(0)
				 If IsNull(TotalGIftScore) Or IsEmpty(TotalGIftScore) Then TotalGIftScore = 0
                 Set Getuserinfo = Server.CreateObject("ADODB.Recordset")
                 Getuserinfo.open "select jifen from [Lebi_user] where user_id = '"& user_id &"'",conn,1,3
				 If Not Getuserinfo.eof Then
						 If CLng(Getuserinfo("jifen"))>CLng(TotalGIftScore) Then
								 set rs = conn.execute("select * from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> '')) and Isgift = 1")
								 If Not rs.eof Then
										 Do While Not rs.eof
										 conn.execute("update [Lebi_vipproduct] set kucun = kucun-"& rs("basket_count") &" where id=" &rs("cpid")&"")
										 Set rsGift=Server.CreateObject("ADODB.Recordset")
										 rsGift.open "select * from [Lebi_basket]", conn, 1, 3
										 rsGift.addnew
												  rsGift("order_number")=order_id
												  rsGift("id")=rs("cpid")
												  rsGift("product_name")=rs("product_name")
												  rsGift("bianhao")=rs("bianhao")
												  rsGift("basket_count")=rs("basket_count")
												  rsGift("basket_date")=Now()
												  rsGift("price")=rs("price")
												  rsGift("user_id")=user_id
												  rsGift("spname")=rs("spname")
												  rsGift("spvalue")=rs("spvalue")
												  rsGift("father")=1
												  rsGift("IsGift")=1
										 rsGift.update
										 rsGift.close:Set rsGift=nothing
										 rs.movenext
										 loop
								  End If
								  rs.close:Set rs=Nothing
								  Getuserinfo("jifen") = Getuserinfo("jifen") - TotalGIftScore
								  Getuserinfo.update
						 End If
				 End If
				 Getuserinfo.close : Set Getuserinfo = Nothing
                 '删除临时购物表
                 conn.execute("Delete from [Lebi_lsbuy] where (sessionid="& CookiesId &" or (User_Id = '"& user_id &"' and User_Id <> ''))")
                 conn.execute("Delete from [Lebi_lshy] where sessionid="& CookiesId &"")
        End If

	    If IsSqlDataBase = 1 Then
	            Set rss=conn.execute("select top 1 z_price,z_discount from [Lebi_discount] where z_price<="&totalcash&" and charindex('"&dis_grade&"',z_flag)>0 order by z_id desc")
        Else
		        Set rss=conn.execute("select top 1 z_price,z_discount from [Lebi_discount] where z_price<="&totalcash&" and instr(z_flag,"&dis_grade&")>0 order by z_id desc")
	    End If
        If rss.eof Then
                z_price="0"
                z_discount="1.00"
        Else
                z_price=rss("z_price")
                z_discount=rss("z_discount")
                strdiscount=inttotext(rss("z_discount"))
        End if
        rss.close:Set rss=Nothing
		Set rss = conn.execute("select coupon_num from [Lebi_orders] where order_number='"& order_number &"'")
		If Not rss.eof Then
				If Trim(rss(0)) <> "" Then
						coupon_num = rss(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)
						coupon_discount = Scoupon(2)
						Scoupon.close : Set Scoupon = Nothing
						If coupon_type = 0 Then z_str4 = (totalcash*z_discount) - coupon_price
						If coupon_type = 1 Then z_str4 = (totalcash*z_discount) * coupon_discount/100
						Use_Coupon = True
				Else
						z_str4=(totalcash*z_discount)/moneyhl
						Use_Coupon = False
				End If
		Else
		        z_str4=(totalcash*z_discount)/moneyhl
				Use_Coupon = False
		End If
		rss.close : Set rss = Nothing
        z_str1=dw&""&formatnumber2(z_price/moneyhl)
        z_str2=strdiscount
        z_str3=dw&""&formatnumber2(totalcash*z_discount/moneyhl)
		Dim discountinfo
		If z_price=0 Then
				discountinfo = Lebi_cart(27)
		Else
				discountinfo = replace(replace(Replace(Lebi_cart(28),"[z_str1]",z_str1),"[z_str2]",z_str2),"[z_str3]","<span class='discountprice'>"& z_str3 &"</span>")
		End If
		Dim couponinfo
		If coupon_type = 0 Then
				couponinfo = Lebi_cart(137) &" "& Lebi_cart(138)&" "& dw & formatnumber2(coupon_price)
		Else
				couponinfo = Lebi_cart(137) &" "& Lebi_cart(139)&" "& coupon_discount &"%"
		End If
		payprice = formatnumber2((CDbl(Replace(dis_sum,",",""))+CDbl(fei)+CDbl(packing_price)+CDbl(fapiao_money)-CDbl(coupon_price))/moneyhl)
		Dim items_money
		items_money = formatnumber2(totalcash) 'formatnumber2(totalcash*z_discount/moneyhl)
		Dim total_money
		total_money = payprice 'formatnumber2(z_str4+fei+request("fapiao_money")+formatnumber2(packing_price))
		fei = formatnumber2(fei)
		packing_prcie = formatnumber2(packing_price)
		fapiao_money = formatnumber2(fapiao_money)
%>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable-top">
		<tbody>
		<tr>
		<td height="30" align="left" class="classhead">
		<%=Lang_Order(37) & order_user_id &"/"& order_user_name%>&nbsp;&nbsp;<%=Lang_Order(38) & order_user_grade_name%>
		</td>
		<td align="right" class="classhead">
		<%=Lang_Order(39)%> <a href="admin_order_cart.asp"><span id="carttotalnum" class="totalnum">0</span> <%=Lang_Order(40)%></a>&nbsp;&nbsp;<%=Lang_Order(41)%> ￥<span id="carttotalprice" class="totalprice">0.00</span>
		<script language="javascript" type="text/javascript" src="Ajax_Cart.asp?showtype=1"></script>
		</td>
		</tr>
		</tbody>
		</table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" id="cashsave" class="classtable2">
		<tr>
		  <td height="30" colspan="2" align="right" class="classhead"><input type="image" src="lang/<%=LangFilePath%>/images/bt_bak.gif" border="0" title=" <%=Lang_sys(3)%> " onclick="location.href='Admin_order_quick.asp';return false;" align="absmiddle"></td>
		 </tr>
		<tr>
		<td height="30" class="classtop" colspan="2"><%=Lang_Order(72)%></td>
		</tr>
		<%if jmail_cashon=1 and jmail_type<>0 then%>
			<tr class="classrow">
			<td width="15%" height="30" class="classrow"><%=Lang_Order(73)%></td>
			<td class="classrow"><%=sendmsg%></td>
			</tr>
		<%end if%>
		<tr class="classrow">
		<td width="15%" height="30" class="classrow"><%=Lang_Order(1)%></td>
		<td class="classrow"><%=order_number%></td>
		</tr>
		<tr class="classrow">
		<td width="15%" height="30" class="classrow"><%=Lang_Order(74)%></td>
		<td class="classrow"><%=dw%><%=items_money%></td>
		</tr>
		<tr class="classrow">
		<td width="15%" height="30" class="classrow"><%=Lang_Order(75)%></td>
		<td class="classrow"><%=dw%><%=fei%></td>
		</tr>
		<%if Config_Lebi_Eshop(2) = 1 then%>
			<tr class="classrow">
			<td width="15%" height="30" class="classrow"><%=Lang_Order(76)%></td>
			<td class="classrow"><%=dw%><%=fapiao_money%></td>
			</tr>
		<%end if%>
		<tr class="classrow">
		<td width="15%" height="30" class="classrow"><%=Lang_Order(77)%></td>
		<td class="classrow"><%=dw%><%=packing_prcie%></td>
		</tr>
		<tr class="classrow">
		<td width="15%" height="30" class="classrow"><%=Lang_Order(78)%></td>
		<td class="classrow"><%=jifen%></td>
		</tr>
		<tr class="classrow">
		<td width="15%" height="30" class="classrow"><%=Lang_Order(79)%></td>
		<td class="classrow"><span style="color:#FF0000;font-size:18px;font-weight:bold;"><%=dw%><%=total_money%></span></td>
		</tr>
		<tr class="classrow">
		  <td height="30" colspan="2" align="right" class="classfooter"><input type="image" src="lang/<%=LangFilePath%>/images/bt_bak.gif" title=" <%=Lang_sys(3)%> " onclick="location.href='Admin_order_quick.asp';return false;" align="absmiddle"></td>
		 </tr>
		</table>
		<script>tdshow("cashsave");</script>
<%
End Sub
%>