<!--#include file="../Include/Const.Asp" -->
<!--#include file="../Include/ConnSiteData.Asp" -->
<!--#include file="../CheckAdmin.Asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../Images/Admin_style.css">
<script language="javascript" src="../JavaScript/Admin.js"></script>
<%
Dim Result, Keyword,SortID,SortPath,classid
Result = request.QueryString("Result")
Keyword = request.QueryString("Keyword")
SortID = request.QueryString("SortID")
SortPath = request.QueryString("SortPath")
classid=request("class")
Function PlaceFlag()
    If Result = "Search" Then
        If Keyword<>"" Then
            Response.Write "<a href='?'>全部</a> -> 关键字：<font color='red'>"&Keyword&"</font>"
        Else
            Response.Write "记录检索 -> 关键字为空(显示全部)"
        End If
    Else
        If SortPath<>"" Then
            Response.Write "<img src='../Images/current.jpg' /> 当前位置：列表 -> <a href='?'>全部</a>"
            TextPath(SortID)
        Else
            Response.Write "<img src='../Images/current.jpg' /> 当前位置：列表 -> <font color='#ff6600'>全部</font>"
        End If
    End If
End Function
%>
<br />
<table class="tableBorder" width="95%" border="0" align="center" cellpadding="5" cellspacing="1">
<form name="formSearch" method="post" action="../Search.Asp?Result=khRecords">
  
  <tr>
    <td class="forumRow">关键字：<input name="Keyword" type="text" value="<%=Keyword%>" size="20"> <input name="submitSearch" type="submit" value="查找">
	
	</td>
  </tr>
  
  <tr>
    <td class="forumRow">
	<%PlaceFlag()%></td>
  </tr>
  </form>
</table>
<br />
<table class="tableBorder" width="95%" border="0" align="center" cellpadding="5" cellspacing="1" style="background-color:#e6eff8">
<form action="../DelContent.Asp?Result=khRecords" method="post" name="formDel">
  <tr>
    <th>序号</th>
    <th align="left">日期</th>
    <th align="left">公司</th>
    <th align="left">联系人</th>
    <th align="left">沟通内容</th>
    <th align="center">订单状态</th>
   

    <th>操作</th>
    <th>选择</th>
  </tr>
  <% RecordsList() %>
  </form>
</table>
<%
Function RecordsList()
    Dim idCount
    Dim pages
    pages = 20
    Dim pagec
    Dim page
    page = CLng(request("Page"))
    Dim pagenc
    pagenc = 2
    Dim pagenmax
    Dim pagenmin
    Dim datafrom
    datafrom = "Zqj_Records"
    Dim datawhere
    If Result = "Search" Then
        datawhere = "where (Re_company like '%" & Keyword &_
        "%' or Re_Contactname like '%" & Keyword &_
        "%' or Re_Content like '%" & Keyword &_
        "%') and MemName='"&session("UserName")&"' "
    Else
            datawhere = "where MemName='"&session("UserName")&"' "
    End If
    Dim sqlid
    Dim Myself, PATH_INFO, QUERY_STRING
    PATH_INFO = request.servervariables("PATH_INFO")
    QUERY_STRING = request.ServerVariables("QUERY_STRING")'
    If QUERY_STRING = "" Or InStr(PATH_INFO & "?" & QUERY_STRING, "Page=") = 0 Then
        Myself = PATH_INFO & "?"
    Else
        Myself = Left(PATH_INFO & "?" & QUERY_STRING, InStr(PATH_INFO & "?" & QUERY_STRING, "Page=") -1)
    End If
    Dim taxis
    taxis = "order by Re_time desc"
    Dim i
    Dim rs, sql
    sql = "select count(Re_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 Re_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("Re_ID")
Else
    sqlid = sqlid &","&rs("Re_ID")
End If
rs.movenext
Next
End If
If(idcount>0 And sqlid<>"") Then
sql = "select * from ["& datafrom &"] where Re_ID in("& sqlid &") "&taxis
Set rs = server.CreateObject("adodb.recordset")
rs.Open sql, conn, 0, 1
noli=1
While(Not rs.EOF)
     Response.Write "<tr "&vbCrLf
     if (noli mod 2)=1 then
	     response.Write "bgcolor='#F0F8FF'"
	 end if
     Response.Write " onMouseOver=""this.style.backgroundColor='#FFF8DC'"" onMouseOut=""this.style.backgroundColor=''"">"&vbCrLf
Response.Write "<td nowrap align='center' >"&(page-1)*pages+noli&"</td>" & vbCrLf
Response.Write "<td nowrap title=''>"&rs("Re_time")&"</td>" & vbCrLf
Response.Write "<td nowrap><a href='?Result=Search&Keyword="&rs("Re_company")&"&Page=1'>"&rs("Re_company")&"</a> </td>" & vbCrLf
Response.Write "<td nowrap><a href='?Result=Search&Keyword="&rs("Re_Contactname")&"&Page=1'>"&rs("Re_Contactname")&"</a> </td>" & vbCrLf
Response.Write "<td>"&rs("Re_Content")&"</td>" & vbCrLf
Response.Write "<td align='center'>"&rs("Re_status")&"</td>" & vbCrLf
if rs("Cp_ID")<>0 then
      Response.Write "<td align=""center""nowrap> <a href='../Kehu/My_people_KehuView.Asp?Result=Modify&ID="&rs("Cp_ID")&"&showid=3' target=_blank>详情</a></td>" & vbCrLf
else
      Response.Write "<td align=""center""nowrap> <a href='../Kehu/My_Companies_KehuView.Asp?Result=Modify&ID="&rs("Co_ID")&"&showid=3' target=_blank>详情</a></td>" & vbCrLf
end if
Response.Write "<td nowrap align='center'><input name='selectID' type='checkbox' value='"&rs("Re_ID")&"'></td>" & vbCrLf

Response.Write "</tr>" & vbCrLf
noli=noli+1
rs.movenext
Wend
Response.Write "<tr>" & vbCrLf
Response.Write "<td colspan='8' nowrap align=""right"" class=""forumRow"">  <input onClick=""CheckAll(this.form)"" name=""buttonAllSelect"" type=""button"" id=""submitAllSearch"" value=""全选""> <input onClick=""CheckOthers(this.form)"" name=""buttonOtherSelect"" type=""button"" id=""submitOtherSelect"" value=""反选""> <input type=""submit"" name=""batch"" value=""删除所选"" onClick=""return test();""></td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Else
    response.Write "<tr><td nowrap align='center' colspan='10' class=""forumRow"">暂无记录</td></tr>"
End If
Response.Write "<tr>" & vbCrLf
Response.Write "<td colspan='8' nowrap class=""forumRow"">" & vbCrLf
Response.Write "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td class=""forumRow"">共计：<font color='red'>"&idcount&"</font>条记录 页次：<font color='red'>"&page&"</font></strong>/"&pagec&" 每页：<font color='red'>"&pages&"</font>条</td>" & vbCrLf
Response.Write "<td align='right'>" & vbCrLf
pagenmin = page - pagenc
pagenmax = page+pagenc
If(pagenmin<1) Then pagenmin = 1
If(page>1) Then response.Write ("<a href='"& myself &"Page=1'><font style='font-size: 14px; font-family: Webdings'>9</font></a> ")
If(pagenmin>1) Then response.Write ("<a href='"& myself &"Page="& page - (pagenc * 2 + 1) &"'><font style='font-size: 14px; font-family: Webdings'>7</font></a> ")
If(pagenmax>pagec) Then pagenmax = pagec
For i = pagenmin To pagenmax
    If(i = page) Then
    response.Write (" <font color='red'>"& i &"</font> ")
Else
    response.Write ("[<a href="& myself &"Page="& i &">"& i &"</a>]")
End If
Next
If(pagenmax<pagec) Then response.Write (" <a href='"& myself &"Page="& page+(pagenc * 2 + 1) &"'><font style='font-size: 14px; font-family: Webdings'>8</font></a> ")
If(page<pagec) Then response.Write ("<a href='"& myself &"Page="& pagec &"'><font style='font-size: 14px; font-family: Webdings'>:</font></a> ")
Response.Write "第<input name='SkipPage' onKeyDown='if(event.keyCode==13)event.returnValue=false' onchange=""if(/\D/.test(this.value)){alert('请输入需要跳转到的页数并且必须为整数！');this.value='"&Page&"';}"" style='width: 28px;' type='text' value='"&Page&"'>页" & vbCrLf
Response.Write "<input name='submitSkip' type='button' onClick='GoPage("""&Myself&""")' value='转到'>" & vbCrLf
Response.Write "</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "</table>" & vbCrLf
rs.Close
Set rs = Nothing
Response.Write "</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
End Function

Function TextPath(ID)
   
    response.Write(TextPath)
End Function






%>