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

Sub Main()
    Dim ClientName, ShortedForm
    Dim rsClient
    Set rsClient = Conn.Execute("select ClientName,ShortedForm from PE_Client where ClientID=" & ClientID & "")
    If rsClient.BOF And rsClient.EOF Then
        ClientName = ""
        ShortedForm = ""
    Else
        ClientName = rsClient(0)
        ShortedForm = rsClient(1)
    End If
    rsClient.Close
    Set rsClient = Nothing

    strFileName = "User_Complain.asp?Field=" & strField & "&Keyword=" & Keyword

    Response.Write "<br>"
    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>" & vbCrLf
    Response.Write "    <td width='60' align='center'>客户名称</td>" & vbCrLf
    Response.Write "    <td width='80' align='center'>投诉类型</td>" & vbCrLf
    Response.Write "    <td>主题</td>" & vbCrLf
    Response.Write "    <td width='60' align='center'>紧急程度</td>" & vbCrLf
    Response.Write "    <td width='60' align='center'>记录状态</td>" & vbCrLf
    Response.Write "  </tr>"

    Dim rsComplain, sqlComplain, TotalIncome, TotalPayout, arrComplainType, arrMagnitudeOfExigence, arrStatus
    arrComplainType = GetArrFromDictionary("PE_ComplainItem", "ComplainType")
    arrMagnitudeOfExigence = GetArrFromDictionary("PE_ComplainItem", "MagnitudeOfExigence")
    arrStatus = Array("未处理", "处理中", "已处理", "已回访")
    sqlComplain = "select S.*,C.ShortedForm from PE_ComplainItem S inner join PE_Client C on S.ClientID=C.ClientID where S.Defendant='" & UserName & "' order by S.ItemID desc"
    Set rsComplain = Server.CreateObject("Adodb.RecordSet")
    rsComplain.Open sqlComplain, Conn, 1, 1
    If rsComplain.BOF And rsComplain.EOF Then
        totalPut = 0
        Response.Write "<tr class='tdbg' height='50'><td colspan='20' align='center'>没有任何被投诉记录！</td></tr>"
    Else
        totalPut = rsComplain.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
                rsComplain.Move (CurrentPage - 1) * MaxPerPage
            Else
                CurrentPage = 1
            End If
        End If

        Dim i
        i = 0
        Do While Not rsComplain.EOF

            Response.Write "  <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">" & vbCrLf
            Response.Write "    <td width='120'>" & rsComplain("DateAndTime") & "</td>" & vbCrLf
            Response.Write "    <td width='60' align='center'>" & rsComplain("ShortedForm") & "</td>" & vbCrLf
            Response.Write "    <td width='80' align='center'>" & GetArrItem(arrComplainType, rsComplain("ComplainType")) & "</td>" & vbCrLf
            Response.Write "    <td>" & rsComplain("Title") & "</td>" & vbCrLf
            Response.Write "    <td width='60' align='center'>" & GetArrItem(arrMagnitudeOfExigence, rsComplain("MagnitudeOfExigence")) & "</td>" & vbCrLf
            Response.Write "    <td width='60' align='center'>" & GetArrItem(arrStatus, rsComplain("Status")) & "</td>" & vbCrLf
            Response.Write "    </td>" & vbCrLf
            Response.Write "  </tr>" & vbCrLf
            i = i + 1
            If i >= MaxPerPage Then Exit Do
            rsComplain.MoveNext
        Loop
    End If
    rsComplain.Close
    Set rsComplain = Nothing

    Response.Write "  </tr>"
    Response.Write "</table>"
    Response.Write ShowPage("User_Complain.asp", totalPut, MaxPerPage, CurrentPage, True, True, "条投诉记录", True)
End Sub
%>