<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--#include file="inc/Page_cls.asp"-->
<%
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 Admin_deliver_area.asp
'* 最后更新 2013-6-13 by 56770.kingdge
'* 历史更新 2007-3-10 by 56770.icystar
'*****************************************
Dim admin_flag:admin_flag=",8.5,"
Dim id : id = safereplace(request("id"))
Dim area_id : area_id = CheckNum(request("area_id"),0)
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_deliver.inc"
CurrentId = 5
CurrentUrl = "admin_deliver.asp"
LB_Head()
LB_Menu()
action = request("action")
%>
<div class="tabmenu mainwidth">
      <ul>
        <li><a href="Admin_deliver.asp"><span><%=Lang_Menu(136)%></span></a></li>
        <li class="current"><a href="Admin_deliver_area.asp"><span><%=Lang_Menu(137)%></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 request("action")
			   Case "edit" : edit()
			   Case "add_ok" : add_ok()
			   Case "add_area" : add_area()
			   Case "addlist" : addlist()
			   Case "get_area2" : get_area2(CheckNum(request("parentid"),0))
			   Case "del_deliver" : del_deliver()
			   Case "addareasub" : addareasub()
			   Case "addarea_ok" : addarea_ok()
			   Case "del_area" : del_area()
			   Case Else
					main()
		End Select
End If
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()

Sub addarea_ok()
        If OnlyRead = 1 Then OnlyReadMessage()
		parent_id = CheckNum(request("parent_id"),0)
		area_name = safereplace(request("area_name"& lang))
		area_order = CheckNum(request("area_order"),0)
		ShowLang = replace(safereplace(request("ShowLang"))," ","")
		istrue = 1
		If area_id = 0 Then
				m_t=Lang_sys(45)
				set rs=server.CreateObject("adodb.recordset")
				rs.open "select * from [Lebi_deliver_area] where parent_id="&parent_id&" and area_name='"&area_name&"'",conn,1,3
				If rs.eof Then
						rs.addnew
						For LangT = 1 To TotalLang
								rs("area_name" & LanguageTxt(LangT))=trim(safereplace(request("area_name" & LanguageTxt(LangT))))
						Next
						rs("parent_id") = parent_id
						rs("area_order") = area_order
						rs("ShowLang") = ShowLang
						rs.update
						ManageLog Lang_Deliver(21) &" ["&area_name&"]"
						m_s="·"& Lang_sys(44)
				Else
						m_s="·"& Lang_Deliver(22)
						istrue = 0
				End If
		Else
				set rs=server.CreateObject("adodb.recordset")
				rs.open "select * from [Lebi_deliver_area] where id="&area_id&"",conn,1,3
				If Not rs.eof Then
						For LangT = 1 To TotalLang
								rs("area_name" & LanguageTxt(LangT))=trim(safereplace(request("area_name" & LanguageTxt(LangT))))
						Next
						rs("parent_id") = parent_id
						rs("area_order") = area_order
						rs("ShowLang") = ShowLang
						rs.update
				End If
				ManageLog Lang_Deliver(23) &" ["&area_name&"]"
				m_t=Lang_sys(48)
				m_s="·"& Lang_sys(47)
		End If
		rs.close : set rs=Nothing
		m_u="?page=" & request("page")& "&keyword=" & request("keyword")& "&parentid=" & request("parentid")& "&Lang="& request("lang")
		m_time="2"
		Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,istrue)
		response.End
End Sub

Sub del_area()
        If OnlyRead = 1 Then OnlyReadMessage()
		if id="" then
				response.write"<SCRIPT language=JavaScript>alert('"& Lang_sys(41) &"');javascript:history.go(-1)</SCRIPT>"
				response.end
		end If
		If Right(id,1) = "," Then id = id &"0"
		sql="select id,parent_id from [Lebi_deliver_area] where id in ("&id&")"
		set rs=conn.execute(sql)
		If Not rs.eof Then
				Do While Not rs.eof
					delid=rs("id")
					conn.execute "delete from [Lebi_deliver_area] where id="&delid&""
					conn.execute "delete from [Lebi_deliver_list] where area_id="&delid&""
					rs.movenext
				Loop
		End If
		rs.close:Set rs=Nothing
		ManageLog Lang_Deliver(24) &" ["&delid&"]"
		m_t=Lang_sys(43)
		m_s="·"& Lang_sys(42)
		m_u="?page=" & request("page")& "&keyword=" & request("keyword")& "&parentid=" & request("parentid")& "&Lang="& request("lang")
		m_time="2"
		Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,1)
End Sub

sub main()
		page = CheckNum(request("page"),1)
		parentid = CheckNum(request("parentid"),0)
		keyword=safereplace(request("keyword"))
		lang = safereplace(request("lang"))
		Showlang = safereplace(request("Showlang"))
		If lang = "" Then lang = LanguageTxt(0)
		Dim ors
		Set ors=new Cls_vbsPage
		Set ors.Conn=conn
		With ors
		.PageSize=15
		.PageName="Page"
		If IsSqlDataBase = 0 Then
				.DbType="AC"
		Else
				.DbType="MSSQL"
		End If
		.RecType=-1
		.Pkey="a.id"
	   .Field="a.id,a.area_name"& lang &",a.area_order,(select top 1 area_id from [Lebi_deliver_list] where area_id = a.id) as area_id,a.parent_id,a.ShowLang"
	   .Table="[Lebi_deliver_area] as a"
'		Select Case IsSqlDataBase
'			   Case "0"
'				   .Field="a.id,a.area_name"& lang &",a.area_order,(select top 1 area_id from [Lebi_deliver_list] where area_id = a.id) as area_id,a.parent_id"
'				   .Table="[Lebi_deliver_area] as a"
'			   Case "1"
'				   .Field="distinct a.id,a.area_name"& lang &",a.area_order,b.area_id,a.parent_id"
'				   .Table="[Lebi_deliver_area] as a left join ([Lebi_deliver_list] as b) on a.id=b.area_id"
'		End Select
		Select Case parentid
			   Case "0" sql = "a.parent_id=0"
			   Case "9999" sql = "1=1"
			   Case Else
			   sql = "a.parent_id="& parentid
		End Select
		If ShowLang <> "" Then sql = sql &" and a.ShowLang like '%"& ShowLang &"%'"
		if keyword<>"" then sql=sql&" and (a.area_name"& lang &" like '%"&keyword&"%')"
		.Condition=sql
		.OrderBy="a.area_order desc,a.id asc"
		End With
		DataCount=ors.RecCount()
		DataList=ors.ResultSet()
	%>
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable-top">
	<tbody>
	<form name="form" action="?" method="get">
	<tr>
	<td height="30" align="left" class="classhead">
	<table border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td>
	<select name="lang">
	<option value="" selected>┌ <%=Lang_sys(67)%></option>
	<%For LangT = 1 To TotalLang%>
	<option value="<%= LanguageTxt(LangT) %>"<%=judge2(LanguageTxt(LangT),Lang)%>>├ <%= LanguageName(LangT) %></option>
	<%Next%>
	</select></td>
	<td style="padding-left:5px;">
	<select name="Showlang">
	<option value="" selected>┌ <%=Lang_Deliver(25)%></option>
	<%For LangT = 1 To TotalLang%>
	<option value="<%= LanguageName(LangT) %>"<%=judge2(LanguageName(LangT),ShowLang)%>>├ <%= LanguageName(LangT) %></option>
	<%Next%>
	</select></td>
	<td style="padding-left:5px;"><input name="keyword" type="text" value="<%=keyword%>" class="form_query" size="15"><input name="Submit" type="submit" value="" title="<%=Lang_sys(25)%>" align="absmiddle" class="btn_query"><%If parentid <> 0 And parentid <> 9999 Then%><input name="parentid" type="hidden" value="<%=parentid%>"><%Else%><input name="parentid" type="hidden" value="9999"><%End If%></td>
	</tr>
	</table>
	</td>
	<td height="30" align="right" class="classhead">
	<%=QuickMenu("Admin_deliver.asp|"& Lang_Menu(136) &"","Admin_bank.asp|"& Lang_Menu(138) &"")%>
	</td>
	</tr>
	</form>
	<%If parentid <> 0 And parentid <> 9999 Then%>
	<tr>
	<td height="30" align="left" colspan="2" class="classhead"><img src="images/bt_arr.gif" align="absmiddle" />
	<%
			Set rs = conn.execute("select area_name from [Lebi_deliver_area] where id = "& parentid &"")
			If Not rs.eof Then
					response.write(rs(0))
			End If
			rs.close : Set rs = Nothing
	%>
	</td>
	</tr>
	<%End If%>
	</tbody>
	</table>
	<table width="100%" border="0" cellspacing="0" cellpadding="0" id="classtable" class="classtable2">
	<form name="Lebi" method="post" action="">
	<tr>
	<td align="left" colspan="2" class="classhead" height="30">
	 <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="image" border="0" title=" <%=Lang_sys(5)%> " onclick="location.href='?action=addareasub';return false;" src="lang/<%=LangFilePath%>/images/bt_add.gif" align="absmiddle">
	 <input name="page" type="hidden" value="<%=page%>">
	 <input name="keyword" type="hidden" value="<%=keyword%>">
	 <input name="lang" type="hidden" value="<%=lang%>">
	 <input name="parentid" type="hidden" value="<%=parentid%>">
	 <input type="hidden" name="action" value="del_area">
	</td>
	<td height="30" class="classhead" align="right" colspan="4"><%=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="35%" class="classtop"><%=Lang_Deliver(26)%></td>
	<td width="15%" class="classtop"><%=Lang_Deliver(7)%></td>
	<td width="20%" class="classtop"><%=Lang_Deliver(25)%></td>
	<td width="10%" class="classtop"><%=Lang_Deliver(27)%></td>
	<td width="15%" class="classtop"><%=Lang_Deliver(28)%></td>
	</tr>
<%
If DataCount >0 Then
		For i = 0 To Ubound(DataList,2)
%>
	<tr class="classrow">
	<td height="30" class="classrow"><input name="id" type="checkbox" value="<%=DataList(0,i)%>"></td>
	<td class="classrow"><%If DataList(4,i) = 0 Then%>
	<A HREF="?parentid=<%=DataList(0,i)%>"><%=DataList(1,i)%></A>
	<%Else%>
	<A HREF="?parentid=<%=DataList(0,i)%>"><%=DataList(1,i)%></A>
	<%End If%></td>
	<td class="classrow"><%
	If Trim(DataList(3,i)) = "" Or IsNull(DataList(3,i)) Then
			response.write "<A HREF=""?action=addlist&area_id="&DataList(0,i)&"""><font color=#ff0000>"& Lang_Deliver(4) &"</font></A>"
	Else
			response.write "<A HREF=""?action=addlist&area_id="&DataList(0,i)&""">"& Lang_Deliver(3) &"</A>"
	End If %></td>
	<td class="classrow"><%=DataList(5,i)%>&nbsp;</td>
	<td class="classrow"><%=DataList(2,i)%></td>
	<td class="classrow">
	<%If DataList(4,i) = 0 Then%>
	<A HREF="?action=addareasub&parent_id=<%=DataList(0,i)%>&page=<%=page%>"><%=Lang_Deliver(29)%></A>&nbsp;&nbsp;|&nbsp;&nbsp;
	<%End If%>
	<a href="?action=addareasub&area_id=<%=DataList(0,i)%>&page=<%=page%>"><%=Lang_sys(51)%></a></td>
	</tr>
<%
        Next
End If
%>
	</form>
<tr>
	<td height="30" class="classfooter" align="right" colspan="7"><%=ors.ShowPageFoot(page)%></td>
</tr>
	<tr>
	  <td class="classfaq" colspan="7">
  <div class="faq_main">
  <p class="faq_title"><%=Lang_sys(49)%></p>
  <%=Lang_Deliver(30)%>
  </div>
	  </td>
	</tr>
</tbody>
</table>
<script>tdshow("classtable");</script>
	<script language="JavaScript" type="text/JavaScript">
	<!--
	var area2_div_id
	function show_area2(trid,div_id,parentid)
	{
	  if(trid.style.display=="none"){
		 trid.style.display="";
	  } else {
		 trid.style.display="none";
	  }
	  area2_div_id = div_id;
	  ajaxSub(2,'?action=get_area2&parentid='+parentid+'&t='+Math.random());
	}
	-->
	</script>
	<%
end sub

sub get_area2(parentid)
	parentid = CheckNum(parentid,0)
	area2str = "<table width=""99%"" border=""0"" cellspacing=""0"" cellpadding=""3"">"
	'sql="SELECT id,area_name,deliver_id FROM [Lebi_deliver_area] where parent_id="&parentid&" ORDER BY id"
	'sql="SELECT distinct a.id,a.area_name,b.area_id FROM [Lebi_deliver_area] as a left join ([Lebi_deliver_list] as b) on a.id=b.area_id where a.parent_id=0 ORDER BY a.id"
	If IsSqlDataBase = 1 Then
			sql="SELECT id,area_name"& lang &",area_order FROM [Lebi_deliver_area] where parent_id="&parentid&" ORDER BY area_order desc,id asc"
	Else
			sql="SELECT distinct a.id,a.area_name"& lang &",a.area_order,b.area_id FROM [Lebi_deliver_area] as a left join ([Lebi_deliver_list] as b) on a.id=b.area_id where a.parent_id="&parentid&" ORDER BY a.area_order desc, a.id asc"
	End If
	Set rs2= conn.execute(SQL)
	do while not rs2.eof
		tpstr = ""
		If IsSqlDataBase = 1 Then
			Set rss = conn.execute("select area_id from [Lebi_deliver_list] where area_id = "& rs2("id") &"")
			If rss.eof Then
				tpstr = "<A HREF=""?action=addlist&area_id="&rs2("id")&"""><font color=#ff0000>"& Lang_Deliver(4) &"</font></A>"
			Else
				tpstr = "<A HREF=""?action=addlist&area_id="&rs2("id")&""">"& Lang_Deliver(3) &"</A>"
			End If
			rss.close : Set rss = Nothing
		Else
			If Trim(rs2("area_id")) = "" Or IsNull(rs2("area_id")) Then
				tpstr = "<A HREF=""?action=addlist&area_id="&rs2("id")&"""><font color=#ff0000>"& Lang_Deliver(4) &"</font></A>"
			Else
				tpstr = "<A HREF=""?action=addlist&area_id="&rs2("id")&""">"& Lang_Deliver(3) &"</A>"
			End If
		End If
		area2str = area2str & "<tr class=""classrow""><td width=5% height=30  class=""classrow""><input name=""id"" type=checkbox value="&rs2("id")&"></td>" &_
		"<td width=50% class=""classrow"">├ "&rs2(1)&"</A></td>" &_
		"<td width=15% class=""classrow"">&nbsp;"&tpstr&"</td>" &_
		"<td width=20% class=""classrow"">&nbsp;&nbsp;"&rs2("area_order")&"</td>" &_
		"<td width=20% class=""classrow""><a href=""?action=addareasub&area_id="&rs2("id")&"&page="&page&""">"& Lang_sys(51) &"</a></td></tr>"
		rs2.movenext
	Loop
	rs2.close:set rs2=Nothing
	area2str = area2str & "</table>"
	response.write(area2str)
	response.End
End sub

Sub del_deliver()
	if id="" then
			response.write"<SCRIPT language=JavaScript>alert('"& Lang_sys(41) &"');javascript:history.go(-1)</SCRIPT>"
			response.end
	end If
	If Right(id,1) = "," Then id = id &"0"
	sql="select id from [Lebi_deliver_list] where id in ("&id&") "
	set rs=conn.execute(sql)
	If Not rs.eof Then
			Do While Not rs.eof
			conn.execute "delete from [Lebi_deliver_list] where id="&rs("id")&""
			rs.movenext
			Loop
	End If
	rs.close:Set rs=Nothing
	ManageLog Lang_Deliver(5) &" ["&id&"]"
	url="?action=addlist&area_id="&area_id
	m_t=Lang_sys(43)
	m_s="·"& Lang_sys(42)
	m_u=url
	m_time="2"
	Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,1)
End Sub

Sub addlist()
	%>
	<table width="100%" border="0" cellspacing="0" cellpadding="0" id="classtable" class="classtable">
	<form action="?" method="post" name="form">
	<tr>
	<td align="left" colspan="2" class="classhead" height="30">
	<input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input name="submit" onclick="todels('?action=del_deliver&area_id=<%=area_id%>');return false;" type="image" src="lang/<%=LangFilePath%>/images/bt_delete.gif" value=" <%=Lang_sys(15)%> " align="absmiddle"><input name="area_id" type="hidden" value="<%=area_id%>"><input type="hidden" name="action" value="add_ok">
	</td>
	<td colspan="6" align="right" class="classhead">
	<%=QuickMenu("","")%>
	</td>
	</tr>
	<tr>
	<td width="5%" height="30" class="classtop" title=" <%=Lang_sys(4)%> " onclick="location.href='javascript:selectall();';return false;" style="cursor:pointer;"><%=Lang_sys(50)%></td>
	<td width="15%" class="classtop"><%=Lang_Deliver(7)%></td>
	<!--<td width="10%" class="classtop"><%=Lang_Deliver(31)%></td>-->
	<td width="12%" class="classtop"><%=Lang_Deliver(32)%></td>
	<td width="12%" class="classtop"><%=Lang_Deliver(33)%></td>
	<td width="12%" class="classtop"><%=Lang_Deliver(34)%></td>
	<td width="12%" class="classtop"><%=Lang_Deliver(49)%></td>
	<td width="12%" class="classtop"><%=Lang_Deliver(50)%></td>
	<td width="12%" class="classtop"><%=Lang_Deliver(27)%></td>
	</tr>
	<%
	sql = "select id,deliver_id,is_end_pay,basic_weight_price,basic_weight,overstep_price,last_price,free_price,d_order from [Lebi_deliver_list] where area_id="& CLng(area_id) &" order by d_order desc"
	Set rs=Server.CreateObject("ADODB.RecordSet")
	rs.open sql, conn, 1, 1
	if rs.eof and rs.bof then
	response.write "<tr class=classrow align='center'><td colspan=8 height=30 class=classrow>"& Lang_Deliver(35) &"</td></tr>"
	Else
		Dim i:i=0
		do while not rs.eof
		%>
			<tr class="classrow">
			<td height="30" class="classrow"><input name="id" type="checkbox" value="<%=rs("id")%>"><input name="d_id" type="hidden" value="<%=rs("id")%>"></td>
			<td class="classrow">
			<select size="1" name="deliver_id"><%=dbHTMLSelect("select id,deliver_name from [Lebi_deliver] order by id","deliver_name","id",rs("deliver_id"))%></select></td>
			<!--<td class="classrow">
			<select size="1" name="is_end_pay">
			<option value="0"><%=Lang_Deliver(36)%></option>
			<option value="1" <%If rs("is_end_pay")=1 Then response.write("selected")%>><%=Lang_Deliver(37)%></option>
			</select></td>-->
			<input type="hidden" name="is_end_pay" value="0">
			<td class="classrow"><input type="text" name="basic_weight_price" class="form" value="<%=rs("basic_weight_price")%>" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');"></td>
			<td class="classrow"><input type="text" name="basic_weight" class="form" value="<%=rs("basic_weight")%>" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');"></td>
			<td class="classrow"><input type="text" name="overstep_price" class="form" value="<%=rs("overstep_price")%>" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');"></td>
			<td class="classrow"><input type="text" name="last_price" class="form" value="<%=rs("last_price")%>" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');"></td>
			<td class="classrow"><input type="text" name="free_price" class="form" value="<%=rs("free_price")%>" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');"></td>
			<td class="classrow"><input type="text" name="d_order" class="form" value="<%=rs("d_order")%>" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');"></td>
			</tr>
		<%
			rs.movenext
			i = i+1
		loop
		%>
		<%
	end if
	rs.close:set rs=nothing
%>
	<tr>
	<td align="left" colspan="8" class="classfooter" height="30">
	<input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input name="submit" onclick="todels('?action=del_deliver&area_id=<%=area_id%>');return false;" type="image" src="lang/<%=LangFilePath%>/images/bt_delete.gif" value=" <%=Lang_sys(15)%> " align="absmiddle">
	</td>
	</tr>
	</form>
	</table>
	</div>
	</div>
	<div class="mainbody-block">
	<div class="mainbody-block2">
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable">
	<form name="form3" method="post" action="?" onSubmit="return CheckForm();">
	<tr>
	<td align="left" colspan="8" class="classhead" height="30">
	<input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" title=" <%=Lang_sys(1)%> " align="absmiddle"><input type="hidden" name="area_id" value="<%=area_id%>"><input type="hidden" name="action" value="add_ok">
	</td>
	</tr>
	<tr>
	<td width="5%" height="30" class="classtop">&nbsp;&nbsp;&nbsp;&nbsp;</td>
	<td width="15%" class="classtop"><%=Lang_Deliver(7)%></td>
	<!--<td width="10%" class="classtop"><%=Lang_Deliver(31)%></td>-->
	<td width="12%" class="classtop"><%=Lang_Deliver(32)%></td>
	<td width="12%" class="classtop"><%=Lang_Deliver(33)%></td>
	<td width="12%" class="classtop"><%=Lang_Deliver(34)%></td>
	<td width="12%" class="classtop"><%=Lang_Deliver(49)%></td>
	<td width="12%" class="classtop"><%=Lang_Deliver(50)%></td>
	<td width="12%" class="classtop"><%=Lang_Deliver(27)%></td>
	</tr>
	<tr class="classrow">
	<td height="30" class="classrow">&nbsp;</td>
	<td class="classrow">
			<select size="1" name="deliver_id"><%=dbHTMLSelect("select id,deliver_name from [Lebi_deliver] order by id","deliver_name","id","")%></select></td>
	<!--<td class="classrow">
			<select size="1" name="is_end_pay">
			<option value="0"><%=Lang_Deliver(36)%></option>
			<option value="1"><%=Lang_Deliver(37)%></option>
			</select></td>-->
	<input type="hidden" name="is_end_pay" value="0">
	<td class="classrow">
	<input type="text" name="basic_weight_price" class="form" value="" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');"></td>
	<td class="classrow">
	<input type="text" name="basic_weight" class="form" value="" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');"></td>
	<td class="classrow">
	<input type="text" name="overstep_price" class="form" value="" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');"></td>
	<td class="classrow"><input type="text" name="last_price" class="form" value="" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');"> <img src="images/help.gif" align="absmiddle" title="<%=Lang_Deliver(51)%>" /></td>
	<td class="classrow"><input type="text" name="free_price" class="form" value="" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');"> <img src="images/help.gif" align="absmiddle" title="<%=Lang_Deliver(52)%>" /></td>
	<td class="classrow"><input type="text" name="d_order" class="form" value="0" size="5" onkeyup="value=value.replace(/[^\d\.]/g,'');"></td>
	</tr>
	</form>
	</table>
	<script>tdshow("classtable");</script>
	<SCRIPT LANGUAGE="JavaScript">
	<!--
	function CheckForm()
	{
		if(form3.basic_weight_price.value=="")
		{
			alert("<%=Lang_Deliver(38)%>");
			form3.basic_weight_price.focus();
			return false;
		}
		if(form3.basic_weight.value=="")
		{
			alert("<%=Lang_Deliver(39)%>");
			form3.basic_weight.focus();
			return false;
		}
		if(form3.overstep_price.value=="")
		{
			alert("<%=Lang_Deliver(40)%>");
			form3.overstep_price.focus();
			return false;
		}
		return true;
	}
	//-->
	</SCRIPT>
	<%
End Sub

Sub addareasub()
	Dim parent_id : parent_id = CheckNum(request("parent_id"),0)
	If area_id <> 0 Then
		set rs = conn.execute("select top 1 * from [Lebi_deliver_area] where id="&area_id&"")
		Parent_id = rs("parent_id")
	End If
	If Not IsNumeric(parent_id) Or parent_id="" Then parent_id=0
	If Not IsNumeric(area_order) Or area_order="" Then area_order=0
	%>
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="classtable">
	<form name="form4" method="post" action="?" onSubmit="return CheckForm();">
	<tr>
	<td height="30" class="classhead" align="left">
	<input name="I6" 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" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"><input type="hidden" name="area_id" value="<%=area_id%>"><input type="hidden" name="action" value="addarea_ok"></td>
	<td align="right" class="classhead">
	<%=QuickMenu("","")%>
	</td>
	</tr>
	<tr>
	<td height="30" colspan="2" class="classtop"><%
	if area_id <> 0 Then
			response.write Lang_Deliver(42)
	Else
			response.write Lang_Deliver(41)
	End If
	%></td>
	</tr>
	<tr>
	<td class="classbg" colspan="2">
	<ul id="tablist">
	   <%For LangT = 1 To TotalLang%>
	   <li<%If LangT = 1 Then response.write(" class=""selected""") End If%>><a rel="tcontent<%= LangT %>" style="CURSOR:hand;"><%= LanguageName(LangT) %></a></li>
	   <%Next%>
	</ul>
	<div id="tabcontentcontainer">
	<%For LangT = 1 To TotalLang%>
	   <div id="tcontent<%= LangT %>" class="tabcontent">
	   <table cellspacing="0" cellpadding="4" width="100%" border="0" id="classtable_<%= LangT %>">
		<tr class="classrow">
		<td width="15%" height="30" class="classrow"><%=Lang_Deliver(43)%></td>
		<td class="classrow" align="left">
		<input type="text" name="area_name<%= LanguageTxt(LangT) %>" class="form" value="<%If area_id <> 0 Then response.write rs("area_name" & LanguageTxt(LangT))%>" size="25"></td>
		</tr>
		</table>
		</div>
		<script>tdshow("classtable_<%= LangT %>");</script>
	<%Next%>
	</div>
	<script>showtabcontent("tablist");</script>
	<ul id="tablistmain">
	   <li class="selected"><a rel=""><%=Lang_sys(66)%></a></li>
	</ul>
	<div id="tabcontentcontainer">
	<table cellspacing="0" cellpadding="4" width="100%" border="0" id="classtable">
		<tr class="classrow">
		<td height="30" width="15%" class="classrow"><%=Lang_Deliver(44)%></td>
		<td width="85%" class="classrow" align="left">
				<select id="parent_id" name="parent_id" onChange="Updateshowlang()">
				<option value="0"><%=Lang_Deliver(45)%></option><% check_deliver_area (0),ii,","& parent_id &"," %>
				</select></td>
		</tr>
		<tr class="classrow">
		<td height="30" class="classrow"><%=Lang_Deliver(46)%></td>
		<td class="classrow" align="left">
		<input type="text" name="area_order" class="form" value="<%If area_id <> 0 Then response.write rs("area_order" & LanguageTxt(LangT))%>" size="10" onkeyup="value=value.replace(/[^\d]/g,'');"></td>
		</tr>
		</table>
		<div id="showlangbox">
		<table cellspacing="0" cellpadding="4" width="100%" border="0">
			<tr class="classrow">
			<td height="30" width="15%" class="classrow"><%=Lang_Deliver(47)%></td>
			<td width="85%" class="classrow" align="left">
			<%
			Set Lang = conn.execute("Select l_name from [Lebi_Language] where l_state = 1 order by l_default desc,l_order desc")
			Do While Not Lang.eof
			%>
			<input type="checkbox" name="ShowLang" value="<%=Lang(0)%>" <%If area_id <> 0 Then response.write judge(rs("showlang"),lang(0)) End If%>><%=Lang(0)%>
			<%
			Lang.movenext
			Loop
			Lang.close : Set Lang = Nothing
			%></td>
			</tr>
		</table>
		</div>
		</div>
		<script>tdshow("classtable");</script>
	</td>
	</tr>
	<tr class="classfooter">
	<td height="30" colspan="2" class="classfooter" align="left">
	<input name="I4" 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" border="0" title=" <%=Lang_sys(2)%> " onclick="reset();return false;" align="absmiddle"></td>
	</tr>
	</form>
	</table>
	<SCRIPT LANGUAGE="JavaScript">
	<!--
	function CheckForm()
	{
		if(form4.area_name.value=="")
		{
			alert("<%=Lang_Deliver(48)%>");
			form4.area_name.focus();
			return false;
		}
		return true;
	}
	function Updateshowlang()
	{
		var parent_id = document.getElementById('parent_id').value;
		if (parent_id > 0)
		{
			document.getElementById('showlangbox').style.display = 'none';
		}else{
		document.getElementById('showlangbox').style.display = 'block';
		}
	}
	//-->
	</SCRIPT>
	<%
End Sub

Sub add_ok()
		'deliver_id,is_end_pay,basic_weight_price,basic_weight,overstep_price
	'	If deliver_id = "" Then
	'			response.write"<SCRIPT language=JavaScript>alert('请填写方式名称!');javascript:history.go(-1)</SCRIPT>"
	'			response.End
	'	End If
	'	If deliver_price = "" Then
	'			response.write"<SCRIPT language=JavaScript>alert('请填写定额运费!');javascript:history.go(-1)</SCRIPT>"
	'			response.End
	'	End If
		istrue = 1
		id=Replace(Safereplace(request("d_id"))," ","")
		If id = "" Then
				deliver_id = CheckNum(request("deliver_id"),0)
				is_end_pay = CheckNum(request("is_end_pay"),0)
				basic_weight_price = CheckNum(request("basic_weight_price"),0)
				basic_weight = CheckNum(request("basic_weight"),0)
				overstep_price = CheckNum(request("overstep_price"),0)
				d_order = CheckNum(request("d_order"),0)
				last_price = CheckNum(request("last_price"),0)
				free_price = CheckNum(request("free_price"),0)
				m_t=Lang_sys(45)
				set rs=server.CreateObject("adodb.recordset")
				sqlm="select * from [Lebi_deliver_list] where area_id="&area_id&" and deliver_id="&deliver_id
				rs.open sqlm,conn,1,3
				If rs.eof Then
						rs.addnew
						rs("area_id") = area_id
						rs("deliver_id") = deliver_id
						rs("is_end_pay") = is_end_pay
						rs("basic_weight_price") = basic_weight_price
						rs("basic_weight") = basic_weight
						rs("overstep_price") = overstep_price
						rs("d_order") = d_order
						rs("last_price") = last_price
						rs("free_price") = free_price
						rs.update
						ManageLog Lang_Deliver(4)
						m_s="·"& Lang_sys(44)
				Else
						m_s="·"& Lang_Deliver(2)
						istrue = 0
				End If
				rs.close : set rs=nothing
		Else
				deliver_id=Replace(Safereplace(trim(request("deliver_id")))," ","")
				is_end_pay=Replace(Safereplace(trim(request("is_end_pay")))," ","")
				basic_weight_price=Replace(Safereplace(trim(request("basic_weight_price")))," ","")
				basic_weight=Replace(Safereplace(trim(request("basic_weight")))," ","")
				overstep_price=Replace(Safereplace(trim(request("overstep_price")))," ","")
				d_order=Replace(Safereplace(trim(request("d_order")))," ","")
				last_price=Replace(Safereplace(trim(request("last_price")))," ","")
				free_price=Replace(Safereplace(trim(request("free_price")))," ","")
				If UBound(Split(id,",")) = 0 Then
						set rs=server.CreateObject("adodb.recordset")
						rs.open "select * from [Lebi_deliver_list] where id ="& id, conn, 1, 3
								rs("deliver_id") = deliver_id
								rs("is_end_pay") = is_end_pay
								rs("basic_weight_price") = basic_weight_price
								rs("basic_weight") = basic_weight
								rs("overstep_price") = overstep_price
								rs("d_order") = d_order
								rs("last_price") = last_price
								rs("free_price") = free_price
						rs.update
						rs.close:set rs=Nothing
				Else
				For i = 0 To UBound(Split(id,","))
						set rs=server.CreateObject("adodb.recordset")
						rs.open "select * from [Lebi_deliver_list] where id=" &Split(id,",")(i), conn, 1, 3
								rs("deliver_id") = Split(deliver_id,",")(i)
								rs("is_end_pay") = Split(is_end_pay,",")(i)
								rs("basic_weight_price") = Split(basic_weight_price,",")(i)
								rs("basic_weight") = Split(basic_weight,",")(i)
								rs("overstep_price") = Split(overstep_price,",")(i)
								rs("d_order") = Split(d_order,",")(i)
								rs("last_price") = Split(last_price,",")(i)
								rs("free_price") = Split(free_price,",")(i)
						rs.update
						rs.close:set rs=Nothing
				Next
				End If
				ManageLog Lang_Deliver(3)
				m_t=Lang_sys(48)
				m_s="·"& Lang_sys(47)
		End If
		m_u="?action=addlist&area_id="&area_id
		m_time="2"
		Call Up_mes(m_t,m_s,0,m_u,0,0,m_time,istrue)
		response.End
End Sub
sub check_deliver_area(a,b,c)
		sql="select id,area_name"& lang &",parent_id from [Lebi_deliver_area] where parent_id = "& a &" order by area_order desc,id asc"
		Set Rs1=Conn.Execute(sql)
		If Not Rs1.eof Then
			sortdata = rs1.getrows()
			Issortdata = 1
		End If
		Rs1.close : Set Rs1 = Nothing
		If Issortdata = 1 Then
			For ii = 0 To UBound(sortdata,2)
				If a = 0 Then
						Response.write("<option value='"& clng(sortdata(0,ii)) &"'")
				if instr(c,","& sortdata(0,ii) &",") > 0  Then Response.write("Selected")
						Response.write(">+ "& sortdata(1,ii) &"</option>")
				Else
						Response.write("<option value='"& clng(sortdata(0,ii)) &"'")
				If instr(c,","& sortdata(0,ii) &",") > 0 Then Response.write("Selected")
						Response.write(">"& tmp(b,"├ ") &" "& sortdata(1,ii) &"</option>")
				End If
				if sortdata(2,ii)=0 Then
					b=b+1
					check_deliver_area sortdata(0,ii),b,c
					b=b-1
				End If
			Next
		End If
end Sub
%>
<SCRIPT LANGUAGE="JavaScript">
<!--
function subedit(sid,area_id)
{//id,deliver_id,is_end_pay,basic_weight_price,basic_weight,overstep_price
	if(document.getElementsByName('basic_weight_price')[sid].value=="")
	{
		alert("<%=Lang_Deliver(38)%>");
		document.getElementsByName('basic_weight_price')[sid].focus();
		return false;
	}
	if(document.getElementsByName('basic_weight')[sid].value=="")
	{
		alert("<%=Lang_Deliver(39)%>");
		document.getElementsByName('basic_weight')[sid].focus();
		return false;
	}
	if(document.getElementsByName('overstep_price')[sid].value=="")
	{
		alert("<%=Lang_Deliver(40)%>");
		document.getElementsByName('overstep_price')[sid].focus();
		return false;
	}

	var substr;
	substr = 'id='+ document.getElementsByName('id')[sid].value;
	substr = substr + '&deliver_id='+ document.getElementsByName('deliver_id')[sid].value;
	substr = substr + '&is_end_pay='+ document.getElementsByName('is_end_pay')[sid].value;
	substr = substr + '&basic_weight_price='+ document.getElementsByName('basic_weight_price')[sid].value;
	substr = substr + '&basic_weight='+ document.getElementsByName('basic_weight')[sid].value;
	substr = substr + '&overstep_price='+ document.getElementsByName('overstep_price')[sid].value;
	substr = substr + '&last_price='+ document.getElementsByName('last_price')[sid].value;
	substr = substr + '&free_price='+ document.getElementsByName('free_price')[sid].value;
	substr = substr + '&d_order='+ document.getElementsByName('d_order')[sid].value;
	location = "?action=add_ok&"+ substr + '&area_id='+ area_id;
	//alert(substr);
	return false;
}
//-->
</SCRIPT>