<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--#include file="inc/Page_cls.asp"-->
<!-- #include file="upfile/class_upfile.asp" -->
<!--#include file="../include/Lebi_config.asp"-->
<%
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 Admin_ship.asp
'* 最后更新 2014-05-09 by 56770.kingdge
'*****************************************
Dim admin_flag
admin_flag=",1.8,"
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_ship.inc"
include "lang/"& LangFilePath &"/lang_order.inc"
CurrentId = 2
CurrentUrl = "admin_ship.asp"
LB_Head()
LB_Menu()
action = request("action")
%>
<div class="tabmenu mainwidth">
      <ul>
        <li <%If action <> "add" and action <> "csv" Then Response.Write("class=""current""") End If%>><a href="admin_ship.asp"><span><%=Lang_Menu(100)%></span></a></li>
        <li <%If action = "add" Then Response.Write("class=""current""") End If%>><a href="?action=add"><span><%=Lang_Ship(15)%></span></a></li>
		<li <%If action = "csv" Then Response.Write("class=""current""") End If%>><a href="?action=csv"><span>导入</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()
		Select Case action
			   Case "del" : del()
			   Case "add" : add()
			   Case "add_ok" : add_ok()
			   Case "edit" : edit()
			   Case "edit_ok" : edit_ok()
			   Case "csv" : csv()
			   Case "csv_ok" : csv_ok()
			   Case Else
					main()
		End Select
End If
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()

sub csv_ok()
	    server.scripttimeout=9999999
		Dim filetype,csvi(20)
	    dim upload,filepath,formname,file,f_filename,f_viewname,delcsvNum
	    dim drawinfo
		delcsvNum = 0
		upfiletype="txt,csv,xls"
		onesize="20480000" '2000kb
		filepath = "excel/"
		filepath=createpath(filepath)
		drawinfo = ""
		set upload_lebi = new upfile_cls
		upload_lebi.uploadtype		= upload_type			'设置上传组件类型
		upload_lebi.uploadpath		= filepath								'设置上传路径
		upload_lebi.maxsize			= int(onesize)							'单位 kb
		upload_lebi.inceptmaxfile		= 1										'每次上传文件个数上限
		upload_lebi.inceptfiletype		= upfiletype							'设置上传文件限制
		upload_lebi.rname			= ""                                                          '文件名前缀
		upload_lebi.chksessionname		= "uploadcode"
		upload_lebi.previewtype			= 999
		upload_lebi.previewimagewidth	= pic_xw										'设置预览图片宽度
		upload_lebi.previewimageheight	= pic_xh										'设置预览图片高度
		upload_lebi.drawimagewidth		= upload_drawwidth						'设置水印图片或文字区域宽度
		upload_lebi.drawimageheight		= upload_drawhight						'设置水印图片或文字区域高度
		upload_lebi.drawgraph		= upload_drawgraph						'设置水印透明度
		upload_lebi.drawfontcolor		= upload_drawcolor						'设置水印文字颜色
		upload_lebi.drawfontfamily		= upload_drawfont						'设置水印文字字体格式
		upload_lebi.drawfontsize		= upload_drawfontsize						'设置水印文字字体大小
		upload_lebi.drawfontbold		= upload_drawfontbold						'设置水印文字是否粗体
		upload_lebi.drawinfo			= drawinfo					'设置水印文字信息或图片信息
		upload_lebi.drawtype			= upload_isdraw						'0=不加载水印 ，1=加载水印文字，2=加载水印图片
		upload_lebi.drawxytype		= upload_drawxytype						'"0" =左上，"1"=左下,"2"=居中,"3"=右上,"4"=右下
		upload_lebi.drawsizetype		= 1						'"0"=固定缩小，"1"=等比例缩小
		if upload_drawpiccolor<>"" or upload_drawpiccolor<>"0" then
				upload_lebi.transitioncolor	= upload_drawpiccolor			'透明度颜色设置
		end If
		upload_lebi.saveupfile
		if upload_lebi.errcodes<>0 Then
				call up_mes(Lang_sys(46),"·"& upload_lebi.description,0,"javascript:history.back()",0,0,2,0)
		end If
		if upload_lebi.count > 0 then
				for each formname in upload_lebi.uploadfiles
						set file = upload_lebi.uploadfiles(formname)
						f_filename = filepath & file.filename
						'On Error Resume Next
						Set csvConn = Server.CreateObject("ADODB.Connection")
						csvConn.open "Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ="& Server.MapPath(filepath) &";Extensions=csv;Persist Security Info=False" '"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath(filepath) &";Extended Properties='text;HDR=Yes;FMT=Delimited'"
						If Err<>0 Then
								Response.Write Err.Description
								Response.End()
						End if
						cvsDataCount = 0
						Set csvrs=csvconn.Execute("select * from "& file.filename &"")
						If Not (csvrs.eof or csvrs.bof) Then
								cvsDataCount = 1
								cvsDataList = csvrs.GetRows()
						End If
						csvrs.Close:Set csvrs=Nothing
						If cvsDataCount = 0 Then
								call up_mes(Lang_sys(46),"·没有可导入的数据！",0,"javascript:history.back()",0,0,2,0)
						End If
						For ii = 0 To Ubound(cvsDataList,2)
								If safereplace(cvsDataList(1,ii)) <> "" Then
								set inexcel = server.createobject("adodb.recordset")
								inexcelsql = "select * from [Lebi_ShipMes] where"
								inexcelsql = inexcelsql &" s_no = '"& safereplace(cvsDataList(1,ii)) &"'"
								inexcel.open inexcelsql,conn,1,3
								if inexcel.eof then
										inexcel.addnew
										If Trim(cvsDataList(0,ii)) = "" Or isdate(cvsDataList(0,ii))=False  Then 
												s_date = Date()
										Else
												s_date = safereplace(cvsDataList(0,ii))
										End If 
										randomize
										ranNum = int((9999999-1000000)*rnd+1000000)
										yy = Right(year(s_date),2):mm = right("00"&month(s_date),2):dd = right("00"&day(s_date),2):xiaoshi = right("00"&hour(time),2):fenzhong = right("00"&minute(time),2):miao = right("00"&second(time),2)
										inexcel("s_order_number") = "O"& yy & mm & dd & ranNum '"000000000000000"
										inexcel("s_no") = safereplace(cvsDataList(1,ii))
								End If 
								inexcel("s_date") = s_date
								inexcel("s_name") = safereplace(cvsDataList(2,ii))
								inexcel("s_fei1") = checknum(cvsDataList(4,ii),0)
								inexcel("s_fei2") = 0
								inexcel("s_user_name") = safereplace(cvsDataList(5,ii))
								inexcel("s_state") = 1
								inexcel.update
								inexcel.close : set inexcel = nothing
								End If
						Next
						Call DelFile(f_filename)
						If Config_Lebi_Eshop(17)="1" Then
								Application.Contents.RemoveAll
						Else
								NewEvent "0"
						End If
						csvNum = Ubound(cvsDataList,2)+1
						csvConn.close
						If savetype = 1 Then
								url = "?action=saveremotefile"
						Else
								url = "?datatype=2"
						End If 
						call up_mes(Lang_Menu(69),"·共导入"&csvNum&"条记录！",0,url,0,0,2,1)
				Next
		Else
				call up_mes(Lang_sys(46),"·没有可导入的数据！",0,"javascript:history.back()",0,0,2,0)
		end If
		set upload_56770 = Nothing
		Response.Write("<script>$(""#divposting"").hide();</script>")
end Sub

Sub del()
        If OnlyRead = 1 Then OnlyReadMessage()
		id=safereplace(request("id"))
		if id="" then
			   response.write"<SCRIPT language=JavaScript>alert('"& Lang_sys(41) &"');javascript:history.go(-1)</SCRIPT>"
			   response.end
		end If
		Set rs = server.CreateObject("adodb.recordset")
		rs.open "select s_order_number from [Lebi_ShipMes] where s_id in ("&id&")",conn,1,3
		Do While Not rs.eof 
				Set rsorder = server.CreateObject("adodb.recordset")
				rsorder.open "select orderzt from [Lebi_orders] where order_number='"& rs(0) &"'",conn,1,3
				If Not rsorder.eof Then
					rsorder(0) = Replace(rsorder(0),",3,","")
					rsorder.update 
				End If
				rsorder.close : Set rsorder = Nothing
				rs.delete
				rs.update
		rs.movenext 
		Loop
		rs.close : Set rs = Nothing 
		ManageLog Lang_Ship(1) &" ["&id&"]"
		Response.redirect "?page="& request("page") &"&pagenum="& request("pagenum") &"&keyword="& request("keyword") &"&DateFrom="& request("DateFrom") &"&DateTo="& request("DateTo")
End Sub

Sub add_ok()
		If OnlyRead = 1 Then OnlyReadMessage()
		s_order_number = safereplace(request("s_order_number"))
		s_name = safereplace(request("s_name"))
		s_no = safereplace(request("s_no"))
		s_fei1 = CheckNum(request("s_fei1"),0)
		s_fei2 = CheckNum(request("s_fei2"),0)
		s_user_id = safereplace(request("s_user_id"))
		s_user_name = safereplace(request("s_user_name"))
		Set rs = server.createobject("adodb.recordset")
		rs.open "select user_id,from_name,orderzt,from_mobile,id,LangTxt from [Lebi_Orders] where order_number = '"& s_order_number &"'",conn,1,3
		If Not rs.eof Then
				If s_user_id = "" Then s_user_id = rs(0)
				If s_user_name = "" Then s_user_name = rs(1)
				rs(2) = rs(2) &",3,"
				rs.update
				If Config_Lebi_Eshop(23) = 2 Then '发货后扣除库存 by 56770.kingdge 2012-05-16
					Set rsbasket = conn.execute("select id,basket_count,spvalue from [lebi_basket] where order_number = "& rs(4) &"")
					Do While Not rsbasket.eof 
					conn.execute("update [Lebi_product] set buys = buys + "& rsbasket("basket_count")&",kucun = kucun - "& rsbasket("basket_count") &",html = 0 where id = " & rsbasket("id") &"")
					conn.execute("update [Lebi_Product_Stock] set p_buys = p_buys + "& rsbasket("basket_count") &",p_stock = p_stock - "& rsbasket("basket_count") &" where p_id = " & rsbasket("id") &" and s_value"& rs(5) &" = '"& rsbasket("spvalue") &"'")
					rsbasket.movenext 
					Loop
					rsbasket.close : Set rsbasket = Nothing 
				End If 
				If SMS_State = "1" Then
						If CheckMobile(rs(3)) Then
								Dim LoadSMSInfo,SMSMsg
								LoadSMSInfo = LoadStyle(Eshop_url&"include/lebi_data/SMS"& LangTxt &".data")
								If InStr(","& SMS_SendMode &",",",3,") > 0 Then
										SMSMsg = splits(Split(LoadSMSInfo,"@@@")(2))
										ReplaceStyle "user_id",user_id,SMSMsg
										ReplaceStyle "user_name",user_name,SMSMsg
										ReplaceStyle "time",Now(),SMSMsg
										ReplaceStyle "order_number",s_order_number,SMSMsg
										ReplaceStyle "sendtype",s_name,SMSMsg
										ReplaceStyle "sendno",s_no,SMSMsg
										Call RedirectSendSMS(rs(3),SMSMsg,0,"",sms_sendtype)
								End If
						End If
				End If
		End If
		rs.close : Set rs = Nothing
		Set rs = server.createobject("adodb.recordset")
		rs.open "select * from [Lebi_ShipMes] where s_order_number = '"& s_order_number &"' And s_order_number <> '000000000000'",conn,1,3
		If Not rs.eof Then
				Call Up_mes(Lang_sys(46),"·"& Lang_Ship(2),0,"javascript:history.back();",0,0,2,0)
		Else
				rs.addnew
				rs("s_name") = s_name
				rs("s_no") = s_no
				rs("s_fei1") = s_fei1
				rs("s_fei2") = s_fei2
				rs("s_user_id") = s_user_id
				rs("s_user_name") = s_user_name
				rs("s_order_number") = s_order_number
				rs("s_date") = Date()
				rs.update
		End If
		rs.close : Set rs = Nothing
		If s_user_id <> "" And s_fei2 <> 0 Then
				conn.execute("update [Lebi_User] set usermoney = usermoney + "& s_fei2 &" where user_id = '"& s_user_id &"'")
				conn.execute("insert into [Lebi_money_log](m_user_id,m_order_num,m_sj,m_type,m_price,m_zt)values('"& s_user_id &"','"& s_order_number &"',"& sqlnowstring &",'["& Safereplace(Eshop_Lebi_name) &"]"& Lang_Ship(3) & formatnumber2(s_fei2) &"',"& s_fei2 &",1)")
		End If
		ManageLog Lang_Ship(4) &" ["& s_name &" "& s_no &"]"
		Call Up_mes(Lang_sys(45),"·"& Lang_sys(44),0,"?",0,0,2,1)
End Sub


Sub edit_ok()
        If OnlyRead = 1 Then OnlyReadMessage()
		id = CheckNum(request("id"),0)
		s_order_number = safereplace(request("s_order_number"))
		s_name = safereplace(request("s_name"))
		s_no = safereplace(request("s_no"))
		s_fei1 = CheckNum(request("s_fei1"),0)
		s_fei2 = CheckNum(request("s_fei2"),0)
		s_user_id = safereplace(request("s_user_id"))
		s_user_name = safereplace(request("s_user_name"))
		Set rs = server.createobject("adodb.recordset")
		rs.open "select user_id,from_name,orderzt from [Lebi_Orders] where order_number = '"& s_order_number &"'",conn,1,3
		If Not rs.eof Then
				If s_user_id = "" Then s_user_id = rs(0)
				If s_user_name = "" Then s_user_name = rs(1)
				rs(2) = rs(2) &",3,"
				rs.update
		End If
		rs.close : Set rs = Nothing
		Set rs = server.createobject("adodb.recordset")
		rs.open "select * from [Lebi_ShipMes] where s_id = "& id &"",conn,1,3
		If Not rs.eof Then
				rs("s_name") = s_name
				rs("s_no") = s_no
				rs("s_fei1") = s_fei1
				rs("s_fei2") = s_fei2
				rs("s_user_id") = s_user_id
				rs("s_user_name") = s_user_name
				rs("s_order_number") = s_order_number
				rs.update
		End If
		rs.close : Set rs = Nothing
		ManageLog Lang_Ship(5) &" ["& s_name &" "& s_no &"]"
		Call Up_mes(Lang_sys(48),"·"& Lang_sys(47),0,"?",0,0,2,1)
End Sub

Sub main()
		page = checknum(request("page"),1)
		pagenum = CheckNum(request("pagenum"),15)
		datefrom = safeReplace(request("datefrom"))
		dateto = safeReplace(request("dateto"))
		keyword = safereplace(request("keyword"))
		Dim ors
		Set ors=new Cls_vbsPage
		Set ors.Conn=conn
		With ors
		.PageSize=pagenum
		.PageName="Page"
		If IsSqlDataBase = 0 Then
				.DbType="AC"
		Else
				.DbType="MSSQL"
		End If
		.RecType=-1
		.Pkey="s_id"
		.Field="s_id,s_order_number,s_user_id,s_user_name,s_name,s_no,s_fei1,s_date"
		.Table="[Lebi_ShipMes]"
		sql = "1=1"
		if keyword<>"" then sql=sql&" and (s_name like '%"&keyword&"%' or s_no like '%"&keyword&"%' or s_order_number like '%"&keyword&"%' or s_user_name like '%"&keyword&"%' or s_user_id like '%"&keyword&"%')"
		If IsSqlDataBase = 1 And datefrom<>"" And dateto<>"" Then sql=sql + " and DateDiff(d,s_date,'"& datefrom &"')<=0 and DateDiff(d,s_date,'"& dateto &"')>=0"
		If IsSqlDataBase = 0 And datefrom<>"" And dateto<>"" Then sql=sql + " and DateDiff('d',s_date,'"& datefrom &"')<=0 and DateDiff('d',s_date,'"& dateto &"')>=0"
		.Condition=sql
		.OrderBy="s_id desc"
		End With
		DataCount=ors.RecCount()
		DataList=ors.ResultSet()
%>
<script language="javascript" src="inc/js/MyCalendar.js"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable-top">
<tbody>
<tr>
<form name="Lebi" method="get" action="?">
<td height="30" align="left" class="classhead">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
     <input type="text" name="dateFrom" value="<%=dateFrom%>" size="12" class="form_calendar" onclick="setday(this)" /> - <input type="text" name="dateTo" value="<%=dateTo%>" size="12" class="form_calendar" onclick="setday(this)" />
</td>
<td style="padding-left:5px;"><input name="keyword" type="text" title="<%=Lang_Ship(6)%>" class="form_query" size="15"><input name="Submit" type="submit" value="" title="<%=Lang_sys(25)%>" align="absmiddle" class="btn_query"><input type="hidden" name="pagenum" value="<%= pagenum %>">
</td>
</tr>
</table>
</td>
</form>
<td class="classhead" align="right">
<%=QuickMenu("Admin_payment_inform.asp|"& Lang_Menu(55) &"","Admin_Invoice.asp|"& Lang_Menu(101) &"")%>
</td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="list" class="classtable2">
<tbody>
<form name="Lebi" method="post" action="?action=del">
<tr>
<td height="30" class="classhead" align="left" colspan="2">
<input type="image" name="Submit" title=" <%=Lang_sys(15)%> " onClick="return confirm('<%=Lang_sys(64)%>')" src="lang/<%=LangFilePath%>/images/bt_delete.gif" align="absmiddle">
<input type="hidden" name="page" value="<%=page%>">
<input type="hidden" name="keyword" value="<%=keyword%>">
<input type="hidden" name="dateFrom" value="<%=dateFrom%>">
<input type="hidden" name="dateTo" value="<%=dateTo%>">
<input type="hidden" name="pagenum" value="<%= pagenum %>">
</td>
<td height="30" class="classhead" align="right" colspan="7"><%=ors.ShowPageHead(page)%></td>
</tr>
  <tr>
	 <td width="5%" height="30" class="classtop" title="<%=Lang_sys(4)%>" style="cursor:pointer;" onclick="location.href='javascript:selectall();';return false;"><%=Lang_sys(50)%></td>
     <td width="15%" class="classtop"><%=Lang_Ship(7)%></td>
     <td width="12%" class="classtop"><%=Lang_Ship(8)%></td>
	 <td width="12%" class="classtop"><%=Lang_Ship(9)%></td>
     <td width="15%" class="classtop"><%=Lang_Ship(10)%></td>
	 <td width="12%" class="classtop"><%=Lang_Ship(11)%></td>
	 <td width="10%" class="classtop"><%=Lang_Ship(12)%></td>
	 <td width="13%" class="classtop"><%=Lang_Ship(13)%></td>
     <td width="6%" class="classtop"><%=Lang_Ship(14)%></td>
  </tr>
<%
If DataCount >0 Then
		For i = 0 To Ubound(DataList,2)
%>
  <tr class="classrow">
	<td height="30" class="classrow"><input type="checkbox" name="id" value="<%=DataList(0,i)%>"></td>
    <td class="classrow"><a href="?action=edit&id=<%=DataList(0,i)%>"><%=DataList(1,i)%></a></td>
    <td class="classrow"><%=DataList(2,i)%>&nbsp;</td>
	<td class="classrow"><%=DataList(3,i)%>&nbsp;</td>
	<td class="classrow"><%=DataList(4,i)%></td>
    <td class="classrow"><%=DataList(5,i)%></td>
	<td class="classrow"><%=formatnumber2(DataList(6,i))%></td>
	<td class="classrow"><%=DataList(7,i)%></td>
	<td class="classrow"><a href="?action=edit&id=<%=DataList(0,i)%>"><img src="images/icon_edit.gif" title="<%=Lang_sys(51)%>" border="0"></a></td>
  </tr>
<%
        Next
End If
%>
</form>
<tr>
	<td height="30" class="classfooter" colspan="2"><%=GetPageNum(15,pagenum)%></td>
	<td height="30" class="classfooter" align="right" colspan="7"><%=ors.ShowPageFoot(page)%></td>
</tr>
</tbody>
</table>
<script>tdshow("list");</script>
<%
End Sub

sub add()
id = CheckNum(request("id"),0)
Set rs = conn.execute("select order_number,sendtype,fei,from_name,user_id from [lebi_Orders] where id = "& id &"")
If Not rs.eof Then
		s_order_number = rs(0)
		s_name = rs(1)
		s_fei1 = rs(2)
		s_user_name = rs(3)
		s_user_id = rs(4)
End If
rs.close : Set rs = Nothing
%>
<script type="text/javascript">
function CheckForm(theform)
{
	if (CheckEmpty('s_order_number')){ShowMessage('s_order_number','<%=Lang_Ship(28)%>');return false;}
	var order_number = document.getElementById("s_order_number");
	if (order_number.value.length>20 || order_number.value.length<12)
    {
		order_number.value = "000000000000";
		ShowMessage('s_order_number','<%=Lang_Ship(29)%>');
		return false;
	}
	if (CheckEmpty('s_name')){ShowMessage('s_name','<%=Lang_Ship(30)%>');return false;}
	if (CheckEmpty('s_no')){ShowMessage('s_no','<%=Lang_Ship(31)%>');return false;}
	if (CheckEmpty('s_fei1')){ShowMessage('s_fei1','<%=Lang_Ship(32)%>');return false;}
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="add" class="classtable">
<form name="add" method="post" action="?action=add_ok" onSubmit="return CheckForm(this);">
<tr>
	<td height="30" align="left" class="classhead"><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"></td>
	<td class="classhead" align="right">
	<%=QuickMenu("","")%>
	</td>
 </tr>
<tr>
    <td class="classtop" height="30" colspan="2"><%=Lang_Ship(15)%></td>
</tr>
<tr class="classrow">
	<td width="15%" height="30" class="classrow"><%=Lang_Ship(16)%></td>
	<td width="85%" class="classrow"><input type="text" name="s_order_number" id="s_order_number" value="<%= s_order_number %>" size="40" class="form"> <span id="mes_s_order_number"><em><%=Lang_Ship(17)%></em></span></td>
</tr>
<tr class="classrow">
	<td height="30" class="classrow"><%=Lang_Ship(19)%></td>
	<td class="classrow"><input type="text" name="s_name" id="s_name" value="<%= s_name %>" size="40" class="form"> <span id="mes_s_name"><em><%=Lang_Ship(18)%></em></span></td>
</tr>
<tr class="classrow">
	<td height="30" class="classrow"><%=Lang_Ship(20)%></td>
	<td class="classrow"><em><input type="text" name="s_no" id="s_no" value="" size="40" class="form"> <span id="mes_s_no"><%=Lang_Ship(18)%></em></span></td>
</tr>
<tr class="classrow">
	<td height="30" class="classrow"><%=Lang_Ship(21)%></td>
	<td class="classrow"><input type="text" name="s_fei1" id="s_fei1" value="<%= s_fei1 %>" size="10" class="form"> <span id="mes_s_fei1"><em><%=Lang_Ship(18)%></em></span></td>
</tr>
<tr class="classrow">
	<td height="30" class="classrow"><%=Lang_Ship(22)%></td>
	<td class="classrow"><input type="text" name="s_fei2" value="0" size="10" class="form"> </td>
</tr>
<tr class="classrow">
	<td height="30" class="classrow"><%=Lang_Ship(23)%></td>
	<td class="classrow"><input type="text" name="s_user_name" value="<%= s_user_name %>" size="40" class="form"> </td>
</tr>
<tr class="classrow">
	<td height="30" class="classrow"><%=Lang_Ship(24)%></td>
	<td class="classrow"><input type="text" name="s_user_id" value="<%= s_user_id %>" size="40" class="form"> </td>
</tr>
<tr class="classfooter">
  <td colspan="2" height="30" 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"></td>
 </tr>
</form>
<tr>
<td colspan="2" class="classfaq">
  <div class="faq_main">
  <p class="faq_title"><%=Lang_sys(49)%></p>
   <%=Lang_Ship(25)%>
  </div>
</td>
</tr>
</table>
<script>tdshow("add");</script>
<%
end Sub

sub edit()
id = checknum(request("id"),0)
order_number = safereplace(request("order_number"))
sql = "select * from [Lebi_ShipMes] where 1=1"
If id <> 0 Then sql = sql &" and s_id = "& id &""
If order_number <> "" Then sql = sql &" and s_order_number = '"& order_number &"'"
Set rs = conn.execute(sql)
If rs.eof Then
		Set rs = server.CreateObject("adodb.recordset")
		rs.open "select orderzt from [Lebi_orders] where order_number='"& order_number &"'",conn,1,3
		If Not rs.eof Then
			rs(0) = Replace(rs(0),",3,","")
			rs.update 
		End If
		rs.close : Set rs = Nothing
		Call Up_mes(Lang_sys(46),"·"& Lang_Ship(27),0,"?action=add&id="& checknum(request("order_id"),0) &"&order_number="& order_number &"",0,0,2,0)
Else
Set rsorder = conn.execute("select LangTxt from [lebi_orders] where order_number = '"& order_number &"'")
If Not rsorder.eof Then 
		LangTxt = rsorder(0)
End If 
rsorder.close : Set rsorder = Nothing
%>
<script type="text/javascript">
function CheckForm(theform)
{
	if (CheckEmpty('s_order_number')){ShowMessage('s_order_number','<%=Lang_Ship(28)%>');return false;}
	var order_number = document.getElementById("s_order_number");
	if (order_number.value.length>20 || order_number.value.length<12)
    {
		order_number.value = "000000000000";
		ShowMessage('s_order_number','<%=Lang_Ship(29)%>');
		return false;
	}
	if (CheckEmpty('s_name')){ShowMessage('s_name','<%=Lang_Ship(30)%>');return false;}
	if (CheckEmpty('s_no')){ShowMessage('s_no','<%=Lang_Ship(31)%>');return false;}
	if (CheckEmpty('s_fei1')){ShowMessage('s_fei1','<%=Lang_Ship(32)%>');return false;}
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="edit" class="classtable">
<form name="add" method="post" action="?action=edit_ok" onSubmit="return CheckForm(this);">
<tr>
	<td height="30" align="left" class="classhead"><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"><input type="hidden" name="id" value="<%= rs("s_id") %>"></td>
	<td class="classhead" align="right">
	<%=QuickMenu("","")%>
	</td>
 </tr>
<tr>
    <td class="classtop" height="30" colspan="2"><%=Lang_Ship(26)%></td>
</tr>
<tr class="classrow">
	<td width="15%" height="30" class="classrow"><%=Lang_Ship(16)%></td>
	<td width="85%" class="classrow"><input type="text" name="s_order_number" id="s_order_number" value="<%= rs("s_order_number") %>" size="40" class="form"> <span id="mes_s_order_number"><em><%=Lang_Ship(17)%></em></span></td>
</tr>
<tr class="classrow">
	<td height="30" class="classrow"><%=Lang_Ship(19)%></td>
	<td class="classrow"><input type="text" name="s_name" id="s_name" value="<%= rs("s_name") %>" size="40" class="form"> <span id="mes_s_name"><em><%=Lang_Ship(18)%></em></span></td>
</tr>
<tr class="classrow">
	<td height="30" class="classrow"><%=Lang_Ship(20)%></td>
	<td class="classrow"><input type="text" name="s_no" id="s_no" value="<%= rs("s_no") %>" size="40" class="form"> <span id="mes_s_no"><em><%=Lang_Ship(18)%></em></span></td>
</tr>
<tr class="classrow">
	<td height="30" class="classrow"><%=Lang_Ship(21)%></td>
	<td class="classrow"><input type="text" name="s_fei1" id="s_fei1" value="<%= rs("s_fei1") %>" size="10" class="form"> <span id="mes_s_fei1"><em><%=Lang_Ship(18)%></em></span></td>
</tr>
<tr class="classrow">
	<td height="30" class="classrow"><%=Lang_Ship(22)%></td>
	<td class="classrow"><input type="text" name="s_fei2" value="<%= rs("s_fei2") %>" size="10" class="form"> </td>
</tr>
<tr class="classrow">
	<td height="30" class="classrow"><%=Lang_Ship(23)%></td>
	<td class="classrow"><input type="text" name="s_user_name" value="<%= rs("s_user_name") %>" size="40" class="form"> </td>
</tr>
<tr class="classrow">
	<td height="30" class="classrow"><%=Lang_Ship(24)%></td>
	<td class="classrow"><input type="text" name="s_user_id" value="<%= rs("s_user_id") %>" size="40" class="form"> </td>
</tr>
<tr class="classfooter">
  <td colspan="2" height="30" 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"></td>
 </tr>
</form>
<%
Set rsdeliver = conn.execute("select deliver_code from [Lebi_deliver] where deliver_name"& LangTxt &" = '"& rs("s_name") &"'")
If Not rsdeliver.eof Then 
	response.write"<tr><td class=""classtop"" height=""30"" colspan=""2"">"& Lang_Order(198) &"</td></tr><tr><td class=""classrow"" colspan=""2"">"
	If InStr("|ems|,|shentong|,|shunfeng|,|youzhengguonei|","|"& rsdeliver(0) &"|") > 0 Then 
		response.write("<form>"& Lang_Order(196) &"<input name=""valicode"" type=""text"" id=""valicode"" size=""5"" class=""form"" /> <img src=""http://api.kuaidi100.com/verifyCode?id="& Split(sys_kuaidi100,"|")(1) &"&com="& rsdeliver(0) &""" align=""absmiddle"" /> <input type=""submit"" name=""submit"" value="""& Lang_Order(197) &""" class=""button"" /><input type=""hidden"" name=""id"" value="""& id &""" /><input type=""hidden"" name=""order_number"" value="""& order_number &""" /><input type=""hidden"" name=""action"" value=""edit"" /></form>")
	End If 
	response.write Kuadi100API(rsdeliver(0),rs("s_no"),request("valicode")) &"</td></tr>"
End If 
rsdeliver.close : Set rsdeliver = Nothing
%>
</table>
<script>tdshow("edit");</script>
<%
End If
rs.close : Set rs = Nothing
end Sub

Sub csv()
%>
<script language="javascript" type="text/javascript">
function checkform(theform)
{
	if (!isEmpty(theform.uploadfile,'请选择数据文件！')) return false;
	$("#divposting").show();
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="form" class="classtable">
<form action="?action=csv_ok" method="post" name="form2" onsubmit="return checkform(this);" enctype="multipart/form-data">
<tr>
  <td height="30" align="left" class="classhead"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " align="absmiddle" title=" <%=Lang_sys(1)%> ">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
  <td align="right" class="classhead">
  <%=QuickMenu("","")%>
  </td>
 </tr>
<tr>
   <td class="classtop" height="30" colspan="2">导入</td>
</tr>
  <tr class="classrow">
    <td width="15%" height="30" class="classrow">
		数据文件：
    </td>
    <td width="85%" class="classrow">
			<input type="file" name="uploadfile" id="uploadfile" size="15" class="form">
			<input type="hidden" name="uploadcode" value="<%=postrannum%>">
    </td>
</tr>
<tr>
  <td colspan="2" height="30" align="left" class="classfooter"><input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " align="absmiddle" title=" <%=Lang_sys(1)%> ">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
 </tr>
</form>
<tr>
<td colspan="2" class="classfaq">
  <div class="faq_main">
  <p class="faq_title"><%=Lang_sys(49)%></p>
   <a href="excel/template/shipment.csv" target="_blank"><u>CSV模板下载</u></a>
  </div>
</td>
</tr>
</table>
<DIV id="divposting" style="display:none"><span class="loadmes"><%=Lang_sys(103)%></span></DIV>
<script>tdshow("form");</script>
<%
End Sub 

Sub DelFile(FileName)
		Dim fso,path
		Set fso = Server.CreateObject("scripting.filesystemobject")
		If InStr(FileName, ":") <> 0 Then path = FileName Else path = Server.MapPath(FileName)
		if fso.fileexists(path) then fso.DeleteFile (path)
		Set fso = Nothing
End Sub
%>