<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--#include file="../include/Config.Inc"-->
<!--#include file="../include/Lebi_db_cls.asp"-->
<!--#include file="../include/Lebi_cache_cls.asp"-->
<!--#include file="../include/Lebi_cache.asp"-->
<%
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 Admin_orders_out.asp
'* 最后更新 2013-10-26 by 56770.kingdge
'*****************************************
Dim admin_flag
admin_flag=",1.3,"
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_order.inc"
If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
        LB_Head()
		LB_Menu()
		Response.Write("<div class=""mainbody"">")
		Response.Write("<div class=""mainbody2"">")
	    adminflag()
		Response.Write("</div>")
		Response.Write("</div>")
		LB_Footer()
End If
order_number = Safereplace(request("order_number"))
response.buffer = true
If request("action")="toword" Then
Response.ContentType = "application/vnd.msword"
response.AddHeader "content-disposition", "attachment;filename=Order"& order_number &".doc"
ElseIf request("action")="toexcel" Then
response.ContentType ="application/vnd.ms-excel"
response.AddHeader "content-disposition", "attachment;filename=Order"& order_number &".xls"
End If
If order_number = "" Then
        response.write("<script>alert(""ERROR!"");location.href=""admin_orders_v.asp"";</script>")
        response.end
end if
sql="select * from [Lebi_orders] where order_number='"&order_number&"'"
set rs=conn.execute (sql)
id=rs("id")
orderzt=rs("orderzt")
totalcash=rs("totalcash")
order_number=rs("order_number")
order_time=rs("order_time")
sendtype=rs("sendtype")
paymenttype=rs("paymenttype")
fei=rs("fei")
jifen=rs("jifen")
user_id=rs("user_id")
to_name=rs("to_name")
to_zip=rs("to_zip")
to_tel=rs("to_tel")
to_tel2=rs("to_tel2")
to_adds=rs("to_adds")
to_other=rs("to_other")
to_mobile=rs("to_mobile")
from_name=rs("from_name")
from_zip=rs("from_zip")
from_tel=rs("from_tel")
from_adds=rs("from_adds")
from_other=rs("from_other")
from_email=rs("from_email")
from_mobile=rs("from_mobile")
fuyan=rs("fuyan")
coupon_price = checknum(rs("coupon_price"),0)
zt=rs("zt")
packing_price = rs("packing_price")
'''发票信息
iffapiao=rs("iffapiao")
fapiao_money = checknum(rs("fapiao_money"),0)
fapiao_company=rs("fapiao_company")
fapiao_adds=rs("fapiao_adds")
fapiao_zip=rs("fapiao_zip")
'增加折扣
z_discount=rs("discount")
dis_sum=rs("dis_sum")
paidmoney = checknum(rs("paidmoney"),0)
from_adds2=rs("from_adds2")
from_city=rs("from_city")
from_state=rs("from_state")
If sys_soft = 1 Then 
		If InStr(from_tel,",") = 0 Then from_tel = from_tel &",,"
		Set country = conn.execute("Select area_name from [lebi_deliver_area] where id = "& checknum(rs("from_country"),0) &"")
		If Not country.eof Then
			from_country = Country(0)
		End If
		country.close : Set country = Nothing
End If 
rs.close
set rs=Nothing
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>订单-打印输出</title>
<style>
td{font-size:12px;}
h2{margin:0;padding:0;font-size:14px;font-weight:bold;}
</style>
</head>
<body>
<table width="600" border="1" cellpadding=0>
<tr>
 <td height="25" colspan="6"><h2><%=Lang_Order(1) & order_number%></h2>
</td>
</tr>
<tr>
 <td colspan="6"><%=Lang_Order(118) & sendtype%><br>
<%=Lang_Order(119) & paymenttype%>
</td>
</tr>
<%If sys_soft = 0 Then%>
<tr>
 <td height="25" colspan="6"><h2><%=Lang_Order(20)%></h2></td>
</tr>
<tr>
 <td colspan="6">
<%=Lang_Order(54) & to_name%><br>
<%=Lang_Order(120) & to_mobile%><br>
<%=Lang_Order(9) & to_tel%><br>
<%=Lang_Order(56) & to_tel2%><br>
<%=Lang_Order(12) & to_zip%><br>
<%=Lang_Order(11) & to_adds%><br>
<%=Lang_Order(55) & to_other%>
</td>
</tr>
<%End If%>
<tr>
 <td height="25" colspan="6"><h2><%=Lang_Order(19)%></h2></td>
</tr>
<tr>
 <td colspan="6">
<%If sys_soft = 0 Then%>
<%=Lang_Order(54) & from_name%><br>
<%=Lang_Order(120) & from_mobile%><br>
<%=Lang_Order(9) & from_tel%><br>
<%=Lang_Order(10) & from_email%><br>
<%=Lang_Order(12) & from_zip%><br>
<%=Lang_Order(11) & from_adds%><br>
<%=Lang_Order(55) & from_other%>
<%Else%>
<%=Lang_Order(54) & from_name%><br>
<%=Lang_Order(11) & from_adds &"&nbsp;&nbsp;"& from_adds2%><br>
<%=Lang_Order(12) & from_zip%><br>
<%=Lang_Order(186) & from_city%><br>
<%=Lang_Order(187) & from_state%><br>
<%=Lang_Order(188) & from_country%><br>
<%=Lang_Order(9)%>(<%=Split(from_tel,",")(0)%>).<%=Split(from_tel,",")(1)%>.<%=Split(from_tel,",")(2)%><br>
<%=Lang_Order(120) & from_mobile%><br>
<%=Lang_Order(10) & from_email%><br>
<%=Lang_Order(55) & from_other%>
<%End If%>
<%
If fuyan <> "" Then 
	response.write("<br>"& Lang_Order(143) & fuyan)
End If 
%>
</td>
</tr>
</table>
<table width="600" cellpadding=0 border="1">
<tr>
 <td height="25" colspan="6"><h2><%=Lang_Order(121)%></h2></td>
</tr>
<%
set rs2 = conn.execute("select * from [Lebi_basket] where order_number="&id&" and IsGift=0 and id > 0 order by father desc,id desc")
If Not rs2.eof Then
%>
<tr>
<td width="12%" height="25"><%=Lang_Order(43)%></td>
<td width="12%"><%=Lang_Order(49)%></td>
<td><%=Lang_Order(50)%></td>
<td width="10%"><%=Lang_Order(46)%></td>
<td width="10%"><%=Lang_Order(53)%></td>
<td width="10%"><%=Lang_Order(47)%></td>
</tr>
<%
do while not rs2.eof
		pName = rs2("product_name")
		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 
				pName = pName &" ("& spstr &")"
		End If
		If rs2("product_type") = "unite" Then
			Set GetPic = conn.execute("select pic from [Lebi_product_unite] where id = "& rs2("id") &"")
			If Not GetPic.eof Then
			ProPic = GetPic(0)
			End If
			GetPic.close : Set GetPic = Nothing
		ElseIf rs2("product_type") = "groupon" Then
			Set GetPic = conn.execute("select pic from [Lebi_groupon_product] where id = "& rs2("id") &"")
			If Not GetPic.eof Then
			ProPic = GetPic(0)
			End If
			GetPic.close : Set GetPic = Nothing
		Else
			Set GetPic = conn.execute("select pic from [Lebi_product] where id = "& rs2("id") &"")
			If Not GetPic.eof Then
			ProPic = GetPic(0)
			End If
		End If 
        pro_bianhao = rs2("bianhao")
		pro_price = FormatNumber2(rs2("price"))
		pro_totalprice = FormatNumber2(rs2("price")*rs2("basket_count"))
%>
<tr>
<td height="50"><img src=http://<%=Request.ServerVariables("SERVER_NAME") & Eshop_url & PicPath%>/<%=ProPic%> width="50" height="50"></td>
<td><%= pro_bianhao%>&nbsp;</td>
<td><%=pName%></td>
<td><%=rs2("basket_count")%></td>
<td><%=FormatNumber2(rs2("price"))%></td>
<td><%=rs2("price")*rs2("basket_count")%></td>
</tr>
<%
rs2.movenext
b_num=b_num+1
Loop
End If
set rss = conn.execute("select price,basket_count from [Lebi_basket] where order_number="&id&" and isgift=0 and id > 0")
b_num_s = 0
b_price = 0
do while not rss.eof
b_price=b_price+(rss("price")*rss("basket_count"))
b_num_s=clng(b_num_s+clng(rss("basket_count")))
rss.movenext
loop
rss.close:set rss=nothing
%>
<tr>
<td height="25" colspan="6" align="right"><%=Lang_Order(122) & b_num%>&nbsp;&nbsp;<%=Lang_Order(123) & b_num_s%>&nbsp;&nbsp;<%=Lang_Order(125) & formatnumber2(b_price)%></td>
</tr>
<tr>
<td height="25" colspan="6" align="right"><%=Lang_Order(74) & formatnumber2(totalcash)%>&nbsp;&nbsp;（<%=Lang_Order(70) & formatnumber2(dis_sum)%>&nbsp;&nbsp;<%=Lang_Order(126) & formatnumber2(coupon_price)%>）&nbsp;&nbsp;<%=Lang_Order(75) & formatnumber2(fei)%>
<%If packing_price > 0 Then%>&nbsp;&nbsp;<%=Lang_Order(77) & formatnumber2(packing_price)%><%End If%>
<%If fapiao_money > 0 Then%>&nbsp;&nbsp;<%=Lang_Order(76) & formatnumber2(fapiao_money)%><%End If%>
<%If paidmoney > 0 Then%>&nbsp;&nbsp;<%=Lang_Order(25) & formatnumber2(paidmoney)%><%End If%>
</td>
</tr>
<tr>
<td height="25" colspan="6" align="right"><%=Lang_Order(79)%><span style="color:#FF0000;font-size:18px;font-weight:bold;"><%=formatnumber2(CDbl(dis_sum)+CDbl(fei)+CDbl(packing_price)+CDbl(fapiao_money)-CDbl(coupon_price)-CDbl(paidmoney))%></span></td>
</tr>
</table>
</body>
</html>