<!--#include file="../Conn.asp"-->
<!--#include file="../KS_Cls/Kesion.CommonCls.asp"-->
<!--#include file="../KS_Cls/Kesion.EscapeCls.asp"-->
<%
response.cachecontrol="no-cache"
response.addHeader "pragma","no-cache"
response.expires=-1
response.expiresAbsolute=now-1
Response.CharSet="gb2312"
Dim KS:Set KS=New PublicCls
call delivery()
Set KS=Nothing

sub delivery()
  If KS.IsNul(Request.ServerVariables("HTTP_REFERER")) Then Exit Sub
  dim expressid:expressid=KS.ChkClng(KS.S("expressid"))
  Dim City:City=UnEscape(KS.S("City"))
  If expressid=0 Or KS.IsNul(City) Then KS.Die Escape("error|参数出错！")
  If DataBaseType=1 Then 
  sql="select top 1 * From KS_Delivery Where ExpressID="& expressid &" and (convert(varchar(200),tocity)='全国统一运费' or convert(varchar(200),tocity)='' or tocity is null)" 
  Else 
  sql="select top 1 * From KS_Delivery Where ExpressID="& expressid &" and (tocity='全国统一运费' or tocity='')" 
  End If
  set rs = Server.CreateObject("ADODB.recordset")
  rs.open sql,conn,1,1
  if not rs.eof then
    KS.Die Escape("success|首重：<span>"& formatnumber(round(rs("fweight"),2),2,-1) & "</span> kg 首重价格：<span>" & formatnumber(rs("carriage"),2,-1) & "</span> 元 续重价格：<span>" & formatnumber(round(rs("C_fee")/rs("W_fee"),2),2,-1)&" </span>元/kg" & "")
	RS.Close : Set RS=Nothing
  end if
  rs.close
  sql="select Top 1 * from KS_Delivery where ExpressID="& expressid &" and tocity like '%"&city&"%'"
  rs.Open sql, conn,1,1
  if not rs.EOF then
    KS.Die Escape("success|首重：<span>"& formatnumber(round(rs("fweight"),2),2,-1) & "</span> kg 首重价格：<span>" & formatnumber(rs("carriage"),2,-1) & "</span> 元 续重价格：<span>" & formatnumber(round(rs("C_fee")/rs("W_fee"),2),2,-1)&" </span>元/kg" & "")
	RS.Close : Set RS=Nothing
  End If
   sql="select Top 1 * from KS_Delivery where ExpressID="& expressid &" and (tocity='' or tocity is null)"
  set rs=conn.execute(sql)
  If RS.Eof Then
   response.write "error|你选择的路线暂时还没开通快递业务，请重新选择！"
  else  '全国统一运费
    KS.Echo Escape("success|首重：<span>"& formatnumber(round(rs("fweight"),2),2,-1) & "</span> kg 首重价格：<span>" & formatnumber(rs("carriage"),2,-1) & "</span> 元")
	If rs("W_fee")<>0 and rs("C_fee")<>0 THEN
	KS.Echo Escape(" 续重价格：<span>" & formatnumber(round(rs("C_fee")/rs("W_fee"),2),2,-1)&" </span>元/kg" & "")
	End If
  end if
  rs.close
  set rs = nothing
  conn.close
  set conn = nothing
end sub

%>