<!--#include file="Include/Const.asp" -->
<!--#include file="Include/NoHackSql.Asp" -->
<!--#include file="Include/ConnSiteData.asp" -->
<%call SiteInfo
Dim SearchTitle
if request("Range")="Product" Then
  SearchTitle="产品分类"
End If 
if request("Range")="News" Then
    SearchTitle="新闻分类"
 End If  
if request("Range")="Down" Then
    SearchTitle="下载分类"
 End If 
 if request("Range")="Others" Then
    SearchTitle="其它分类"
 end if
%>
<!--#include file="Head.Asp" -->
<div id='index_wrapper'>
<div style="clear:both;background-image:url('images/mybuzhou.jpg');width:800px;height:85px;margin-bottom:10px;" id="mySitep">
<div style="height:20px;margin-bottom:26px;text-align:right;" ><div onclick="stepcoclose()" style="width:20px;height:20px;cursor:pointer;float:right">&nbsp;</div></div>
<div style="clear:both;font-size:14px;font-weight:bold;color:#5A552B;">
<div style="width:100px;float:left;">&nbsp;</div>
<div style="width:200px;float:left;">查看今日团购价</div>
<div style="width:36px;float:left;">&nbsp;</div>
<div style="width:200px;float:left;">付款并获得优惠凭证码</div>
<div style="width:66px;float:left;">&nbsp;</div>
<div style="width:180px;float:left;">凭优惠凭证码享受超级折扣</div>
</div>
</div>
<div id=best-r class="best" style="width:586px;float:left">
<div id=best-sc>
<div class=best-tb>
<a style="width:180px;">当前位置：凭证码查询</a>
<a><%=SeoTitle%></a>
</div>
</div>
<div id=bests>

	<table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tbody>
				<tr>
					<td width="26"> </td>
					<td>
					<p>
<%=WebContent(trim(request("Keyword")))%>
					</p>
					</td>
					<td width="26"> </td>

				</tr>
				<tr>
					<td> </td>
				</tr>
			</tbody>
		</table>
</div>
</div>
<div id=best-r class="best" style="width:200px; float:right;">
<div id=best-sc>
<div class=best-tb>
<a style="width:100px;">本期其它团购</a>    
<span id="sishowsitep" onclick="stepcoclose1()" style="display:none;padding-top:7px;padding-left:6px;"><font style="color:red;">查看步骤</font></span>
</div>
</div>

<div id=bests>
<table cellpadding="0" cellspacing="0" width="100%px" style="padding:6px;">
<tr><td align="center">
<%Call ListProducts("0,",1,6,186,160,"Products")%>
</td></tr></table>
</div>
</div>

<div style="clear:both;;*display:inline;overflow:;hidden;">
</div>
<div style="float:none;height:10px;"></div>
</div></div>
</div></div>
<!--#include file="Foot.Asp"-->

<%
function WebLocation()
  WebLocation="&nbsp;当前位置：<a href=""index.asp"" class=""agray"">首页</a> - 搜索 - "&VbCrLf
  if request("Range")="Void" then
	WebLocation=WebLocation&"<center>请选择搜索范围</center>"
    exit Function
  elseif trim(request("Keyword")) ="" Then
    WebLocation=WebLocation&"<font color=""red"">关键字为空</font>"
  elseif request("Range")="Product" Then
    WebLocation=WebLocation&"产品 - 关键字[<font color=""red"">"&trim(request("Keyword"))&"</font>]"
  elseif request("Range")="News" Then
    WebLocation=WebLocation&"新闻 - 关键字[<font color=""red"">"&trim(request("Keyword"))&"</font>]"
  elseif request("Range")="Down" Then
    WebLocation=WebLocation&"下载 - 关键字[<font color=""red"">"&trim(request("Keyword"))&"</font>]"
  elseif request("Range")="Others" Then
    WebLocation=WebLocation&"其他 - 关键字[<font color=""red"">"&trim(request("Keyword"))&"</font>]"
  end if
end Function

function WebContent(Keyword)
  if Range="Void" then
	 response.write "<center>请选择搜索范围</center>"
     exit function
  end if
  dim idCount
  dim pages
      pages=12
  dim pagec
  dim page
      page=clng(request("Page"))
  dim pagenc
      pagenc=5
  dim pagenmax
  dim pagenmin
  dim pageprevious
  dim pagenext
  dim datafrom
  dim datawhere
        datafrom="LiangJing_Order"
        datawhere="where OrderNo='"&Keyword&"' and IsokMoney=true "
  dim sqlid 
  dim Myself,PATH_INFO,QUERY_STRING
      PATH_INFO = request.servervariables("PATH_INFO")
	  QUERY_STRING = request.ServerVariables("QUERY_STRING")'
      if QUERY_STRING = "" then
	    Myself = PATH_INFO & "?"
	  elseif Instr(PATH_INFO & "?" & QUERY_STRING,"Page=")=0 then
	    Myself= PATH_INFO & "?" & QUERY_STRING & "&"
	  else
	    Myself = Left(PATH_INFO & "?" & QUERY_STRING,Instr(PATH_INFO & "?" & QUERY_STRING,"Page=")-1)
	  end if
  dim taxis
      taxis="order by id desc "
  dim i
  dim rs,sql
  set rs = server.createobject("adodb.recordset")
  sql="select count(ID) as idCount from ["& datafrom &"]" & datawhere
  set rs=server.createobject("adodb.recordset")
  rs.open sql,conn,0,1
  idCount=rs("idCount")
  if(idcount>0) then
    if(idcount mod pages=0)then
	  pagec=int(idcount/pages)
   	else
      pagec=int(idcount/pages)+1
    end if
    sql="select id from ["& datafrom &"] " & datawhere & taxis
    set rs=server.createobject("adodb.recordset")
    rs.open sql,conn,1,1
    rs.pagesize = pages
    if page < 1 then page = 1
    if page > pagec then page = pagec
    if pagec > 0 then rs.absolutepage = page
    for i=1 to rs.pagesize
	  if rs.eof then exit for
	  if(i=1)then
	    sqlid=rs("id")
	  else
	    sqlid=sqlid &","&rs("id")
	  end if
	  rs.movenext
    next
  end if
  if(idcount>0 and sqlid<>"") Then
    sql="select * from ["& datafrom &"] where id in("& sqlid &") "&taxis
    set rs=server.createobject("adodb.recordset")
    rs.open sql,conn,0,1
    while not rs.eof
  		Response.Write "<table width=""95%"" border=""0"" align=""center"" cellpadding=""3"" cellspacing=""5"">"&VbCrLf
		Response.Write "  <tr>"&VbCrLf
		Response.Write "    <td style=""line-height:200%"">"&HtmlStrReplace(rs("Remark"))&"<br />"&VbCrLf
		Response.Write "      联 系 人："&rs("Linkman")&"人<br />"&VbCrLf
		Response.Write "      性　　别："&rs("Sex")&"<br />"&VbCrLf
		Response.Write "      手机号码："&rs("Mobile")&"<br />"&VbCrLf
		Response.Write "      电子邮箱："&rs("Email")&"<br />"&VbCrLf
       If rs("IsokMoney") Then 
   		Response.Write "      是否付款：<font style=""color:red"">已经付款</font><br />"&VbCrLf
	    Response.Write "      付款金额：<font style=""color:red"">￥"&Formatnumber(rs("ToalMoney"),2,-1,-1,0)&"</font><br />"&VbCrLf
		if rs("ReplyContent")<>"" then response.write "<strong style=""color:red"">回复内容：</strong><br />"&HtmlStrReplace(rs("ReplyContent"))
		Response.Write "      </td>"&VbCrLf
		Response.Write "  </tr>"&VbCrLf
		Response.Write "</table>"&VbCrLf
        Else 
        Response.Write "      是否付款：<font style=""color:red"">未付款</font><br />"&VbCrLf
		Response.Write "      付款金额：<font style=""color:red"">￥"&Formatnumber(rs("ToalMoney"),2,-1,-1,0)&"</font><br />"&VbCrLf
		if rs("ReplyContent")<>"" then response.write "<strong style=""color:red"">回复内容：</strong><br />"&HtmlStrReplace(rs("ReplyContent"))
		Response.Write "      </td>"&VbCrLf
		Response.Write "</table>"&VbCrLf
        End If 
	  rs.movenext
    wend

  else
    response.write "<center>暂无相关信息</center>"
	exit function
  end If
  Response.Write "<table width=""98%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"&VbCrLf
  Response.Write "  <tr height=""35"">"&VbCrLf
  Response.Write "    <td align=""center"">"&VbCrLf
  Response.Write "共<strong style=""color:red"">"&idcount&"</strong>条记录 页次：<strong style=""color:red"">"&page&"</strong>/"&pagec&" 每页：<strong style=""color:red"">"&pages&"</strong>条记录" & vbCrLf
  pagenmin=page-pagenc
  pagenmax=page+pagenc
  if(pagenmin<1) then pagenmin=1
  if(page>1) then response.write ("<a href="""& myself &"Page=1&Range="&request("Range")&"&KeyWord="&Keyword&""" title=""回到第一页""><font face=""webdings"" color=""#000000"">9</font></a> ")
  if page-(pagenc*2+1)<=0 then
	pageprevious=1
  else
	pageprevious=page-(pagenc*2+1)
  end if
  if(pagenmin>1) then response.write ("<a href="""& myself &"Page="& pageprevious &"&Range="&request("Range")&"&KeyWord="&Keyword&""" title=""第"& pageprevious &"页""><font face=""webdings"" color=""#000000"">3</font></a> ")
  if(pagenmax>pagec) then pagenmax=pagec
  for i = pagenmin to pagenmax
	if(i=page) then
	  response.write ("&nbsp;<strong style=""color:red"">"& i &"</strong>&nbsp;")
	else
	  response.write ("[<a href="""& myself &"Page="& i &"&Range="&request("Range")&"&KeyWord="&Keyword&""">"& i &"</a>]")
	end if
  next
  if page+(pagenc*2+1)>=pagec then
    pagenext=pagec
  else
    pagenext=page+(pagenc*2+1)
  end if
  if(pagenmax<pagec) then response.write (" <a href="""& myself &"Page="& pagenext &"&Range="&request("Range")&"&KeyWord="&Keyword&""" title=""跳转到第"&pagenext&"页""><font face=""webdings"" color=""#999999"">:</font></a> ")
  if(page<pagec) then response.write (" <a href="""& myself &"Page="& pagec &"&Range="&request("Range")&"&KeyWord="&Keyword&""" title=""跳转到第"&pagec&"页""><font face=""webdings"" color=""#000000"">:</font></a>")
  Response.Write "    </td>"&VbCrLf
  Response.Write "  </tr>"&VbCrLf
  Response.Write "</table>"&VbCrLf
  rs.close
  set rs=nothing
end Function

'最近一周团购
Function ListProducts(SortPath,trs,tds,PicW,PicH,Oderder)
  dim rs,sql,tr,td,ProductName,SmallPicPath
  set rs = server.createobject("adodb.recordset")
  If Oderder="Products" Then
  sql="select top "&trs*tds&" * from liangjing_Products where Instr(SortPath,'"&SortPath&"')>0 and [AddTime] between dateadd('ww',-1,now()) and now() order by AddTime desc"
  Else 
  sql="select top "&trs*tds&" * from liangjing_Products where NewFlag  and Instr(SortPath,'"&SortPath&"')>0 order by "&Oderder&" desc,id desc"
  End If 
  rs.open sql,conn,1,1
  if rs.eof then
    response.write "暂无相关信息"
  Else
	for tr=1 to trs
        for td=1 to tds
	      if StrLen(rs("ProductName"))<=18 then
            ProductName=rs("ProductName")
	      else
	        ProductName=rs("ProductName")
	      end If
			If ISHTML = 1 Then
				AutoLink = ""&ProName&""&Separated&""&rs("ID")&"."&HTMLName&""
			Else
				AutoLink = "ProductView.asp?ID="&rs("id")&""
			End If
			SmallPicPath=HtmlSmallPic(rs("GroupID"),rs("SmallPic"),rs("Exclusive"))
		ChildCount=conn.execute("select count(*) from liangjing_Order where IsokMoney=true and ProductNo='"&rs("ProductNo")&"'")(0)
Response.Write "<tr><td align=""center"">"
Response.Write " <div id=""mian_border"">"
Response.Write "<div id=""mian_border_title""><a href="""&AutoLink&""">"&ProductName&"</a></div>"
Response.Write "<div id=""mian_border_1""><a href="""&AutoLink&""" target=""_blank"">"
Response.Write "<img src="""&SmallPicPath&""" alt="""" width="""&PicW&""" height="""&PicH&""" border=""0""></a></div>"
Response.Write "<div class=""Pricelist"">现价:<font style=""color:red;"">￥"&rs("N_Price")-rs("P_Price")&"</font>原价:￥"&rs("N_Price")&" <br/>节省:￥"&rs("P_Price")&"</div>"
Response.Write "<div><font style=""color:red;font-size:16px;"">"&ChildCount&"</font>人已订购 <a href="""&AutoLink&"""><img src=""images/dinggou.jpg"" width=""75px"" height=""25px""></a></div>"
Response.Write "</div>"
Response.Write " </td></tr>"
	      rs.movenext
		  if rs.eof then exit for
		next
		if rs.eof then exit for
	Next
  end if
  rs.close
  set rs=nothing
End Function

%>