<!--#include file="Admin_Common.asp"-->
<%
'**************************************************************
' Software name: PowerEasy SiteWeaver
' Web: http://www.powereasy.net
' Copyright (C) 2005－2008 佛山市动易网络科技有限公司 版权所有
'**************************************************************

Const NeedCheckComeUrl = True   '是否需要检查外部访问

Const PurviewLevel = 2      '0--不检查，1--超级管理员，2--普通管理员
Const PurviewLevel_Channel = 0   '0--不检查，1--频道管理员，2--栏目总编，3--栏目管理员
Const PurviewLevel_Others = "Transfer"   '其他权限

strFileName = "Admin_Transfer.asp?SearchType=" & SearchType & "&Field=" & strField & "&Keyword=" & Keyword

Response.Write "<html><head><title>订单过户记录查询</title>"
Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>"
Response.Write "<link rel='stylesheet' href='Admin_Style.css' type='text/css'>"
Response.Write "</head>"
Response.Write "<body leftmargin='2' topmargin='0' marginwidth='0' marginheight='0'>"
Response.Write "<table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' Class='border'>"
Call ShowPageTitle("订 单 过 户 记 录 查 询", 10208)
Response.Write "    <tr class='tdbg' height='30'> "
Response.Write "  <form name='form1' action='Admin_Transfer.asp' method='get'>"
Response.Write "      <td>快速查找："
Response.Write "      <select size=1 name='SearchType' onChange='javascript:submit()'>"
Response.Write "          <option value='0'"
If SearchType = 0 Then Response.Write " selected"
Response.Write ">所有记录</option>"
Response.Write "          <option value='1'"
If SearchType = 1 Then Response.Write " selected"
Response.Write ">最近10天内的新记录</option>"
Response.Write "          <option value='2'"
If SearchType = 2 Then Response.Write " selected"
Response.Write ">最近一月内的新记录</option>"
Response.Write "        </select>&nbsp;&nbsp;&nbsp;&nbsp;<a href='Admin_Transfer.asp'>订单过户记录首页</a></td>"
Response.Write "  </form>"
Response.Write "<form name='form2' method='post' action='Admin_Transfer.asp'>"
Response.Write "    <td>高级查询："
Response.Write "      <select name='Field' id='Field'>"
Response.Write "      <option value='ContacterName'>收货人姓名</option>"
Response.Write "      <option value='UserName'>用户名</option>"
Response.Write "      <option value='Inputer'>经手人</option>"
Response.Write "      <option value='DateAndTime'>订单过户日期</option>"
Response.Write "      </select>"
Response.Write "      <input name='Keyword' type='text' id='Keyword' size='20' maxlength='30'>"
Response.Write "      <input type='submit' name='Submit2' value=' 查 询 '>"
Response.Write "      <input name='SearchType' type='hidden' id='SearchType' value='10'>"
Response.Write " </td>"
Response.Write "</form>"
Response.Write "</table>"
Response.Write "<br>"

Call main
If FoundErr = True Then
    Call WriteErrMsg(ErrMsg, ComeUrl)
End If
Response.Write "</body></html>"
Call CloseConn



Sub main()
    Dim rsTransfer, sql
    Dim TotalIncome, TotalPayout
    TotalIncome = 0
    TotalPayout = 0
    
    sql = "select T.*,O.OrderFormNum,O.UserName from PE_TransferItem T inner join PE_OrderForm O on T.OrderFormID=O.OrderFormID "
    Response.Write "<table width='100%'><tr><td align='left'><img src='images/img_u.gif' align='absmiddle'>您现在的位置：<a href='Admin_Transfer.asp'>订单过户记录管理</a>&nbsp;&gt;&gt;&nbsp;"
    Select Case SearchType
        Case 0
            sql = sql & " order by T.ItemID desc"
            Response.Write "所有记录"
        Case 1
            sql = sql & " where datediff(" & PE_DatePart_D & ",T.DateAndTime," & PE_Now & ")<10 order by T.ItemID desc"
            Response.Write "最近10天内的新记录"
        Case 2
            sql = sql & " where datediff(" & PE_DatePart_M & ",T.DateAndTime," & PE_Now & ")<1 order by T.ItemID desc"
            Response.Write "最近一月内的新记录"
        Case 10
            If Keyword = "" Then
                sql = sql & " order by T.ItemID desc"
                Response.Write "所有记录"
            Else
                Select Case strField
                Case "UserName"
                    sql = sql & " where O.UserName like '%" & Keyword & "%' order by T.ItemID desc"
                    Response.Write "用户名中含有“ <font color=red>" & Keyword & "</font> ”的记录"
                Case "ContacterName"
                    sql = sql & " where O.ContacterName like '%" & Keyword & "%' order by T.ItemID desc"
                    Response.Write "用户名中含有“ <font color=red>" & Keyword & "</font> ”的记录"
                Case "Inputer"
                    sql = sql & " where T.Inputer='" & Keyword & "' order by T.ItemID desc"
                    Response.Write "经手人为 <font color=red>" & Keyword & "</font> 的记录"
                Case "DateAndTime"
                    If IsDate(Keyword) = True Then
                        If SystemDatabaseType = "SQL" Then
                            sql = sql & " where T.DateAndTime='" & Keyword & "'  order by T.ItemID desc"
                        Else
                            sql = sql & " where T.DateAndTime=#" & Keyword & "#  order by T.ItemID desc"
                        End If
                        Response.Write "订单过户日期为 <font color=red>" & Keyword & "</font> 的记录"
                    Else
                        FoundErr = True
                        ErrMsg = ErrMsg & "<li>查询的订单过户日期格式不正确！</li>"
                    End If
                End Select
            End If
        Case Else
            FoundErr = True
            ErrMsg = ErrMsg & "<li>错误的参数！</li>"
    End Select
    Response.Write "</td></tr></table>"
    If FoundErr = True Then Exit Sub
    Response.Write "<table width='100%' border='0' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "  <tr align='center' class='title'>"
    Response.Write "    <td width='120'>时间</td>"
    Response.Write "    <td width='100'>订单编号</td>"
    Response.Write "    <td width='60'>当前所有者</td>"
    Response.Write "    <td width='60'>过户人</td>"
    Response.Write "    <td width='60'>过户给</td>"
    Response.Write "    <td width='40'>过户费</td>"
    Response.Write "    <td width='60'>付款人</td>"
    Response.Write "    <td>备注</td>"
    Response.Write "    <td width='60'>经手人</td>"
    Response.Write "  </tr>"
    
    Set rsTransfer = Server.CreateObject("Adodb.RecordSet")
    rsTransfer.Open sql, Conn, 1, 1
    If rsTransfer.BOF And rsTransfer.EOF Then
        totalPut = 0
        Response.Write "<tr class='tdbg' height='50'><td colspan='20' align='center'>没有任何符合条件的记录！</td></tr>"
    Else
        totalPut = rsTransfer.RecordCount
        If CurrentPage < 1 Then
            CurrentPage = 1
        End If
        If (CurrentPage - 1) * MaxPerPage > totalPut Then
            If (totalPut Mod MaxPerPage) = 0 Then
                CurrentPage = totalPut \ MaxPerPage
            Else
                CurrentPage = totalPut \ MaxPerPage + 1
            End If
        End If
        If CurrentPage > 1 Then
            If (CurrentPage - 1) * MaxPerPage < totalPut Then
                rsTransfer.Move (CurrentPage - 1) * MaxPerPage
            Else
                CurrentPage = 1
            End If
        End If
    
        Dim i
        i = 0
        Do While Not rsTransfer.EOF
            Response.Write "  <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
            Response.Write "    <td width='120' align='center'>" & rsTransfer("DateAndTime") & "</td>"
            Response.Write "    <td width='100' align='center'><a href='Admin_Order.asp?Action=ShowOrder&OrderFormID=" & rsTransfer("OrderFormID") & "'>" & rsTransfer("OrderFormNum") & "</a></td>"
            Response.Write "    <td width='60' align='center'><a href='Admin_User.asp?Action=Show&UserName=" & rsTransfer("UserName") & "'>" & rsTransfer("UserName") & "</a></td>"
            Response.Write "    <td width='60' align='center'>" & rsTransfer("OwnerUserName") & "</td>"
            Response.Write "    <td width='60' align='center'>" & rsTransfer("TargetUserName") & "</td>"
            Response.Write "    <td width='40' align='center'>" & rsTransfer("Poundage") & "</td>"
            Response.Write "    <td width='60' align='center'>" & rsTransfer("PayerUserName") & "</td>"
            Response.Write "    <td>" & rsTransfer("Remark") & "</td>"
            Response.Write "    <td width='60' align='center'>" & rsTransfer("Inputer") & "</td>"
            Response.Write "  </tr>"
    
            i = i + 1
            If i >= MaxPerPage Then Exit Do
            rsTransfer.MoveNext
        Loop
    End If
    rsTransfer.Close
    Set rsTransfer = Nothing

    Response.Write "</table>"
    Response.Write ShowPage(strFileName, totalPut, MaxPerPage, CurrentPage, True, True, "条记录", True)
End Sub
%>
