<!--#include file="Admin_Common.asp"-->
<!--#include file="Admin_CommonCode_CRM.asp"-->
<!--#include file="../Include/PowerEasy.Bankroll.asp"-->

<%
'**************************************************************
' Software name: PowerEasy SiteWeaver
' Web: http://www.powereasy.net
' Copyright (C) 2005－2009 佛山市动易网络科技有限公司 版权所有
'**************************************************************

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

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

Dim arrArea, arrClientField, arrValueLevel, arrCreditLevel, arrImportance
Dim arrConnectionLevel, arrGroupID, arrSourceType, arrPhaseType
Dim arrStatusInField, arrCompanySize, arrManagementForms, arrEducation, arrIncome
Dim arrClientType

'检查管理员操作权限
If AdminPurview > 1 Then
    arrPurview(0) = CheckPurview_Other(AdminPurview_Others, "Client_View")
    arrPurview(1) = CheckPurview_Other(AdminPurview_Others, "Client_Add")
    arrPurview(2) = CheckPurview_Other(AdminPurview_Others, "Client_ModifyOwn")
    arrPurview(3) = CheckPurview_Other(AdminPurview_Others, "Client_ModifyAll")
    arrPurview(4) = CheckPurview_Other(AdminPurview_Others, "Client_Del")
    arrPurview(5) = CheckPurview_Other(AdminPurview_Others, "Service_Add")
    arrPurview(6) = CheckPurview_Other(AdminPurview_Others, "Complain_Add")
    For PurviewIndex = 0 To 4
        If arrPurview(PurviewIndex) = True Then
            PurviewPassed = True
            Exit For
        End If
    Next
    If PurviewPassed = False Then
        Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        Response.End
    End If
End If


Response.Write "<html><head><title>客户管理</title>" & vbCrLf
Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbCrLf
Response.Write "<link href='Admin_Style.css' rel='stylesheet' type='text/css'>" & vbCrLf

Response.Write "<script language='javascript'>" & vbCrLf
Response.Write "var tID=0;" & vbCrLf
Response.Write "function ShowTabs(ID){" & vbCrLf
Response.Write "  if(ID!=tID){" & vbCrLf
Response.Write "    TabTitle[tID].className='title5';" & vbCrLf
Response.Write "    TabTitle[ID].className='title6';" & vbCrLf
Response.Write "    Tabs[tID].style.display='none';" & vbCrLf
Response.Write "    Tabs[ID].style.display='';" & vbCrLf
Response.Write "    tID=ID;" & vbCrLf
Response.Write "  }" & vbCrLf
Response.Write "}" & vbCrLf
Response.Write "</script>" & vbCrLf

Response.Write "</head>" & vbCrLf
Response.Write "<body leftmargin='2' topmargin='0' marginwidth='0' marginheight='0'>" & vbCrLf
Response.Write "<table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>" & vbCrLf
Response.Write "  <form name='searchmyform' action='Admin_Client.asp' method='get'>"
Call ShowPageTitle("客 户 管 理", 10221)
Response.Write "  <tr class='tdbg'>" & vbCrLf
Response.Write "    <td width='100' height='30'>快速查找客户：</td>" & vbCrLf
Response.Write "    <td width='687' height='30'>"
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 ">企业客户</option>"
Response.Write "          <option value='2' "
If SearchType = 2 Then Response.Write " selected"
Response.Write ">个人客户</option>"
Response.Write "        </select>"
Response.Write "        &nbsp;&nbsp;&nbsp;&nbsp;<a href='Admin_Client.asp'>客户管理首页</a>&nbsp;|&nbsp;<a href='Admin_Client.asp?Action=AddClient&ClientType=0'>添加企业客户</a>&nbsp;|&nbsp;<a href='Admin_Client.asp?Action=AddClient&ClientType=1'>添加个人客户</a>"
Response.Write "    </td>" & vbCrLf
Response.Write "  </tr>" & vbCrLf
Response.Write "  </form>" & vbCrLf
Response.Write "</table>" & vbCrLf

arrArea = GetArrFromDictionary("PE_Client", "Area")
arrClientField = GetArrFromDictionary("PE_Client", "ClientField")
arrValueLevel = GetArrFromDictionary("PE_Client", "ValueLevel")
arrCreditLevel = GetArrFromDictionary("PE_Client", "CreditLevel")
arrImportance = GetArrFromDictionary("PE_Client", "Importance")
arrConnectionLevel = GetArrFromDictionary("PE_Client", "ConnectionLevel")
arrGroupID = GetArrFromDictionary("PE_Client", "GroupID")
arrSourceType = GetArrFromDictionary("PE_Client", "SourceType")
arrPhaseType = GetArrFromDictionary("PE_Client", "PhaseType")
arrStatusInField = GetArrFromDictionary("PE_Company", "StatusInField")
arrCompanySize = GetArrFromDictionary("PE_Company", "CompanySize")
arrManagementForms = GetArrFromDictionary("PE_Company", "ManagementForms")
arrEducation = GetArrFromDictionary("PE_Contacter", "Education")
arrIncome = GetArrFromDictionary("PE_Contacter", "Income")
arrClientType = Array("企业客户", "个人客户")

Select Case Action
    Case "AddClient"
        Call AddClient
    Case "Modify"
        Call Modify
    Case "SaveAdd", "SaveModify"
        Call SaveClient
    Case "Show"
        Call Show
    Case "DelClient"
        Call DelClient
    Case "DoDelClient"
        Call DoDelClient
    Case "AddRemit"
        Call AddIncome(1)
    Case "SaveRemit"
        Call SaveRemit
    Case "AddPayment"
        Call AddPayment
    Case "SavePayment"
        Call SavePayment
    Case "AddIncome"
        Call AddIncome(2)
    Case "SaveIncome"
        Call SaveIncome
Case Else
    Call main
End Select
If FoundErr = True Then
    Call WriteErrMsg(ErrMsg, ComeUrl)
End If
Response.Write "</body></html>"
Call CloseConn

Sub main()
    Dim GroupID, i
    Dim sql, Querysql, rsClientList

    GroupID = PE_CLng(Trim(Request("GroupID")))
    strFileName = "Admin_Client.asp?SearchType=" & SearchType & "&Field=" & strField & "&keyword=" & Keyword & "&GroupID=" & GroupID
    
    Call ShowJS_Main("客户")
    
    Response.Write "<br>"
    Response.Write "<table width='100%' class='border' border='0' cellpadding='2' cellspacing='1'><tr class='title'><td>| <a href='Admin_Client.asp'>所有客户</a> |"
    For i = 0 To UBound(arrGroupID)
        Response.Write " <a href='Admin_Client.asp?SearchType=11&GroupID=" & i & "'>" & GetArrItem(arrGroupID, i) & "</a> |"
    Next
    Response.Write "</td></tr></table>"
    
    Response.Write "<br><table width='100%'><tr><td align='left'>您现在的位置：<a href='Admin_Client.asp'>客户管理</a>&nbsp;&gt;&gt;&nbsp;"
    sql = "select top " & MaxPerPage & " * from PE_Client"
    Querysql = Querysql & " where 1=1 "
    Select Case SearchType
    Case 0
        Response.Write "所有客户"
    Case 1
        Querysql = Querysql & " and ClientType=0"
        Response.Write "企业客户"
    Case 2
        Querysql = Querysql & " and ClientType=1"
        Response.Write "个人客户"
    Case 10
        If Keyword = "" Then
            Response.Write "所有客户"
        Else
            Select Case strField
            Case "ClientID"
                If IsNumeric(Keyword) = False Then
                    FoundErr = True
                    ErrMsg = ErrMsg & "<li>客户ID必须是整数</li>"
                Else
                    Querysql = Querysql & " and ClientID=" & PE_CLng(Keyword)
                    Response.Write "客户ID等于<font color=red> " & PE_CLng(Keyword) & " </font>的客户"
                End If
            Case "ClientName"
                Querysql = Querysql & " and ClientName like '%" & Keyword & "%'"
                Response.Write "名称中含有“ <font color=red>" & Keyword & "</font> ”的客户"
            Case Else
                Querysql = Querysql & " and ClientName like '%" & Keyword & "%'"
                Response.Write "名称中含有“ <font color=red>" & Keyword & "</font> ”的客户"
            End Select
        End If
    Case 11
        Response.Write GetArrItem(arrGroupID, GroupID)
        Querysql = Querysql & " and GroupID=" & GroupID
    End Select
    
    totalPut = PE_CLng(Conn.Execute("select Count(*) from PE_Client " & Querysql)(0))
    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
        Querysql = Querysql & " and ClientID < (select min(ClientID) from (select top " & ((CurrentPage - 1) * MaxPerPage) & " ClientID from PE_Client " & Querysql & " order by ClientID desc) as QueryClient) "
    End If
    sql = sql & Querysql & " order by ClientID desc"


    Response.Write "</td></tr></table>"
    If FoundErr = True Then Exit Sub
    
    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0'>"
    Response.Write "  <tr>"
    Response.Write "  <form name='myform' method='Post' action='Admin_Client.asp'>"
    Response.Write "      <td>"
    Response.Write "      <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "        <tr class='title' height='22' align='center'>"
    Response.Write "          <td width='30'>选中</td>"
    Response.Write "          <td width='100'>助记名称</td>"
    Response.Write "          <td>客户名称</td>"
    Response.Write "          <td width='60'>客户类别</td>"
    Response.Write "          <td width='80'>种类</td>"
    Response.Write "          <td width='60'>所有者</td>"
    Response.Write "          <td width='60'>创建日期</td>"
    Response.Write "          <td width='90'> 操作</td>"
    Response.Write "        </tr>"
    
    Set rsClientList = Server.CreateObject("Adodb.RecordSet")
    rsClientList.Open sql, Conn, 1, 1
    If rsClientList.BOF And rsClientList.EOF Then
        Response.Write "<tr><td colspan='20' height='50' align='center'>共找到 <font color=red>0</font> 个客户</td></tr>"
    Else
        Dim ClientNum
        ClientNum = 0
        Do While Not rsClientList.EOF
            Response.Write "      <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
            Response.Write "        <td width='30' align='center'><input name='ClientID' type='checkbox' onclick=""unselectall()"" id='ClientID' value='" & CStr(rsClientList("ClientID")) & "'></td>"
            Response.Write "        <td width='100'><a href='Admin_Client.asp?Action=Show&ClientID=" & rsClientList("ClientID") & "'>" & rsClientList("ShortedForm") & "</a></td>"
            Response.Write "        <td><a href='Admin_Client.asp?Action=Show&ClientID=" & rsClientList("ClientID") & "'>" & rsClientList("ClientName") & "</a></td>"
            Response.Write "        <td width='60' align='center'>" & GetArrItem(arrClientType, rsClientList("ClientType")) & "</td>"
            Response.Write "        <td width='80' align='center'>" & GetArrItem(arrGroupID, rsClientList("GroupID")) & "</td>"
            Response.Write "        <td width='60' align='center'>" & rsClientList("Owner") & "</td>"
            Response.Write "        <td width='60' align='center'>" & FormatDateTime(rsClientList("CreateTime"), 2) & "</td>"
            Response.Write "        <td width='90' align='center'>"
            Response.Write "<a href='Admin_Client.asp?Action=Show&ClientID=" & rsClientList("ClientID") & "'>查看</a>&nbsp;"
            Response.Write "<a href='Admin_Client.asp?Action=Modify&ClientID=" & rsClientList("ClientID") & "'>修改</a>&nbsp;"
            Response.Write "<a href='Admin_Client.asp?Action=DelClient&ClientID=" & rsClientList("ClientID") & "' onClick='return confirm(""确定要删除此客户吗？"");'>删除</a> "
            Response.Write "        </td>"
            Response.Write "      </tr>"

            ClientNum = ClientNum + 1
            If ClientNum >= MaxPerPage Then Exit Do
            rsClientList.MoveNext
        Loop
    End If
    rsClientList.Close
    Set rsClientList = Nothing
    Response.Write "      </table>"
    If totalPut > 0 Then
        Response.Write "      <table width='100%' border='0' cellpadding='0' cellspacing='0'>"
        Response.Write "        <tr height='30'>"
        Response.Write "          <td width='200'><input name='chkAll' type='checkbox' id='chkAll' onclick='CheckAll(this.form);' value='checkbox'>"
        Response.Write "          选中本页显示的所有客户</td>"
        Response.Write "          <td><input type='hidden' name='Action' value=''>"
        Response.Write "          <input name='Del' type='submit' value=' 批量删除 ' onClick=""document.myform.Action.value='DelClient';return confirm('确定要删除选定的客户吗？');"">&nbsp;&nbsp;&nbsp;&nbsp;"
        'Response.Write "          <input name='BatchMove' type='submit' value=' 批量移动 ' onClick=""document.myform.Action.value='BatchMove'"">"
        Response.Write "        </tr>"
        Response.Write "      </table>"
    End If
    Response.Write "      </td>"
    Response.Write "  </form>"
    Response.Write "  </tr>"
    Response.Write "</table>"
    If totalPut > 0 Then
        Response.Write ShowPage(strFileName, totalPut, MaxPerPage, CurrentPage, True, True, "个客户", True)
    End If


    Response.Write "<br>"

    Response.Write "<form name='SearchForm' action='Admin_Client.asp' method='post'>" & vbCrLf
    Response.Write "<table width='100%'  border='0' align='center' cellpadding='1' cellspacing='1' class='border'>" & vbCrLf
    Response.Write "  <tr class='tdbg'>" & vbCrLf
    Response.Write "    <td width='80'><b>客户查询：</b></td>" & vbCrLf
    Response.Write "    <td>" & vbCrLf
    Response.Write "      <select name='Field' size='1'>" & vbCrLf
    Response.Write "        <option value='ClientID'>客户ID</option>" & vbCrLf
    Response.Write "        <option value='ClientName' selected>客户名称</option>" & vbCrLf
    Response.Write "      </select>" & vbCrLf
    Response.Write "      <input name='Keyword' type='text' id='Keyword' size='20' maxlength='40'>" & vbCrLf
    Response.Write "      <input type='submit' name='Submit' value='搜 索' id='Submit'>" & vbCrLf
    Response.Write "      <input type='hidden' name='SearchType' value='10'>" & vbCrLf
    Response.Write "    </td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf
    Response.Write "</form>" & vbCrLf
End Sub

Sub ShowJS_Check()
    Response.Write "<script language=javascript>" & vbCrLf
    Response.Write "function CheckSubmit(){" & vbCrLf
    Response.Write "    if(document.myform.ClientName.value==''){" & vbCrLf
    Response.Write "        alert('客户名称不能为空！');" & vbCrLf
    Response.Write "        document.myform.ClientName.focus();" & vbCrLf
    Response.Write "        return false;" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    if(document.myform.ShortedForm.value==''){" & vbCrLf
    Response.Write "        alert('助记名称不能为空！');" & vbCrLf
    Response.Write "        document.myform.ShortedForm.focus();" & vbCrLf
    Response.Write "        return false;" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    document.myform.Country.value=frm1.document.regionform.Country.value;" & vbCrLf
    Response.Write "    document.myform.Province.value=frm1.document.regionform.Province.value;" & vbCrLf
    Response.Write "    document.myform.City.value=frm1.document.regionform.City.value;" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function ChangeType(Type){" & vbCrLf
    Response.Write "  if(Type==0){" & vbCrLf
    Response.Write "    TabTitle[2].style.display='';" & vbCrLf
    Response.Write "    infoE.style.display='';" & vbCrLf
    Response.Write "    TabTitle[3].style.display='none';" & vbCrLf
    Response.Write "    TabTitle[4].style.display='none';" & vbCrLf
    Response.Write "    infoP.style.display='none';" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  else{" & vbCrLf
    Response.Write "    TabTitle[2].style.display='none';" & vbCrLf
    Response.Write "    infoE.style.display='none';" & vbCrLf
    Response.Write "    TabTitle[3].style.display='';" & vbCrLf
    Response.Write "    TabTitle[4].style.display='';" & vbCrLf
    Response.Write "    infoP.style.display='';" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function SelectParentClient(){" & vbCrLf
    Response.Write "    var arr=showModalDialog('Admin_SourceList.asp?TypeSelect=ClientList','','dialogWidth:600px; dialogHeight:450px; help: no; scroll: yes; status: no');" & vbCrLf
    Response.Write "    if (arr != null){" & vbCrLf
    Response.Write "        var ss=arr.split('$$$');" & vbCrLf
    Response.Write "        document.myform.Parenter.value=ss[0];" & vbCrLf
    Response.Write "        document.myform.ParentID.value=ss[1];" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "</script>" & vbCrLf
End Sub

Sub AddClient()
    If AdminPurview > 1 And arrPurview(1) = False Then
        Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        Exit Sub
    End If
    
    Call PopCalendarInit
    Call ShowJS_Check
    Dim ClientType
    ClientType = PE_CLng(Trim(Request("ClientType")))

    Response.Write "<br><table width='100%'><tr><td align='left'>您现在的位置：<a href='Admin_Client.asp'>客户管理</a>&nbsp;&gt;&gt;&nbsp;添加客户</td></tr></table>"
    Response.Write "<form name='myform' id='myform' action='Admin_Client.asp' method='post' onSubmit='return CheckSubmit();'>" & vbCrLf
    Response.Write "<table  width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>" & vbCrLf
    Response.Write "        <tr align='center' height='24'>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title6' onclick='ShowTabs(0)'>基本信息</td>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(1)'>联络信息</td>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(2)'"
    If ClientType = 1 Then Response.Write " style='display:none'"
    Response.Write ">企业信息</td>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(3)'"
    If ClientType = 0 Then Response.Write " style='display:none'"
    Response.Write ">业务信息</td>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(4)'"
    If ClientType = 0 Then Response.Write " style='display:none'"
    Response.Write ">个人信息</td>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(5)'>备注信息</td>" & vbCrLf
    Response.Write "            <td>&nbsp;</td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf

    Response.Write "<table width='100%'  border='0' align='center' cellpadding='5' cellspacing='1' class='border'>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "            <td height='100' valign='top'>"
    Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF' id='Tabs' style='display:'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>客户名称：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='ClientName' type='text' id='ClientName' size='35' maxlength='200'> <font color='#FF0000'>*</font></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>客户编号：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='ClientNum' type='text' id='ClientNum' size='35' maxlength='30' value='" & GetNumString() & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >助记名称：</td>" & vbCrLf
    Response.Write "                        <td><input name='ShortedForm' type='text' id='ShortedForm' size='35' maxlength='20'> <font color='#FF0000'>*</font></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >上级客户：</td>" & vbCrLf
    Response.Write "                        <td><input name='Parenter' type='text' id='Parenter' ReadOnly size='35'><input type='button' name='aaa' value='...' onclick='SelectParentClient()'><input type='hidden' name='ParentID' value='0'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >区域：</td>" & vbCrLf
    Response.Write "                        <td><select name='Area'>" & Array2Option(arrArea, -1) & "</select></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >行业：</td>" & vbCrLf
    Response.Write "                        <td><select name='ClientField'>" & Array2Option(arrClientField, -1) & "</select></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >价值评估：</td>" & vbCrLf
    Response.Write "                        <td><select name='ValueLevel'>" & Array2Option(arrValueLevel, -1) & "</select></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >信用等级：</td>" & vbCrLf
    Response.Write "                        <td><select name='CreditLevel'>" & Array2Option(arrCreditLevel, -1) & "</select></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >重要程度：</td>" & vbCrLf
    Response.Write "                        <td><select name='Importance'>" & Array2Option(arrImportance, -1) & "</select></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >关系等级：</td>" & vbCrLf
    Response.Write "                        <td><select name='ConnectionLevel'>" & Array2Option(arrConnectionLevel, -1) & "</select></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >客户来源：</td>" & vbCrLf
    Response.Write "                        <td><select name='SourceType'>" & Array2Option(arrSourceType, -1) & "</select></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >阶段：</td>" & vbCrLf
    Response.Write "                        <td><select name='PhaseType'>" & Array2Option(arrPhaseType, -1) & "</select></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >客户组别：</td>" & vbCrLf
    Response.Write "                        <td><select name='GroupID'>" & Array2Option(arrGroupID, -1) & "</select></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >客户类别：</td>" & vbCrLf
    Response.Write "                        <td><Input type='radio' name='ClientType' value='0' onclick=""ChangeType(0)"""
    If ClientType = 0 Then Response.Write " checked"
    Response.Write ">企业客户 <Input type='radio' name='ClientType' value='1' onclick=""ChangeType(1)"""
    If ClientType = 1 Then Response.Write " checked"
    Response.Write ">个人客户</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                </table>" & vbCrLf

    Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF' id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td rowspan='2' class='tdbg5' align='right'  width='12%'>通讯地址：</td>" & vbCrLf
    Response.Write "                        <td colspan='3'>" & vbCrLf
    Response.Write "                            <iframe name='frm1' id='frm1' src='../Region.asp' width='100%' height='75' frameborder='0' scrolling='no'></iframe>" & vbCrLf
    Response.Write "                            <input name='Country' id='Country' type='hidden'> <input name='Province' id='Province' type='hidden'> <input name='City' id='City' type='hidden'>" & vbCrLf
    Response.Write "                        </td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td colspan='3'>" & vbCrLf
    Response.Write "                            <table width='100%'  border='0' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>" & vbCrLf
    Response.Write "                                <tr class='tdbg'>" & vbCrLf
    Response.Write "                                    <td width='12%' align='right' class='tdbg5' align='right' >联系地址：</td>" & vbCrLf
    Response.Write "                                    <td><input name='Address' type='text' size='60' maxlength='255'></td>" & vbCrLf
    Response.Write "                                </tr>" & vbCrLf
    Response.Write "                                <tr class='tdbg'>" & vbCrLf
    Response.Write "                                    <td align='right' class='tdbg5' align='right' >邮政编码：</td>" & vbCrLf
    Response.Write "                                    <td><input name='ZipCode' type='text' size='35' maxlength='10'></td>" & vbCrLf
    Response.Write "                                </tr>" & vbCrLf
    Response.Write "                            </table>" & vbCrLf
    Response.Write "                        </td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    
    Response.Write "<tbody id='infoE'"
    If ClientType = 1 Then Response.Write " style='display:none'"
    Response.Write ">"
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>联系电话：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='Phone' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>传真号码：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='Fax1' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "</tbody>" & vbCrLf
    
    Response.Write "<tbody id='infoP'"
    If ClientType = 0 Then Response.Write " style='display:none'"
    Response.Write ">"
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>办公电话：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='OfficePhone' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>住宅电话：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='HomePhone' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >移动电话：</td>" & vbCrLf
    Response.Write "                        <td><input name='Mobile' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >传真号码：</td>" & vbCrLf
    Response.Write "                        <td><input name='Fax2' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >小灵通：</td>" & vbCrLf
    Response.Write "                        <td><input name='PHS' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' ></td>" & vbCrLf
    Response.Write "                        <td></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >个人主页：</td>" & vbCrLf
    Response.Write "                        <td><input name='Homepage2' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >Email地址：</td>" & vbCrLf
    Response.Write "                        <td><input name='Email' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >QQ号码：</td>" & vbCrLf
    Response.Write "                        <td><input name='QQ' type='text' size='35' maxlength='20'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >MSN帐号：</td>" & vbCrLf
    Response.Write "                        <td><input name='MSN' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >ICQ号码：</td>" & vbCrLf
    Response.Write "                        <td><input name='ICQ' type='text' size='35' maxlength='25'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >雅虎通帐号：</td>" & vbCrLf
    Response.Write "                        <td><input name='Yahoo' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >UC帐号：</td>" & vbCrLf
    Response.Write "                        <td><input name='UC' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >Aim帐号：</td>" & vbCrLf
    Response.Write "                        <td><input name='Aim' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "</tbody>" & vbCrLf
    Response.Write "                </table>" & vbCrLf

    Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF' id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>开户银行：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='BankOfDeposit' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>银行帐号：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='BankAccount' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >税号：</td>" & vbCrLf
    Response.Write "                        <td><input name='TaxNum' type='text' size='35' maxlength='20'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >网址：</td>" & vbCrLf
    Response.Write "                        <td><input name='Homepage1' type='text' size='35' maxlength='100'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >行业地位：</td>" & vbCrLf
    Response.Write "                        <td><select name='StatusInField'>" & Array2Option(arrStatusInField, -1) & "</select></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >公司规模：</td>" & vbCrLf
    Response.Write "                        <td><select name='CompanySize'>" & Array2Option(arrCompanySize, -1) & "</select></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >业务范围：</td>" & vbCrLf
    Response.Write "                        <td><input name='BusinessScope' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >年销售额：</td>" & vbCrLf
    Response.Write "                        <td><input name='AnnualSales' type='text' size='15' maxlength='20'> 万元</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >经营状态：</td>" & vbCrLf
    Response.Write "                        <td><select name='ManagementForms'>" & Array2Option(arrManagementForms, -1) & "</select></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >注册资本：</td>" & vbCrLf
    Response.Write "                        <td><input name='RegisteredCapital' type='text' size='15' maxlength='20'> 万元</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                </table>" & vbCrLf

    Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF' id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>单位名称：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='Company' type='text' size='35' maxlength='100'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>所属部门：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='Department' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >职位：</td>" & vbCrLf
    Response.Write "                        <td><input name='Position' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >负责业务：</td>" & vbCrLf
    Response.Write "                        <td><input name='Operation' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >称谓：</td>" & vbCrLf
    Response.Write "                        <td><input name='Title' type='text' size='35' maxlength='20'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >单位地址：</td>" & vbCrLf
    Response.Write "                        <td><input name='CompanyAddress' type='text' size='35' maxlength='200'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                </table>" & vbCrLf

    Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF' id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>出生日期：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='Birthday' type='text' size='35' maxlength='10' onFocus=""PopCalendar.show(document.myform.Birthday, 'yyyy-mm-dd', null, null, null, '11');""></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>证件号码：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='IDCard' type='text' size='35' maxlength='20'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >籍贯：</td>" & vbCrLf
    Response.Write "                        <td><input name='NativePlace' type='text' size='35' maxlength='3'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >民族：</td>" & vbCrLf
    Response.Write "                        <td><input name='Nation' type='text' size='35' maxlength='3'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >性别：</td>" & vbCrLf
    Response.Write "                        <td><input name='Sex' type='radio' value='-1' checked>未知 <input name='Sex' type='radio' value='0'>男 <input name='Sex' type='radio' value='1'>女</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >婚姻状况：</td>" & vbCrLf
    Response.Write "                        <td><input name='Marriage' type='radio' value='0' checked> 未知 <input name='Marriage' type='radio' value='1'>未婚 <input name='Marriage' type='radio' value='2'>已婚 <input name='Marriage' type='radio' value='3'>离异</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >学历：</td>" & vbCrLf
    Response.Write "                        <td><select name='Education'>" & Array2Option(arrEducation, -1) & "</select></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >毕业学校：</td>" & vbCrLf
    Response.Write "                        <td><input name='GraduateFrom' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >生活爱好：</td>" & vbCrLf
    Response.Write "                        <td><input name='InterestsOfLife' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >文化爱好：</td>" & vbCrLf
    Response.Write "                        <td><input name='InterestsOfCulture' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >娱乐休闲爱好：</td>" & vbCrLf
    Response.Write "                        <td><input name='InterestsOfAmusement' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >体育爱好：</td>" & vbCrLf
    Response.Write "                        <td><input name='InterestsOfSport' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >其他爱好：</td>" & vbCrLf
    Response.Write "                        <td><input name='InterestsOfOther' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >月 收 入：</td>" & vbCrLf
    Response.Write "                        <td><select name='Income'>" & Array2Option(arrIncome, -1) & "</select></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >家庭情况：</td>" & vbCrLf
    Response.Write "                        <td colspan='3'><textarea name='Family' cols='75' rows='5' id='Family'></textarea></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                </table>" & vbCrLf
   
    Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF' id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>备注：</td>" & vbCrLf
    Response.Write "                        <td colspan='3'><input name='Remark' type='text' size='35'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                </table>" & vbCrLf
    
    Response.Write "            </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf
    Response.Write "<table width='100%' height='40'><tr align='center'><td>"
    Response.Write "    <input type='hidden' name='action' value='SaveAdd'>" & vbCrLf
    Response.Write "    <input type='submit' name='Submit' value='保存客户信息'>" & vbCrLf
    Response.Write "</td></tr></table>"
    Response.Write "</form>" & vbCrLf
End Sub


Sub Modify()
    If AdminPurview > 1 And arrPurview(2) = False And arrPurview(3) = False Then
        Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        Exit Sub
    End If

    Dim ClientID, ClientType
    Dim rsClient, Remark
    ClientID = Trim(Request("ClientID"))
    If ClientID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>参数不足！</li>"
        Exit Sub
    Else
        ClientID = CLng(ClientID)
    End If
    Set rsClient = Conn.Execute("select * from PE_Client where ClientID=" & ClientID & "")
    If rsClient.BOF And rsClient.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的客户！</li>"
        rsClient.Close
        Set rsClient = Nothing
        Exit Sub
    End If
    If rsClient("Owner") <> AdminName And AdminPurview > 1 And arrPurview(3) = False Then
        Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        rsClient.Close
        Set rsClient = Nothing
        Exit Sub
    End If
    ClientType = rsClient("ClientType")
    Remark = rsClient("Remark")
    Call PopCalendarInit
    Call ShowJS_Check

    Response.Write "<br><table width='100%'><tr><td align='left'>您现在的位置：<a href='Admin_Client.asp'>客户管理</a>&nbsp;&gt;&gt;&nbsp;修改客户信息</td></tr></table>"
    Response.Write "<form name='myform' id='myform' action='Admin_Client.asp' method='post' onSubmit='return CheckSubmit();'>" & vbCrLf
    Response.Write "<table  width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>" & vbCrLf
    Response.Write "        <tr align='center' height='24'>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title6' onclick='ShowTabs(0)'>基本信息</td>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(1)'>联络信息</td>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(2)'"
    If ClientType = 1 Then Response.Write " style='display:none'"
    Response.Write ">企业信息</td>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(3)'"
    If ClientType = 0 Then Response.Write " style='display:none'"
    Response.Write ">业务信息</td>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(4)'"
    If ClientType = 0 Then Response.Write " style='display:none'"
    Response.Write ">个人信息</td>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(5)'>备注信息</td>" & vbCrLf
    Response.Write "            <td>&nbsp;</td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf

    Response.Write "<table width='100%'  border='0' align='center' cellpadding='5' cellspacing='1' class='border'>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "            <td height='100' valign='top'>"
    Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF' id='Tabs' style='display:'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>客户名称：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='ClientName' type='text' id='ClientName' size='35' maxlength='200' value='" & rsClient("ClientName") & "'> <font color='#FF0000'>*</font></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>客户编号：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='ClientNum' type='text' id='ClientNum' size='35' maxlength='30' value='" & rsClient("ClientNum") & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >助记名称：</td>" & vbCrLf
    Response.Write "                        <td><input name='ShortedForm' type='text' id='ShortedForm' size='35' maxlength='20' value='" & rsClient("ShortedForm") & "'> <font color='#FF0000'>*</font></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >上级客户：</td>" & vbCrLf
    Response.Write "                        <td><input name='Parenter' type='text' id='Parenter' ReadOnly size='35' value='" & GetClientName(rsClient("ParentID")) & "'><input type='button' name='aaa' value='...' onclick='SelectParentClient()'><input type='hidden' name='ParentID' value='" & rsClient("ParentID") & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >区域：</td>" & vbCrLf
    Response.Write "                        <td><select name='Area'>" & Array2Option(arrArea, rsClient("Area")) & "</select></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >行业：</td>" & vbCrLf
    Response.Write "                        <td><select name='ClientField'>" & Array2Option(arrClientField, rsClient("ClientField")) & "</select></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >价值评估：</td>" & vbCrLf
    Response.Write "                        <td><select name='ValueLevel'>" & Array2Option(arrValueLevel, rsClient("ValueLevel")) & "</select></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >信用等级：</td>" & vbCrLf
    Response.Write "                        <td><select name='CreditLevel'>" & Array2Option(arrCreditLevel, rsClient("CreditLevel")) & "</select></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >重要程度：</td>" & vbCrLf
    Response.Write "                        <td><select name='Importance'>" & Array2Option(arrImportance, rsClient("Importance")) & "</select></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >关系等级：</td>" & vbCrLf
    Response.Write "                        <td><select name='ConnectionLevel'>" & Array2Option(arrConnectionLevel, rsClient("ConnectionLevel")) & "</select></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >客户来源：</td>" & vbCrLf
    Response.Write "                        <td><select name='SourceType'>" & Array2Option(arrSourceType, rsClient("SourceType")) & "</select></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >阶段：</td>" & vbCrLf
    Response.Write "                        <td><select name='PhaseType'>" & Array2Option(arrPhaseType, rsClient("PhaseType")) & "</select></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >客户组别：</td>" & vbCrLf
    Response.Write "                        <td><select name='GroupID'>" & Array2Option(arrGroupID, rsClient("GroupID")) & "</select></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >客户类别：</td>" & vbCrLf
    Response.Write "                        <td><Input type='radio' name='ClientType' value='0' onclick=""ChangeType(0)"""
    If ClientType = 0 Then Response.Write " checked"
    Response.Write ">企业客户 <Input type='radio' name='ClientType' value='1' onclick=""ChangeType(1)"""
    If ClientType = 1 Then Response.Write " checked"
    Response.Write ">个人客户</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                </table>" & vbCrLf
    rsClient.Close
    Set rsClient = Nothing

    Dim rsCompany, rsContacter
    Dim Country, Province, City, Address, ZipCode
    Dim Phone, Fax
    If ClientType = 0 Then
        Set rsCompany = Conn.Execute("select * from PE_Company where ClientID=" & ClientID & "")
        If rsCompany.BOF And rsCompany.EOF Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>找不到对应的企业信息！</li>"
        Else
            Country = rsCompany("Country")
            Province = rsCompany("Province")
            City = rsCompany("City")
            Address = rsCompany("Address")
            ZipCode = rsCompany("ZipCode")
            Phone = rsCompany("Phone")
            Fax = rsCompany("Fax")
        End If
    Else
        Set rsContacter = Conn.Execute("select * from PE_Contacter where ClientID=" & ClientID & "")
        If rsContacter.BOF And rsContacter.EOF Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>找不到对应的个人客户信息！</li>"
        Else
            Country = rsContacter("Country")
            Province = rsContacter("Province")
            City = rsContacter("City")
            Address = rsContacter("Address")
            ZipCode = rsContacter("ZipCode")
            Phone = ""
            Fax = ""
        End If
    End If
    If FoundErr = True Then
        Exit Sub
    End If

    Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF' id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td rowspan='2' class='tdbg5' align='right'  width='12%'>通讯地址：</td>" & vbCrLf
    Response.Write "                        <td colspan='3'>" & vbCrLf
    Response.Write "                            <iframe name='frm1' id='frm1' src='../Region.asp?Action=Modify&Country=" & Country & "&Province=" & Province & "&City=" & City & "' width='100%' height='75' frameborder='0' scrolling='no'></iframe>" & vbCrLf
    Response.Write "                            <input name='Country' id='Country' type='hidden'> <input name='Province' id='Province' type='hidden'> <input name='City' id='City' type='hidden'>" & vbCrLf
    Response.Write "                        </td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td colspan='3'>" & vbCrLf
    Response.Write "                            <table width='100%'  border='0' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>" & vbCrLf
    Response.Write "                                <tr class='tdbg'>" & vbCrLf
    Response.Write "                                    <td width='12%' align='right' class='tdbg5' align='right' >联系地址：</td>" & vbCrLf
    Response.Write "                                    <td><input name='Address' type='text' size='60' maxlength='255' value='" & Address & "'></td>" & vbCrLf
    Response.Write "                                </tr>" & vbCrLf
    Response.Write "                                <tr class='tdbg'>" & vbCrLf
    Response.Write "                                    <td align='right' class='tdbg5' align='right' >邮政编码：</td>" & vbCrLf
    Response.Write "                                    <td><input name='ZipCode' type='text' size='35' maxlength='10' value='" & ZipCode & "'></td>" & vbCrLf
    Response.Write "                                </tr>" & vbCrLf
    Response.Write "                            </table>" & vbCrLf
    Response.Write "                        </td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    
    Response.Write "<tbody id='infoE'"
    If ClientType = 1 Then Response.Write " style='display:none'"
    Response.Write ">"
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>联系电话：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='Phone' type='text' size='35' maxlength='30' value='" & Phone & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>传真号码：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='Fax1' type='text' size='35' maxlength='30' value='" & Fax & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "</tbody>" & vbCrLf
    
    If ClientType = 0 Then
        Response.Write "<tbody id='infoP' style='display:none'>"
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>办公电话：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='OfficePhone' type='text' size='35' maxlength='30'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>住宅电话：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='HomePhone' type='text' size='35' maxlength='30'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >移动电话：</td>" & vbCrLf
        Response.Write "                        <td><input name='Mobile' type='text' size='35' maxlength='30'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >传真号码：</td>" & vbCrLf
        Response.Write "                        <td><input name='Fax2' type='text' size='35' maxlength='30'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >小灵通：</td>" & vbCrLf
        Response.Write "                        <td><input name='PHS' type='text' size='35' maxlength='30'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' ></td>" & vbCrLf
        Response.Write "                        <td></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >个人主页：</td>" & vbCrLf
        Response.Write "                        <td><input name='Homepage2' type='text' size='35' maxlength='255'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >Email地址：</td>" & vbCrLf
        Response.Write "                        <td><input name='Email' type='text' size='35' maxlength='255'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >QQ号码：</td>" & vbCrLf
        Response.Write "                        <td><input name='QQ' type='text' size='35' maxlength='20'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >MSN帐号：</td>" & vbCrLf
        Response.Write "                        <td><input name='MSN' type='text' size='35' maxlength='255'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >ICQ号码：</td>" & vbCrLf
        Response.Write "                        <td><input name='ICQ' type='text' size='35' maxlength='25'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >雅虎通帐号：</td>" & vbCrLf
        Response.Write "                        <td><input name='Yahoo' type='text' size='35' maxlength='255'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >UC帐号：</td>" & vbCrLf
        Response.Write "                        <td><input name='UC' type='text' size='35' maxlength='255'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >Aim帐号：</td>" & vbCrLf
        Response.Write "                        <td><input name='Aim' type='text' size='35' maxlength='255'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "</tbody>" & vbCrLf
    Else
        Response.Write "<tbody id='infoP'>"
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>办公电话：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='OfficePhone' type='text' size='35' maxlength='30' value='" & rsContacter("OfficePhone") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>住宅电话：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='HomePhone' type='text' size='35' maxlength='30' value='" & rsContacter("HomePhone") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >移动电话：</td>" & vbCrLf
        Response.Write "                        <td><input name='Mobile' type='text' size='35' maxlength='30' value='" & rsContacter("Mobile") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >传真号码：</td>" & vbCrLf
        Response.Write "                        <td><input name='Fax2' type='text' size='35' maxlength='30' value='" & rsContacter("Fax") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >小灵通：</td>" & vbCrLf
        Response.Write "                        <td><input name='PHS' type='text' size='35' maxlength='30' value='" & rsContacter("PHS") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' ></td>" & vbCrLf
        Response.Write "                        <td></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >个人主页：</td>" & vbCrLf
        Response.Write "                        <td><input name='Homepage' type='text' size='35' maxlength='255' value='" & rsContacter("Homepage") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >Email地址：</td>" & vbCrLf
        Response.Write "                        <td><input name='Email' type='text' size='35' maxlength='255' value='" & rsContacter("Email") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >QQ号码：</td>" & vbCrLf
        Response.Write "                        <td><input name='QQ' type='text' size='35' maxlength='20' value='" & rsContacter("QQ") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >MSN帐号：</td>" & vbCrLf
        Response.Write "                        <td><input name='MSN' type='text' size='35' maxlength='255' value='" & rsContacter("MSN") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >ICQ号码：</td>" & vbCrLf
        Response.Write "                        <td><input name='ICQ' type='text' size='35' maxlength='25' value='" & rsContacter("ICQ") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >雅虎通帐号：</td>" & vbCrLf
        Response.Write "                        <td><input name='Yahoo' type='text' size='35' maxlength='255' value='" & rsContacter("Yahoo") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >UC帐号：</td>" & vbCrLf
        Response.Write "                        <td><input name='UC' type='text' size='35' maxlength='255' value='" & rsContacter("UC") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >Aim帐号：</td>" & vbCrLf
        Response.Write "                        <td><input name='Aim' type='text' size='35' maxlength='255' value='" & rsContacter("Aim") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "</tbody>" & vbCrLf
    End If

    Response.Write "                </table>" & vbCrLf

    If ClientType = 0 Then

        Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF' id='Tabs' style='display:none'>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>开户银行：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='BankOfDeposit' type='text' size='35' maxlength='255' value='" & rsCompany("BankOfDeposit") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>银行帐号：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='BankAccount' type='text' size='35' maxlength='255' value='" & rsCompany("BankAccount") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >税号：</td>" & vbCrLf
        Response.Write "                        <td><input name='TaxNum' type='text' size='35' maxlength='20' value='" & rsCompany("TaxNum") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >网址：</td>" & vbCrLf
        Response.Write "                        <td><input name='Homepage1' type='text' size='35' maxlength='100' value='" & rsCompany("Homepage") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >行业地位：</td>" & vbCrLf
        Response.Write "                        <td><select name='StatusInField'>" & Array2Option(arrStatusInField, rsCompany("StatusInField")) & "</select></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >公司规模：</td>" & vbCrLf
        Response.Write "                        <td><select name='CompanySize'>" & Array2Option(arrCompanySize, rsCompany("CompanySize")) & "</select></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >业务范围：</td>" & vbCrLf
        Response.Write "                        <td><input name='BusinessScope' type='text' size='35' maxlength='255' value='" & rsCompany("BusinessScope") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >年销售额：</td>" & vbCrLf
        Response.Write "                        <td><input name='AnnualSales' type='text' size='15' maxlength='20' value='" & rsCompany("AnnualSales") & "'> 万元</td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >经营状态：</td>" & vbCrLf
        Response.Write "                        <td><select name='ManagementForms'>" & Array2Option(arrManagementForms, rsCompany("ManagementForms")) & "</select></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >注册资本：</td>" & vbCrLf
        Response.Write "                        <td><input name='RegisteredCapital' type='text' size='15' maxlength='20' value='" & rsCompany("RegisteredCapital") & "'> 万元</td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                </table>" & vbCrLf

        Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF' id='Tabs' style='display:none'>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>单位名称：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='Company' type='text' size='35' maxlength='100'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>所属部门：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='Department' type='text' size='35' maxlength='30'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >职位：</td>" & vbCrLf
        Response.Write "                        <td><input name='Position' type='text' size='35' maxlength='30'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >负责业务：</td>" & vbCrLf
        Response.Write "                        <td><input name='Operation' type='text' size='35' maxlength='30'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >称谓：</td>" & vbCrLf
        Response.Write "                        <td><input name='Title' type='text' size='35' maxlength='20'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >单位地址：</td>" & vbCrLf
        Response.Write "                        <td><input name='CompanyAddress' type='text' size='35' maxlength='200'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                </table>" & vbCrLf

        Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF' id='Tabs' style='display:none'>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>出生日期：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='Birthday' type='text' size='35' maxlength='10' onFocus=""PopCalendar.show(document.myform.Birthday, 'yyyy-mm-dd', null, null, null, '11');""></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>证件号码：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='IDCard' type='text' size='35' maxlength='20'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >籍贯：</td>" & vbCrLf
        Response.Write "                        <td><input name='NativePlace' type='text' size='35' maxlength='3'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >民族：</td>" & vbCrLf
        Response.Write "                        <td><input name='Nation' type='text' size='35' maxlength='3'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >性别：</td>" & vbCrLf
        Response.Write "                        <td><input name='Sex' type='radio' value='-1' checked>未知 <input name='Sex' type='radio' value='0'>男 <input name='Sex' type='radio' value='1'>女</td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >婚姻状况：</td>" & vbCrLf
        Response.Write "                        <td><input name='Marriage' type='radio' value='0' checked> 未知 <input name='Marriage' type='radio' value='1'>未婚 <input name='Marriage' type='radio' value='2'>已婚 <input name='Marriage' type='radio' value='3'>离异</td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >学历：</td>" & vbCrLf
        Response.Write "                        <td><select name='Education'>" & Array2Option(arrEducation, -1) & "</select></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >毕业学校：</td>" & vbCrLf
        Response.Write "                        <td><input name='GraduateFrom' type='text' size='35' maxlength='255'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >生活爱好：</td>" & vbCrLf
        Response.Write "                        <td><input name='InterestsOfLife' type='text' size='35' maxlength='255'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >文化爱好：</td>" & vbCrLf
        Response.Write "                        <td><input name='InterestsOfCulture' type='text' size='35' maxlength='255'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >娱乐休闲爱好：</td>" & vbCrLf
        Response.Write "                        <td><input name='InterestsOfAmusement' type='text' size='35' maxlength='255'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >体育爱好：</td>" & vbCrLf
        Response.Write "                        <td><input name='InterestsOfSport' type='text' size='35' maxlength='255'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >其他爱好：</td>" & vbCrLf
        Response.Write "                        <td><input name='InterestsOfOther' type='text' size='35' maxlength='255'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >月 收 入：</td>" & vbCrLf
        Response.Write "                        <td><select name='Income'>" & Array2Option(arrIncome, -1) & "</select></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >家庭情况：</td>" & vbCrLf
        Response.Write "                        <td colspan='3'><textarea name='Family' cols='75' rows='5' id='Family'></textarea></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                </table>" & vbCrLf
    Else

        Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF' id='Tabs' style='display:none'>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>开户银行：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='BankOfDeposit' type='text' size='35' maxlength='255'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>银行帐号：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='BankAccount' type='text' size='35' maxlength='255'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >税号：</td>" & vbCrLf
        Response.Write "                        <td><input name='TaxNum' type='text' size='35' maxlength='20'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >网址：</td>" & vbCrLf
        Response.Write "                        <td><input name='Homepage' type='text' size='35' maxlength='100'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >行业地位：</td>" & vbCrLf
        Response.Write "                        <td><select name='StatusInField'>" & Array2Option(arrStatusInField, -1) & "</select></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >公司规模：</td>" & vbCrLf
        Response.Write "                        <td><select name='CompanySize'>" & Array2Option(arrCompanySize, -1) & "</select></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >业务范围：</td>" & vbCrLf
        Response.Write "                        <td><input name='BusinessScope' type='text' size='35' maxlength='255'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >年销售额：</td>" & vbCrLf
        Response.Write "                        <td><input name='AnnualSales' type='text' size='15' maxlength='20'> 万元</td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >经营状态：</td>" & vbCrLf
        Response.Write "                        <td><select name='ManagementForms'>" & Array2Option(arrManagementForms, -1) & "</select></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >注册资本：</td>" & vbCrLf
        Response.Write "                        <td><input name='RegisteredCapital' type='text' size='15' maxlength='20'> 万元</td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                </table>" & vbCrLf

        Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF' id='Tabs' style='display:none'>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>单位名称：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='Company' type='text' size='35' maxlength='100' value='" & rsContacter("Company") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>所属部门：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='Department' type='text' size='35' maxlength='30' value='" & rsContacter("Department") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >职位：</td>" & vbCrLf
        Response.Write "                        <td><input name='Position' type='text' size='35' maxlength='30' value='" & rsContacter("Position") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >负责业务：</td>" & vbCrLf
        Response.Write "                        <td><input name='Operation' type='text' size='35' maxlength='30' value='" & rsContacter("Operation") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >称谓：</td>" & vbCrLf
        Response.Write "                        <td><input name='Title' type='text' size='35' maxlength='20' value='" & rsContacter("TrueName") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >单位地址：</td>" & vbCrLf
        Response.Write "                        <td><input name='CompanyAddress' type='text' size='35' maxlength='200' value='" & rsContacter("CompanyAddress") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                </table>" & vbCrLf

        Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF' id='Tabs' style='display:none'>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>出生日期：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='Birthday' type='text' size='35' maxlength='10' value='" & rsContacter("Birthday") & "' onFocus=""PopCalendar.show(document.myform.Birthday, 'yyyy-mm-dd', null, null, null, '11');""></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right'  width='12%'>证件号码：</td>" & vbCrLf
        Response.Write "                        <td width='38%'><input name='IDCard' type='text' size='35' maxlength='20' value='" & rsContacter("IDCard") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >籍贯：</td>" & vbCrLf
        Response.Write "                        <td><input name='NativePlace' type='text' size='35' maxlength='3' value='" & rsContacter("NativePlace") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >民族：</td>" & vbCrLf
        Response.Write "                        <td><input name='Nation' type='text' size='35' maxlength='3' value='" & rsContacter("Nation") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >性别：</td>" & vbCrLf
        Response.Write "                        <td><input name='Sex' type='radio' value='-1' "
        If rsContacter("Sex") < 0 Or rsContacter("Sex") > 1 Then Response.Write " checked"
        Response.Write ">未知 <input name='Sex' type='radio' value='0'"
        If rsContacter("Sex") = 0 Then Response.Write " checked"
        Response.Write ">男 <input name='Sex' type='radio' value='1'"
        If rsContacter("Sex") = 1 Then Response.Write " checked"
        Response.Write ">女</td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >婚姻状况：</td>" & vbCrLf
        Response.Write "                        <td><input name='Marriage' type='radio' value='0'"
        If rsContacter("Marriage") = 0 Then Response.Write " checked"
        Response.Write ">未知 <input name='Marriage' type='radio' value='1'"
        If rsContacter("Marriage") = 1 Then Response.Write " checked"
        Response.Write ">未婚 <input name='Marriage' type='radio' value='2'"
        If rsContacter("Marriage") = 2 Then Response.Write " checked"
        Response.Write ">已婚 <input name='Marriage' type='radio' value='3'"
        If rsContacter("Marriage") = 3 Then Response.Write " checked"
        Response.Write ">离异</td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >学历：</td>" & vbCrLf
        Response.Write "                        <td><select name='Education'>" & Array2Option(arrEducation, rsContacter("Education")) & "</select></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >毕业学校：</td>" & vbCrLf
        Response.Write "                        <td><input name='GraduateFrom' type='text' size='35' maxlength='255' value='" & rsContacter("GraduateFrom") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >生活爱好：</td>" & vbCrLf
        Response.Write "                        <td><input name='InterestsOfLife' type='text' size='35' maxlength='255' value='" & rsContacter("InterestsOfLife") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >文化爱好：</td>" & vbCrLf
        Response.Write "                        <td><input name='InterestsOfCulture' type='text' size='35' maxlength='255' value='" & rsContacter("InterestsOfCulture") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >娱乐休闲爱好：</td>" & vbCrLf
        Response.Write "                        <td><input name='InterestsOfAmusement' type='text' size='35' maxlength='255' value='" & rsContacter("InterestsOfAmusement") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >体育爱好：</td>" & vbCrLf
        Response.Write "                        <td><input name='InterestsOfSport' type='text' size='35' maxlength='255' value='" & rsContacter("InterestsOfSport") & "'></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >其他爱好：</td>" & vbCrLf
        Response.Write "                        <td><input name='InterestsOfOther' type='text' size='35' maxlength='255' value='" & rsContacter("InterestsOfOther") & "'></td>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >月 收 入：</td>" & vbCrLf
        Response.Write "                        <td><select name='Income'>" & Array2Option(arrIncome, rsContacter("Income")) & "</select></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                    <tr class='tdbg'>" & vbCrLf
        Response.Write "                        <td class='tdbg5' align='right' >家庭情况：</td>" & vbCrLf
        Response.Write "                        <td colspan='3'><textarea name='Family' cols='75' rows='5' id='Family'>" & rsContacter("Family") & "</textarea></td>" & vbCrLf
        Response.Write "                    </tr>" & vbCrLf
        Response.Write "                </table>" & vbCrLf

    End If

    Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF' id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>备注：</td>" & vbCrLf
    Response.Write "                        <td colspan='3'><input name='Remark' value='" & Remark & "' type='text' size='35'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                </table>" & vbCrLf

    Response.Write "            </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf
    Response.Write "<table width='100%' height='40'><tr align='center'><td>"
    Response.Write "    <input type='hidden' name='action' value='SaveModify'><input type='hidden' name='ClientID' value='" & ClientID & "'>" & vbCrLf
    Response.Write "    <input type='submit' name='Submit' value='保存修改结果'>" & vbCrLf
    Response.Write "</td></tr></table>"
    Response.Write "</form>" & vbCrLf
    Set rsClient = Nothing
End Sub


Sub Show()
    Dim ClientID, ClientType
    Dim rsClient, sqlClient
    ClientID = PE_CLng(Trim(Request("ClientID")))
    If ClientID <= 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>参数不足！</li>"
        Exit Sub
    End If
    sqlClient = "select * from PE_Client where ClientID=" & ClientID
    Set rsClient = Conn.Execute(sqlClient)
    If rsClient.BOF And rsClient.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的客户！</li>"
        rsClient.Close
        Set rsClient = Nothing
        Exit Sub
    End If
    ClientType = rsClient("ClientType")


    Response.Write "<br><table width='100%'><tr><td align='left'>您现在的位置：<a href='Admin_Client.asp'>客户管理</a>&nbsp;&gt;&gt;&nbsp;查看客户信息：" & rsClient("ClientName") & "</td></tr></table>"
    Response.Write "<br><table  width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>" & vbCrLf
    Response.Write "        <tr align='center' height='24'>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title6' onclick='ShowTabs(0)'>基本信息</td>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(1)'>联络信息</td>" & vbCrLf
    If ClientType = 0 Then
        Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(2)'>企业信息</td>" & vbCrLf
        Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(3)'>相关信息</td>" & vbCrLf
        Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(4)'>备注信息</td>" & vbCrLf
    Else
        Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(2)'>业务信息</td>" & vbCrLf
        Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(3)'>个人信息</td>" & vbCrLf
        Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(4)'>相关信息</td>" & vbCrLf
        Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(5)'>备注信息</td>" & vbCrLf
    End If
    Response.Write "            <td>&nbsp;</td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf

    Response.Write "<table width='100%'  border='0' align='center' cellpadding='5' cellspacing='1' class='border'>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "            <td height='100' valign='top'>"
    Response.Write "                <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>" & vbCrLf
    Response.Write "                  <tbody id='Tabs'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>客户名称：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & rsClient("ClientName") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>客户编号：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & rsClient("ClientNum") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >助记名称：</td>" & vbCrLf
    Response.Write "                        <td>" & rsClient("ShortedForm") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >上级客户：</td>" & vbCrLf
    Response.Write "                        <td>" & GetClientName(rsClient("ParentID")) & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >区域：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrArea, rsClient("Area")) & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >行业：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrClientField, rsClient("ClientField")) & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >价值评估：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrValueLevel, rsClient("ValueLevel")) & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >信用等级：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrCreditLevel, rsClient("CreditLevel")) & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >重要程度：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrImportance, rsClient("Importance")) & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >关系等级：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrConnectionLevel, rsClient("ConnectionLevel")) & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >客户来源：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrSourceType, rsClient("SourceType")) & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >阶段：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrPhaseType, rsClient("PhaseType")) & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >客户组别：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrGroupID, rsClient("GroupID")) & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >客户类别：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(Array("企业客户", "个人客户"), ClientType) & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                </tbody>" & vbCrLf

    Dim rsCompany, rsContacter
    Dim Country, Province, City, Address, ZipCode
    If ClientType = 0 Then
        Set rsCompany = Conn.Execute("select * from PE_Company where ClientID=" & ClientID & "")
        If rsCompany.BOF And rsCompany.EOF Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>找不到对应的企业信息！</li>"
        Else
            Country = rsCompany("Country")
            Province = rsCompany("Province")
            City = rsCompany("City")
            Address = rsCompany("Address")
            ZipCode = rsCompany("ZipCode")
        End If
    Else
        Set rsContacter = Conn.Execute("select * from PE_Contacter where ClientID=" & ClientID & "")
        If rsContacter.BOF And rsContacter.EOF Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>找不到对应的个人客户信息！</li>"
        Else
            Country = rsContacter("Country")
            Province = rsContacter("Province")
            City = rsContacter("City")
            Address = rsContacter("Address")
            ZipCode = rsContacter("ZipCode")
        End If
    End If
    If FoundErr = True Then
        Exit Sub
    End If

    Response.Write "                  <tbody id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>国家/地区：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & Country & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>省/市：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & Province & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >市/县/区：</td>" & vbCrLf
    Response.Write "                        <td>" & City & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >邮政编码：</td>" & vbCrLf
    Response.Write "                        <td>" & ZipCode & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >联系地址：</td>" & vbCrLf
    Response.Write "                        <td colspan='3'>" & Address & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    
    If ClientType = 0 Then

    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >联系电话：</td>" & vbCrLf
    Response.Write "                        <td>" & rsCompany("Phone") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >传真号码：</td>" & vbCrLf
    Response.Write "                        <td>" & rsCompany("Fax") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "</tbody>" & vbCrLf
    
    
    Else

    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >办公电话：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("OfficePhone") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >住宅电话：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("HomePhone") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >移动电话：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Mobile") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >传真号码：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Fax") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >小灵通：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("PHS") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' ></td>" & vbCrLf
    Response.Write "                        <td></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >个人主页：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Homepage") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >Email地址：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Email") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >QQ号码：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("QQ") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >MSN帐号：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("MSN") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >ICQ号码：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("ICQ") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >雅虎通帐号：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Yahoo") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >UC帐号：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("UC") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >Aim帐号：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Aim") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    
    End If

    Response.Write "                </tbody>" & vbCrLf

    If ClientType = 0 Then

    Response.Write "                  <tbody id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>开户银行：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & rsCompany("BankOfDeposit") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>银行帐号：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & rsCompany("BankAccount") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >税号：</td>" & vbCrLf
    Response.Write "                        <td>" & rsCompany("TaxNum") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >网址：</td>" & vbCrLf
    Response.Write "                        <td>" & rsCompany("Homepage") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >行业地位：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrStatusInField, rsCompany("StatusInField")) & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >公司规模：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrCompanySize, rsCompany("CompanySize")) & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >业务范围：</td>" & vbCrLf
    Response.Write "                        <td>" & rsCompany("BusinessScope") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >年销售额：</td>" & vbCrLf
    Response.Write "                        <td>" & rsCompany("AnnualSales") & " 万元</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >经营状态：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrManagementForms, rsCompany("ManagementForms")) & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >注册资本：</td>" & vbCrLf
    Response.Write "                        <td>" & rsCompany("RegisteredCapital") & " 万元</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                </tbody>" & vbCrLf
    rsCompany.Close
    Set rsCompany = Nothing

    Else

    Response.Write "                  <tbody id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>单位名称：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & rsContacter("Company") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>所属部门：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & rsContacter("Department") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >职位：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Position") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >负责业务：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Operation") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >称谓：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Title") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >单位地址：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("CompanyAddress") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                </tbody>" & vbCrLf

    Response.Write "                  <tbody id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>出生日期：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & rsContacter("Birthday") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>证件号码：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & rsContacter("IDCard") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >籍贯：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("NativePlace") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >民族：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Nation") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >性别：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(Array("未知", "男", "女"), rsContacter("Sex") + 1) & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >婚姻状况：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(Array("未知", "未婚", "已婚", "离异"), rsContacter("Marriage")) & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >学历：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrEducation, rsContacter("Education")) & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >毕业学校：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("GraduateFrom") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >生活爱好：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("InterestsOfLife") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >文化爱好：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("InterestsOfCulture") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >娱乐休闲爱好：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("InterestsOfAmusement") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >体育爱好：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("InterestsOfSport") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >其他爱好：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("InterestsOfOther") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >月 收 入：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrIncome, rsContacter("Income")) & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >家庭情况：</td>" & vbCrLf
    Response.Write "                        <td colspan='3'>" & PE_HTMLEncode(rsContacter("Family")) & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                </tbody>" & vbCrLf
    rsContacter.Close
    Set rsContacter = Nothing
    End If

    Response.Write "                  <tbody id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>线索数量：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>机会数量：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>项目数量：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>订单数量：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>行动数量：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'> </td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>累计销售额：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>累计应收款：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>累计已收款：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>累计费用：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>回访次数：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>上次回访时间：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>服务次数：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>上次服务时间：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>投诉次数：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>上次投诉时间：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                </tbody>" & vbCrLf

    Response.Write "                  <tbody id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>创建者：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & rsClient("Owner") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>创建时间：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & rsClient("CreateTime") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>更新者：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & "" & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>更新时间：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & rsClient("UpdateTime") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>备注：</td>" & vbCrLf
    Response.Write "                        <td colspan='3'>" & PE_HTMLEncode(rsClient("Remark")) & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                  </tbody>" & vbCrLf
    Response.Write "                </table>" & vbCrLf


    Response.Write "            </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf
    Response.Write "<table width='100%' height='60'><tr align='center'><td>"
    If AdminPurview = 1 Or arrPurview(3) = True Or (arrPurview(2) = True And rsClient("Owner") = AdminName) Then
        Response.Write "<input type='button' name='modify' value='修改客户信息' onclick=""window.location.href='Admin_Client.asp?Action=Modify&ClientID=" & ClientID & "';"">"
    End If
    If ClientType = 0 And (AdminPurview = 1 Or arrPurview(1) = True) Then
        Response.Write "&nbsp;&nbsp;<input type='button' name='add' value='添加联系人' onclick=""window.location.href='Admin_Contacter.asp?Action=AddContacter&ClientID=" & ClientID & "';"">"
    End If
    If AdminPurview = 1 Or arrPurview(5) = True Then
        Response.Write "&nbsp;&nbsp;<input type='button' name='add' value='添加服务记录' onclick=""window.location.href='Admin_Service.asp?Action=Add&ClientID=" & ClientID & "';"">"
    End If
    If AdminPurview = 1 Or arrPurview(6) = True Then
        Response.Write "&nbsp;&nbsp;<input type='button' name='add' value='添加投诉记录' onclick=""window.location.href='Admin_Complain.asp?Action=Add&ClientID=" & ClientID & "';"">"
    End If
    If AdminPurview = 1 Then
        If PE_CLng(Conn.Execute("select count(0) from PE_User where ClientID=" & ClientID & "")(0)) = 0 Then
            Response.Write "&nbsp;&nbsp;<input type='button' name='Submit' value='添加银行汇款' onClick=""window.location.href='Admin_Client.asp?Action=AddRemit&ClientID=" & ClientID & "'"">"
            Response.Write "&nbsp;&nbsp;<input type='button' name='Submit' value='添加其他收入' onClick=""window.location.href='Admin_Client.asp?Action=AddIncome&ClientID=" & ClientID & "'"">"
            Response.Write "&nbsp;&nbsp;<input type='button' name='Submit' value='添加支出信息' onClick=""window.location.href='Admin_Client.asp?Action=AddPayment&ClientID=" & ClientID & "'"">"
        End If
    End If
    If AdminPurview = 1 Or arrPurview(4) = True Then
        Response.Write "&nbsp;&nbsp;<input type='button' name='modify' value='删除此客户' onclick=""window.location.href='Admin_Client.asp?Action=DelClient&ClientID=" & ClientID & "';"">"
    End If
    Response.Write "</td></tr></table>"

    Dim InfoType
    InfoType = PE_CLng(Trim(Request("InfoType")))

    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr align='center' height='24'>"
    Response.Write "<td"
    If InfoType = 0 Then
        Response.Write " class='title6'"
    Else
        Response.Write " class='title5' onclick=""window.location.href='Admin_Client.asp?Action=Show&ClientID=" & ClientID & "&InfoType=0'"""
    End If
    Response.Write ">联系人</td><td"
    If InfoType = 1 Then
        Response.Write " class='title6'"
    Else
        Response.Write " class='title5' onclick=""window.location.href='Admin_Client.asp?Action=Show&ClientID=" & ClientID & "&InfoType=1'"""
    End If
    Response.Write ">会员列表</td><td"
    If InfoType = 2 Then
        Response.Write " class='title6'"
    Else
        Response.Write " class='title5' onclick=""window.location.href='Admin_Client.asp?Action=Show&ClientID=" & ClientID & "&InfoType=2'"""
    End If
    Response.Write ">相关订单</td><td"
    If InfoType = 3 Then
        Response.Write " class='title6'"
    Else
        Response.Write " class='title5' onclick=""window.location.href='Admin_Client.asp?Action=Show&ClientID=" & ClientID & "&InfoType=3'"""
    End If
    Response.Write ">资金明细</td><td"
    If InfoType = 4 Then
        Response.Write " class='title6'"
    Else
        Response.Write " class='title5' onclick=""window.location.href='Admin_Client.asp?Action=Show&ClientID=" & ClientID & "&InfoType=4'"""
    End If
    Response.Write ">发票明细</td><td"
    If InfoType = 5 Then
        Response.Write " class='title6'"
    Else
        Response.Write " class='title5' onclick=""window.location.href='Admin_Client.asp?Action=Show&ClientID=" & ClientID & "&InfoType=5'"""
    End If
    Response.Write ">服务记录</td><td"
    If InfoType = 6 Then
        Response.Write " class='title6'"
    Else
        Response.Write " class='title5' onclick=""window.location.href='Admin_Client.asp?Action=Show&ClientID=" & ClientID & "&InfoType=6'"""
    End If
    Response.Write ">投诉记录</td>"
    Response.Write "<td>&nbsp;</td></tr></table>"
    
    strFileName = "Admin_Client.asp?Action=Show&ClientID=" & ClientID & "&InfoType=" & InfoType

    Select Case InfoType
    Case 0
        Call ShowContacterList(ClientID)
    Case 1
        Call ShowUserList(ClientID)
    Case 2
        If ClientType = 0 Then
            Call ShowOrderList(ClientID, rsClient("ShortedForm"))
        Else
            Call ShowOrderList(ClientID, rsClient("ClientName"))
        End If
    Case 3
        Call ShowBankrollList(ClientID)
    Case 4
        Call ShowInvoiceList(ClientID)
    Case 5
        Call ShowServiceList(ClientID)
    Case 6
        Call ShowComplainList(ClientID)
    End Select
    rsClient.Close
    Set rsClient = Nothing
End Sub

Sub ShowContacterList(ClientID)
    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0'>"
    Response.Write "  <tr>"
    Response.Write "  <form name='myform' method='Post' action='Admin_Contacter.asp'>"
    Response.Write "      <td>"
    Response.Write "      <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "        <tr class='title' height='22' align='center'>"
    Response.Write "          <td width='100'>姓 名</td>"
    Response.Write "          <td width='60'>称谓</td>"
    Response.Write "          <td width='90'>类型</td>"
    Response.Write "          <td width='100'>工作电话</td>"
    Response.Write "          <td width='100'>手机</td>"
    Response.Write "          <td>Email</td>"
    Response.Write "          <td>联系地址</td>"
    Response.Write "        </tr>"
    
    Dim sql, rsContacterList
    sql = "select C.ContacterID,C.TrueName,C.Title,C.OfficePhone,C.Mobile,C.Email,C.UserType,C.Owner,C.Address from PE_Contacter C where ClientID=" & ClientID & " and UserType>0"
    Set rsContacterList = Server.CreateObject("Adodb.RecordSet")
    rsContacterList.Open sql, Conn, 1, 1
    If rsContacterList.BOF And rsContacterList.EOF Then
        Response.Write "<tr><td colspan='20' height='50' align='center'>没有相关联系人</td></tr>"
    Else
        Do While Not rsContacterList.EOF
            Response.Write "      <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
            Response.Write "        <td align='center'><a href='Admin_Contacter.asp?Action=Show&ContacterID=" & rsContacterList("ContacterID") & "'>" & rsContacterList("TrueName") & "</a></td>"
            Response.Write "        <td width='60' align='center'>" & rsContacterList("Title") & "</td>"
            Response.Write "        <td width='90' align='center'>" & GetArrItem(Array("个人客户", "主联系人", "其他联系人"), rsContacterList("UserType")) & "</td>"
            Response.Write "        <td width='100' align='center'>" & rsContacterList("OfficePhone") & "</td>"
            Response.Write "        <td width='100' align='center'>" & rsContacterList("Mobile") & "</td>"
            Response.Write "        <td align='center'>" & rsContacterList("Email") & "</td>"
            Response.Write "        <td align='center'>" & rsContacterList("Address") & "</td>"
            Response.Write "      </tr>"

            rsContacterList.MoveNext
        Loop
    End If
    rsContacterList.Close
    Set rsContacterList = Nothing
    Response.Write "      </table>"
End Sub

Sub ShowUserList(ClientID)
    Response.Write "      <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "        <tr class='title' height='22' align='center'>"
    Response.Write "          <td width='70'> 用户名</td>"
    Response.Write "          <td>所属会员组</td>"
    Response.Write "          <td width='60'>资金余额</td>"
    Response.Write "          <td width='60'>可用点数</td>"
    Response.Write "          <td width='60'>剩余天数</td>"
    Response.Write "          <td width='60'>可用积分</td>"
    Response.Write "          <td width='90'>最后登录IP</td>"
    Response.Write "          <td width='120'>最后登录时间</td>"
    Response.Write "          <td width='60'>登录次数</td>"
    Response.Write "          <td width='40'>状态</td>"
    Response.Write "        </tr>"
    Dim sql, rsUserList
    Dim ValidDays, tmpDays
    sql = "select U.*,G.GroupName from PE_User U inner join PE_UserGroup G on U.GroupID=G.GroupID where ClientID=" & ClientID & ""
    Set rsUserList = Server.CreateObject("Adodb.RecordSet")
    rsUserList.Open sql, Conn, 1, 1
    If rsUserList.BOF And rsUserList.EOF Then
        Response.Write "<tr><td colspan='20' height='50' align='center'>没有相关会员</td></tr>"
    Else
        Do While Not rsUserList.EOF
            Response.Write "      <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
            Response.Write "        <td width='70' align='center'><a href='Admin_User.asp?Action=Show&UserID=" & rsUserList("UserID") & "'>" & rsUserList("UserName") & "</a></td>"
            Response.Write "        <td align='center'>" & rsUserList("GroupName") & "</td>"
            Response.Write "        <td width='60' align='right'>" & FormatNumber(rsUserList("Balance"), 2, vbTrue, vbFalse, vbTrue) & "</td>"
            Response.Write "        <td width='60' align='center'>"
            If rsUserList("UserPoint") <= 0 Then
                Response.Write "<font color=red>" & rsUserList("UserPoint") & "</font> 点"
            Else
                If rsUserList("UserPoint") <= 10 Then
                    Response.Write "<font color=blue>" & rsUserList("UserPoint") & "</font> 点"
                Else
                    Response.Write rsUserList("UserPoint") & " 点"
                End If
            End If
            Response.Write "</td>"
            Response.Write "        <td width='60' align='center'>"
            If rsUserList("ValidNum") = -1 Then
                Response.Write "无限期"
            Else
                If rsUserList("ValidUnit") = 1 Then
                    ValidDays = rsUserList("ValidNum")
                ElseIf rsUserList("ValidUnit") = 2 Then
                    ValidDays = rsUserList("ValidNum") * 30
                ElseIf rsUserList("ValidUnit") = 3 Then
                    ValidDays = rsUserList("ValidNum") * 365
                End If
                tmpDays = ValidDays - DateDiff("D", rsUserList("BeginTime"), Now())
                If tmpDays <= 0 Then
                    Response.Write "<font color='red'>" & tmpDays & "</font> 天"
                Else
                    Response.Write tmpDays & " 天"
                End If
            End If
            Response.Write "        </td>"
            Response.Write "        <td width='60' align='center'>" & PE_CLng(rsUserList("UserExp")) & "分</td>"
            Response.Write "        <td width='90' align='center'>" & rsUserList("LastLoginIP") & "</td>"
            Response.Write "        <td width='120' align='center'>" & rsUserList("LastLoginTime") & "</td>"
            Response.Write "        <td width='60' align='center'>"
            If rsUserList("LoginTimes") <> "" Then
                Response.Write rsUserList("LoginTimes")
            Else
                Response.Write "0"
            End If
            Response.Write "        </td>"
            Response.Write "        <td width='40' align='center'>"
            If rsUserList("IsLocked") = True Then
              Response.Write "<font color=red>已锁定</font>"
            Else
              Response.Write "正常"
            End If
            Response.Write "        </td>"
            Response.Write "      </tr>"
            rsUserList.MoveNext
        Loop
    End If
    rsUserList.Close
    Set rsUserList = Nothing
    Response.Write "      </table>"
End Sub

Sub ShowOrderList(ClientID, ClientName)
    Response.Write "<table width='100%'  border='0' cellspacing='1' cellpadding='2' class='border'>"
    Response.Write "  <tr align='center' class='title'>"
    Response.Write "    <td width='110'>订单编号</td>"
    Response.Write "    <td>客户名称</td>"
    Response.Write "    <td>用户名</td>"
    Response.Write "    <td width='120'>下单时间</td>"
    Response.Write "    <td width='70'>订单金额</td>"
    Response.Write "    <td width='70'>收款金额</td>"
    Response.Write "    <td width='30'>需要<br>发票</td>"
    Response.Write "    <td width='30'>已开<br>发票</td>"
    Response.Write "    <td width='50'>订单状态</td>"
    Response.Write "    <td width='50'>付款状态</td>"
    Response.Write "    <td width='50'>物流状态</td>"
    Response.Write "  </tr>"

    Dim rsOrderList, sqlOrderList, dblMoneyTotal1, dblMoneyTotal2
    dblMoneyTotal1 = 0
    dblMoneyTotal2 = 0
    sqlOrderList = "select * from PE_OrderForm where ClientID=" & ClientID & " order by OrderFormID desc"
    Set rsOrderList = Server.CreateObject("adodb.recordset")
    rsOrderList.Open sqlOrderList, Conn, 1, 1
    If rsOrderList.BOF And rsOrderList.EOF Then
        totalPut = 0
        Response.Write "<tr class='tdbg' height='50'><td colspan='20' align='center'>没有任何订单！</td></tr>"
    Else
        totalPut = rsOrderList.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
                rsOrderList.Move (CurrentPage - 1) * MaxPerPage
            Else
                CurrentPage = 1
            End If
        End If
    
        Dim i
        i = 0

        Dim OrderNum
        Do While Not rsOrderList.EOF
            dblMoneyTotal1 = dblMoneyTotal1 + rsOrderList("MoneyTotal")
            dblMoneyTotal2 = dblMoneyTotal2 + rsOrderList("MoneyReceipt")
    
            Response.Write "  <tr align='center' class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
            Response.Write "    <td width='110'><a href='Admin_Order.asp?Action=ShowOrder&OrderFormID=" & rsOrderList("OrderFormID") & "'>" & rsOrderList("OrderFormNum") & "</a></td>"
            Response.Write "    <td>" & ClientName & "</td>"
            Response.Write "    <td><a href='Admin_User.asp?Action=Show&UserName=" & rsOrderList("UserName") & "'>" & rsOrderList("UserName") & "</a></td>"
            Response.Write "    <td width='120'>" & rsOrderList("InputTime") & "</td>"
            Response.Write "    <td width='70' align='right'>" & FormatNumber(rsOrderList("MoneyTotal"), 2, vbTrue, vbFalse, vbTrue) & "</td>"
            Response.Write "    <td width='70' align='right'>"
            If rsOrderList("MoneyReceipt") < rsOrderList("MoneyTotal") Then
                Response.Write "<font color='red'>" & FormatNumber(rsOrderList("MoneyReceipt"), 2, vbTrue, vbFalse, vbTrue) & "</font>"
            Else
                Response.Write FormatNumber(rsOrderList("MoneyReceipt"), 2, vbTrue, vbFalse, vbTrue)
            End If
            Response.Write "</td>"
            Response.Write "    <td width='30'>"
            If rsOrderList("NeedInvoice") = True Then
                Response.Write "<font color='red'>√</font>"
            End If
            Response.Write "</td>"
            Response.Write "    <td width='30'>"
            If rsOrderList("NeedInvoice") = True Then
                If rsOrderList("Invoiced") = True Then
                    Response.Write "√"
                Else
                    Response.Write "<font color='red'>×</font>"
                End If
            End If
            Response.Write "</td>"
            Response.Write "           <td width='50'>"
            Select Case rsOrderList("Status")
                Case 0, 1
                    Response.Write "<font color='red'>等待确认</font>"
                Case 2, 3
                    Response.Write "<font color='blue'>已经确认</font>"
                Case 4
                    Response.Write "<font color='gray'>已结清</font>"
            End Select
            Response.Write "</td>"
            Response.Write "           <td width='50'>"
            If rsOrderList("MoneyTotal") > rsOrderList("MoneyReceipt") Then
                If rsOrderList("MoneyReceipt") > 0 Then
                    Response.Write "<font color='green'>已收定金</font>"
                Else
                    Response.Write "<font color='red'>等待汇款</font>"
                End If
            Else
                Response.Write "<font color='blue'>已经付清</font>"
            End If
            Response.Write "</td>"
            Response.Write "           <td width='50'>"
            Select Case rsOrderList("DeliverStatus")
                Case 0, 1
                    Response.Write "<font color='red'>配送中</font>"
                Case 2
                    Response.Write "<font color='blue'>已发货</font>"
                Case 3
                    Response.Write "<font color='green'>已签收</font>"
            End Select
            Response.Write "</td>"
            Response.Write "  </tr>"
    
            OrderNum = OrderNum + 1
            If OrderNum >= MaxPerPage Then Exit Do
            rsOrderList.MoveNext
        Loop
    End If
    rsOrderList.Close
    Set rsOrderList = Nothing

    Response.Write "  <tr align='center' class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
    Response.Write "    <td colspan='4' align='right'>合计：</td>"
    Response.Write "    <td width='70' align='right'>" & FormatNumber(dblMoneyTotal1, 2, vbTrue, vbFalse, vbTrue) & "</td>"
    Response.Write "    <td width='70' align='right'>" & FormatNumber(dblMoneyTotal2, 2, vbTrue, vbFalse, vbTrue) & "</td>"
    Response.Write "    <td colspan='5'> </td>"
    Response.Write "  </tr>"
    
    Dim dblCount, rsCount, dblCount2
    Set rsCount = Conn.Execute("select sum(MoneyTotal) from PE_OrderForm where ClientID=" & ClientID & "")
    If IsNull(rsCount(0)) Then
        dblCount = 0
    Else
        dblCount = rsCount(0)
    End If
    Set rsCount = Nothing
    Set rsCount = Conn.Execute("select sum(MoneyReceipt) from PE_OrderForm where ClientID=" & ClientID & "")
    If IsNull(rsCount(0)) Then
        dblCount2 = 0
    Else
        dblCount2 = rsCount(0)
    End If
    Set rsCount = Nothing
    
    Response.Write "         <tr align='center' class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
    Response.Write "           <td colspan='4' align='right'>总计金额：</td>"
    Response.Write "           <td align='right'>" & FormatNumber(dblCount, 2, vbTrue, vbFalse, vbTrue) & "</td>"
    Response.Write "           <td align='right'>" & FormatNumber(dblCount2, 2, vbTrue, vbFalse, vbTrue) & "</td>"
    Response.Write "           <td colspan='5'> </td>"
    Response.Write "         </tr>"
    Response.Write "</table>"
    Response.Write ShowPage(strFileName, totalPut, MaxPerPage, CurrentPage, True, True, "个订单", True)
End Sub

Sub ShowBankrollList(ClientID)
    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='60'>用户名</td>"
    Response.Write "    <td width='60'>交易方式</td>"
    Response.Write "    <td width='50'>币种</td>"
    Response.Write "    <td width='80'>收入金额</td>"
    Response.Write "    <td width='80'>支出金额</td>"
    Response.Write "    <td width='60'>银行名称</td>"
    Response.Write "    <td>备注/说明</td>"
    Response.Write "    <td>操作</td>"
    Response.Write "  </tr>"
    
    Dim rsBankroll, sqlBankroll, TotalIncome, TotalPayout
    TotalIncome = 0
    TotalPayout = 0
    sqlBankroll = "select * from PE_BankrollItem where ClientID=" & ClientID & " order by ItemID desc"
    Set rsBankroll = Server.CreateObject("Adodb.RecordSet")
    rsBankroll.Open sqlBankroll, Conn, 1, 1
    If rsBankroll.BOF And rsBankroll.EOF Then
        totalPut = 0
        Response.Write "<tr class='tdbg' height='50'><td colspan='20' align='center'>没有任何资金明细记录！</td></tr>"
    Else
        totalPut = rsBankroll.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
                rsBankroll.Move (CurrentPage - 1) * MaxPerPage
            Else
                CurrentPage = 1
            End If
        End If
    
        Dim i
        i = 0
        Do While Not rsBankroll.EOF
            If rsBankroll("Money") > 0 Then
                TotalIncome = TotalIncome + rsBankroll("Money")
            Else
                TotalPayout = TotalPayout + rsBankroll("Money")
            End If
    
            Response.Write "  <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
            Response.Write "    <td width='120' align='center'>" & rsBankroll("DateAndTime") & "</td>"
            Response.Write "    <td width='60' align='center'><a href='Admin_User.asp?Action=Show&InfoType=1&UserName=" & rsBankroll("UserName") & "'>" & rsBankroll("UserName") & "</a></td>"
            Response.Write "    <td width='60' align='center'>"
            Select Case rsBankroll("MoneyType")
            Case 1
                Response.Write "现金"
            Case 2
                Response.Write "银行汇款"
            Case 3
                Response.Write "在线支付"
            Case 4
                Response.Write "虚拟货币"
            End Select
            Response.Write "</td>"
            Response.Write "    <td width='50' align='center'>"
            Select Case rsBankroll("CurrencyType")
            Case 1
                Response.Write "人民币"
            Case 2
                Response.Write "美元"
            Case 3
                Response.Write "其他"
            End Select
            Response.Write "</td>"
            Response.Write "    <td width='80' align='right'>"
            If rsBankroll("Money") > 0 Then Response.Write FormatNumber(rsBankroll("Money"), 2, vbTrue, vbFalse, vbTrue)
            Response.Write "</td>"
            Response.Write "    <td width='80' align='right'>"
            If rsBankroll("Money") < 0 Then Response.Write FormatNumber(rsBankroll("Money"), 2, vbTrue, vbFalse, vbTrue)
            Response.Write "</td>"
            Response.Write "    <td align='center' width='60'>"
            If rsBankroll("MoneyType") = 3 Then
                Response.Write GetPayOnlineProviderName(rsBankroll("eBankID"))
            Else
                Response.Write rsBankroll("Bank")
            End If
            Response.Write "</td>"
            Response.Write "    <td align='center'>" & rsBankroll("Remark") & "</td>"
            Response.Write "    <td align='center'><a href='Admin_Bankroll.asp?Action=ShowDetail&ItemID=" & rsBankroll("ItemID") & "'>查看</a></td>"
            Response.Write "  </tr>"
    
            i = i + 1
            If i >= MaxPerPage Then Exit Do
            rsBankroll.MoveNext
        Loop
    End If
    rsBankroll.Close
    Set rsBankroll = Nothing

    Response.Write "  <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
    Response.Write "    <td colspan='4' align='right'>本页合计：</td>"
    Response.Write "    <td align='right'>" & FormatNumber(TotalIncome, 2, vbTrue, vbFalse, vbTrue) & "</td>"
    Response.Write "    <td align='right'>" & FormatNumber(Abs(TotalPayout), 2, vbTrue, vbFalse, vbTrue) & "</td>"
    Response.Write "    <td colspan='4' align='center'> </td>"
    
    Dim trs, TotalIncomeAll, TotalPayoutAll
    Set trs = Conn.Execute("select sum(Money) from PE_BankrollItem where Money>0 and ClientID=" & ClientID & "")
    If IsNull(trs(0)) Then
        TotalIncomeAll = 0
    Else
        TotalIncomeAll = trs(0)
    End If
    Set trs = Nothing
    Set trs = Conn.Execute("select sum(Money) from PE_BankrollItem where Money<0 and ClientID=" & ClientID & "")
    If IsNull(trs(0)) Then
        TotalPayoutAll = 0
    Else
        TotalPayoutAll = trs(0)
    End If
    Set trs = Nothing
    Response.Write "  <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
    Response.Write "    <td colspan='4' align='right'>总计金额：</td>"
    Response.Write "    <td align='right'>" & FormatNumber(TotalIncomeAll, 2, vbTrue, vbFalse, vbTrue) & "</td>"
    Response.Write "    <td align='right'>" & FormatNumber(Abs(TotalPayoutAll), 2, vbTrue, vbFalse, vbTrue) & "</td>"
    Response.Write "    <td colspan='4' align='center'>资金余额：" & FormatNumber(TotalIncomeAll - ABS(TotalPayoutAll), 2, vbTrue, vbFalse, vbTrue) & "</td>"
    Response.Write "  </tr>"
    Response.Write "  </tr>"
    Response.Write "</table>"
    Response.Write ShowPage(strFileName, totalPut, MaxPerPage, CurrentPage, True, True, "条资金明细记录", True)
End Sub

Sub ShowInvoiceList(ClientID)
    Response.Write "<table width='100%' border='0' cellpadding='2' cellspacing='1' class='border'>" & vbCrLf
    Response.Write "  <tr align='center' class='title'>" & vbCrLf
    Response.Write "    <td width='80'>日期</td>" & vbCrLf
    Response.Write "    <td width='120'>订单编号</td>" & vbCrLf
    Response.Write "    <td width='80'>发票类型</td>" & vbCrLf
    Response.Write "    <td width='120'>发票号码</td>" & vbCrLf
    Response.Write "    <td>发票抬头</td>" & vbCrLf
    Response.Write "    <td width='60'>发票金额</td>" & vbCrLf
    Response.Write "    <td width='60'>开票人</td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf

    Dim rsInvoice
    Set rsInvoice = Conn.Execute("select I.*,O.OrderFormNum from PE_InvoiceItem I left join PE_OrderForm O on I.OrderFormID=O.OrderFormID where I.ClientID=" & ClientID & " order by I.InvoiceID desc")
    If rsInvoice.BOF And rsInvoice.EOF Then
        Response.Write "<tr class='tdbg'><td colspan='20' height='50' align='center'>没有相关发票记录</td></tr>" & vbCrLf
    Else
        Do While Not rsInvoice.EOF
            Response.Write "  <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">" & vbCrLf
            Response.Write "    <td width='80' align='center'>" & rsInvoice("InvoiceDate") & "</td>" & vbCrLf
            Response.Write "    <td width='120' align='center'><a href='Admin_Order.asp?Action=ShowOrder&OrderFormID=" & rsInvoice("OrderFormID") & "'>" & rsInvoice("OrderFormNum") & "</a></td>"
            Response.Write "    <td width='80' align='center'>"
            Select Case rsInvoice("InvoiceType")
            Case 0
                Response.Write "地税普通发票"
            Case 1
                Response.Write "国税普通发票"
            Case 2
                Response.Write "增值税发票"
            End Select
            Response.Write "</td>" & vbCrLf
            Response.Write "    <td width='120' align='center'><a href='Admin_Invoice.asp?Action=Show&InvoiceID=" & rsInvoice("InvoiceID") & "'>" & rsInvoice("InvoiceNum") & "</a></td>" & vbCrLf
            Response.Write "    <td>" & rsInvoice("InvoiceTitle") & "</td>" & vbCrLf
            Response.Write "    <td width='60' align='right'>" & rsInvoice("TotalMoney") & "</td>" & vbCrLf
            Response.Write "    <td width='60' align='center'>" & rsInvoice("Drawer") & "</td>" & vbCrLf
            Response.Write "  </tr>" & vbCrLf

            rsInvoice.MoveNext
        Loop
    End If
    rsInvoice.Close
    Set rsInvoice = Nothing
    Response.Write "</table>" & vbCrLf
End Sub

Sub ShowServiceList(ClientID)
    Dim arrServiceType, arrServiceMode, arrTakeTime, arrResult, arrConfirmScore
    arrServiceType = GetArrFromDictionary("PE_ServiceItem", "ServiceType")
    arrServiceMode = GetArrFromDictionary("PE_ServiceItem", "ServiceMode")
    arrTakeTime = GetArrFromDictionary("PE_ServiceItem", "TakeTime")
    arrResult = GetArrFromDictionary("PE_ServiceItem", "Result")
    arrConfirmScore = GetArrFromDictionary("PE_ServiceItem", "ConfirmScore")

    Response.Write "<table width='100%'  border='0' cellpadding='2' cellspacing='1' class='border'>" & vbCrLf
    Response.Write "  <tr align='center' class='title'>" & vbCrLf
    Response.Write "    <td width='120'>服务时间</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 "    <td width='60' align='center'>服务人员</td>" & vbCrLf
    Response.Write "    <td width='60' align='center'>服务结果</td>" & vbCrLf
    Response.Write "    <td width='60' align='center'>回访确认</td>" & vbCrLf
    Response.Write "    <td width='60' align='center'>客户评价</td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Dim rsService
    Set rsService = Conn.Execute("select * from PE_ServiceItem where ClientID=" & ClientID & "")
    If rsService.BOF And rsService.EOF Then
        Response.Write "<tr><td colspan='10' height='50' align='center' class='tdbg'>没有相关服务记录！</td></tr>"
    Else
        Do While Not rsService.EOF
            Response.Write "  <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">" & vbCrLf
            Response.Write "    <td width='120'>" & rsService("ServiceTime") & "</td>" & vbCrLf
            Response.Write "    <td><a href='Admin_Service.asp?Action=Show&ItemID=" & rsService("ItemID") & "'>" & rsService("ServiceTitle") & "</a></td>" & vbCrLf
            Response.Write "    <td width='60' align='center'>" & GetArrItem(arrServiceType, rsService("ServiceType")) & "</td>" & vbCrLf
            Response.Write "    <td width='60' align='center'>" & GetArrItem(arrServiceMode, rsService("ServiceMode")) & "</td>" & vbCrLf
            Response.Write "    <td width='60' align='center'>" & rsService("Processor") & "</td>" & vbCrLf
            Response.Write "    <td width='60' align='center'>" & GetArrItem(arrResult, rsService("ServiceResult")) & "</td>" & vbCrLf
            Response.Write "    <td width='60' align='center'>"
            If rsService("ConfirmTime") <> "" Then
                Response.Write "<strong>√</strong>"
            End If
            Response.Write "</td>" & vbCrLf
            Response.Write "    <td width='60' align='center'>"
            If rsService("ConfirmTime") <> "" Then
                Response.Write GetArrItem(arrConfirmScore, rsService("ConfirmScore"))
            End If
            Response.Write "</td>" & vbCrLf
            Response.Write "  </tr>" & vbCrLf
            rsService.MoveNext
        Loop
    End If
    Set rsService = Nothing
    Response.Write "</table>" & vbCrLf
End Sub

Sub ShowComplainList(ClientID)
    Dim arrComplainType, arrComplainMode, arrMagnitudeOfExigence, arrStatus, arrConfirmScore
    arrComplainType = GetArrFromDictionary("PE_ComplainItem", "ComplainType")
    arrComplainMode = GetArrFromDictionary("PE_ComplainItem", "ComplainMode")
    arrMagnitudeOfExigence = GetArrFromDictionary("PE_ComplainItem", "MagnitudeOfExigence")
    arrStatus = Array("未处理", "处理中", "已处理", "已回访")
    arrConfirmScore = GetArrFromDictionary("PE_ServiceItem", "ConfirmScore")

    Response.Write "<table width='100%'  border='0' cellpadding='2' cellspacing='1' class='border'>" & vbCrLf
    Response.Write "  <tr align='center' class='title'>" & vbCrLf
    Response.Write "    <td width='120'>投诉时间</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 "    <td width='60' align='center'>处理人</td>" & vbCrLf
    Response.Write "    <td width='60' align='center'>处理时间</td>" & vbCrLf
    Response.Write "    <td width='60' align='center'>处理结果</td>" & vbCrLf
'    Response.Write "    <td width='60' align='center'>回访人</td>" & vbCrLf
'    Response.Write "    <td width='60' align='center'>回访时间</td>" & vbCrLf
'    Response.Write "    <td width='60' align='center'>客户评分</td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Dim rsComplain
    Set rsComplain = Conn.Execute("select * from PE_ComplainItem where ClientID=" & ClientID & "")
    If rsComplain.BOF And rsComplain.EOF Then
        Response.Write "<tr><td colspan='20' height='50' align='center' class='tdbg'>没有任何投诉记录！</td></tr>"
    Else
        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='80' align='center'>" & GetArrItem(arrComplainType, rsComplain("ComplainType")) & "</td>" & vbCrLf
            Response.Write "    <td><a href='Admin_Complain.asp?Action=Show&ItemID=" & rsComplain("ItemID") & "'>" & rsComplain("Title") & "</a></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 width='60' align='center'>" & rsComplain("Processor") & "</td>" & vbCrLf
            Response.Write "    <td width='60' align='center'>" & rsComplain("EndTime") & "</td>" & vbCrLf
            Response.Write "    <td width='60' align='center'>" & rsComplain("Result") & "</td>" & vbCrLf
'            Response.Write "    <td width='60' align='center'>" & rsComplain("ConfirmCaller") & "</td>" & vbCrLf
'            Response.Write "    <td width='60' align='center'>" & rsComplain("EndTime") & "</td>" & vbCrLf
'            Response.Write "    <td width='60' align='center'>" & String(PE_Clng(rsComplain("ConfirmStar")),"★") & "</td>" & vbCrLf
            Response.Write "  </tr>" & vbCrLf
            rsComplain.MoveNext
        Loop
    End If
    Set rsComplain = Nothing
    Response.Write "</table>" & vbCrLf
End Sub

Sub AddIncome(IncomeType)
    Dim ClientID, rsClient
    ClientID = PE_CLng(Trim(Request("ClientID")))
    If ClientID <= 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定客户ID！"
    End If
    If FoundErr = True Then Exit Sub

    Set rsClient = Conn.Execute("select ClientName,Balance from PE_Client where ClientID=" & ClientID & "")
    If rsClient.BOF And rsClient.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的ID！</li>"
        Set rsClient = Nothing
        Exit Sub
    End If

    Response.Write "<form name='form4' method='post' action='Admin_Client.asp' onsubmit=""return confirm('确定所输入的信息都完全正确吗？一旦输入就不可更改哦！')"">"
    Response.Write "  <table width='100%' border='0' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "    <tr align='center' class='title'>"
    If IncomeType = 1 Then
        Response.Write "      <td height='22' colspan='2'>添 加 客 户 汇 款 信 息</td>"
    Else
        Response.Write "      <td height='22' colspan='2'>添 加 客 户 其 他 收 入</td>"
    End If
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td align='right' width='15%' class='tdbg5'>客户名称：</td>"
    Response.Write "      <td align='left'><input name='UserName' type='text' id='ClientName' value='" & rsClient("ClientName") & "' size='30' maxlength='50' disabled></td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td align='right' width='15%' class='tdbg5'>资金余额：</td>"
    Response.Write "      <td align='left'><input name='Balance' type='text' id='Balance' value='" & rsClient("Balance") & "元' size='30' maxlength='50' disabled></td>"
    Response.Write "    </tr>"
    If IncomeType = 1 Then '银行汇款
        Response.Write "    <tr class='tdbg'>"
        Response.Write "      <td align='right' width='15%' class='tdbg5'>汇款日期：</td>"
        Response.Write "      <td align='left'><input name='ReceiptDate' type='text' id='ReceiptDate' value='" & Date & "' size='15' maxlength='30'></td>"
        Response.Write "    </tr>"
        Response.Write "    <tr class='tdbg'>"
        Response.Write "      <td align='right' width='15%' class='tdbg5'>汇款金额：</td>"
        Response.Write "      <td align='left'><input name='Money' type='text' id='Money' value='' size='10' maxlength='20'> 元</td>"
        Response.Write "    </tr>"
        Response.Write "    <tr class='tdbg'>"
        Response.Write "      <td align='right' width='15%' class='tdbg5'>汇入银行：</td>"
        Response.Write "      <td align='left'><select name='Bank' id='Bank'>"
        Dim rsBank
        Set rsBank = Conn.Execute("select BankShortName,IsDefault from PE_Bank where IsDisabled=" & PE_False & " order by OrderID")
        Do While Not rsBank.EOF
            Response.Write "<option value='" & rsBank(0) & "'"
            If rsBank(1) = True Then Response.Write " selected"
            Response.Write ">" & rsBank(0) & "</option>"
            rsBank.MoveNext
        Loop
        Set rsBank = Nothing
        Response.Write "      </select></td>"
        Response.Write "    </tr>"
    Else
        Response.Write "    <tr class='tdbg'>"
        Response.Write "      <td align='right' width='15%' class='tdbg5'>收入金额：</td>"
        Response.Write "      <td align='left'><input name='Money' type='text' id='Money' size='10' maxlength='20'> 元</td>"
        Response.Write "    </tr>"
    End If
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td align='right' width='15%' class='tdbg5'>备注：</td>"
    Response.Write "      <td align='left'><input name='Remark' type='text' id='Remark' size='50' maxlength='200'></td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td height='30' colspan='2'><font color='#FF0000'>注意：汇款/收入信息一旦录入，就不能再修改或删除！所以在保存之前确认输入无误！</font></td>"
    Response.Write "    </tr>"
    Response.Write "    <tr align='center' class='tdbg'>"
    Response.Write "      <td height='30' colspan='2'>"
    Response.Write "      <input name='ClientID' type='hidden' id='ClientID' value='" & ClientID & "'>"
    If IncomeType = 1 Then
        Response.Write "      <input name='Action' type='hidden' id='Action' value='SaveRemit'>"
        Response.Write "      <input type='submit' name='Submit' value=' 保存汇款信息 '></td>"
    Else
        Response.Write "      <input name='Action' type='hidden' id='Action' value='SaveIncome'>"
        Response.Write "      <input type='submit' name='Submit' value=' 保存收入信息 '></td>"
    End If
    Response.Write "    </tr>"
    Response.Write "  </table>"
    Response.Write "</form>"
    Set rsClient = Nothing
End Sub

Sub AddPayment()
    Dim ClientID, ClientName, Balance, OrderFormID, Money, trs, Remark
    Dim rsOrderForm, sqlOrderForm
    ClientID = PE_CLng(Trim(Request("ClientID")))
    OrderFormID = PE_CLng(Trim(Request("OrderFormID")))
    If ClientID <= 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定客户ID！"
    End If
    
    If FoundErr = True Then Exit Sub
    
    Set trs = Conn.Execute("select ClientName,Balance from PE_Client where ClientID=" & ClientID & "")
    If trs.BOF And trs.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的客户！</li>"
    Else
        ClientName = trs(0)
        Balance = trs(1)
    End If
    Set trs = Nothing

    If Balance <= 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>客户的资金余额不足！</li>"
    End If
    
    If FoundErr = True Then Exit Sub
    
    If OrderFormID > 0 Then
        sqlOrderForm = "select OrderFormNum,Status,MoneyTotal,MoneyReceipt from PE_OrderForm where OrderFormID=" & OrderFormID
        Set rsOrderForm = Conn.Execute(sqlOrderForm)
        If rsOrderForm.BOF And rsOrderForm.EOF Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>找不到指定的订单！</li>"
            rsOrderForm.Close
            Set rsOrderForm = Nothing
            Exit Sub
        End If
        If rsOrderForm("MoneyTotal") <= rsOrderForm("MoneyReceipt") Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>此订单已经付清，无需再支付！</li>"
            rsOrderForm.Close
            Set rsOrderForm = Nothing
            Exit Sub
        End If
        Money = rsOrderForm("MoneyTotal") - rsOrderForm("MoneyReceipt")
        If Balance <= Money Then
            Money = Balance
        End If
        Remark = "支付订单费用。订单编号：" & rsOrderForm("OrderFormNum")
    End If

    Response.Write "<form name='form4' method='post' action='Admin_Client.asp' onsubmit=""return confirm('确定所输入的信息都完全正确吗？一旦输入就不可更改哦！')"">"
    Response.Write "  <table width='100%' border='0' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "    <tr align='center' class='title'>"
    Response.Write "      <td height='22' colspan='2'>添 加 客 户 支 出 信 息</td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td align='right' width='15%' class='tdbg5'>客户名称：</td>"
    Response.Write "      <td align='left'><input name='ClientName' type='text' id='UserName' value='" & ClientName & "' size='30' maxlength='50' disabled></td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td align='right' width='15%' class='tdbg5'>资金余额：</td>"
    Response.Write "      <td align='left'><input name='Balance' type='text' id='Balance' value='" & Balance & "' size='30' maxlength='50' disabled></td>"
    Response.Write "    </tr>"
    If OrderFormID > 0 Then
        Response.Write "    <tr class='tdbg'>"
        Response.Write "      <td align='right' width='15%' class='tdbg5'>支付内容：</td>"
        Response.Write "      <td align='left'><table  border='0' cellspacing='2' cellpadding='0'>"
        Response.Write "        <tr>"
        Response.Write "          <td align='right' width='15%' class='tdbg5'>订单编号：</td>"
        Response.Write "          <td align='left'><input name='OrderFormNum' type='text' id='OrderFormNum' value='" & rsOrderForm("OrderFormNum") & "' size='30' maxlength='30' disabled></td>"
        Response.Write "        </tr>"
        Response.Write "        <tr>"
        Response.Write "          <td align='right' width='15%' class='tdbg5'>订单金额：</td>"
        Response.Write "          <td align='left'><input name='MoneyTotal' type='text' id='MoneyTotal' value='" & rsOrderForm("MoneyTotal") & "元' size='30' maxlength='30' disabled></td>"
        Response.Write "        </tr>"
        Response.Write "        <tr>"
        Response.Write "          <td align='right' width='15%' class='tdbg5'>已 付 款：</td>"
        Response.Write "          <td align='left'><input name='MoneyTotal' type='text' id='MoneyTotal' value='" & rsOrderForm("MoneyReceipt") & "元' size='30' maxlength='30' disabled></td>"
        Response.Write "        </tr>"
        Response.Write "      </table></td>"
        Response.Write "    </tr>"

        rsOrderForm.Close
        Set rsOrderForm = Nothing
    End If

    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td align='right' width='15%' class='tdbg5'>支出金额：</td>"
    Response.Write "      <td align='left'><input name='Money' type='text' id='Money' value='" & Money & "' size='10' maxlength='20'> 元</td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td align='right' width='15%' class='tdbg5'>备注：</td>"
    Response.Write "      <td align='left'><input name='Remark' type='text' id='Remark' size='50' maxlength='200' value='" & Remark & "'></td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td height='30' colspan='2'><font color='#FF0000'>注意：支出信息一旦录入，就不能再修改或修改！所以在保存之前确认输入无误！</font></td>"
    Response.Write "    </tr>"
    Response.Write "    <tr align='center' class='tdbg'>"
    Response.Write "      <td height='30' colspan='2'><input name='Action' type='hidden' id='Action' value='SavePayment'>"
    Response.Write "      <input name='OrderFormID' type='hidden' id='OrderFormID' value='" & OrderFormID & "'>"
    Response.Write "      <input name='ClientID' type='hidden' id='ClientID' value='" & ClientID & "'>"
    Response.Write "      <input type='submit' name='Submit' value=' 保存支付信息 '></td>"
    Response.Write "    </tr>"
    Response.Write "  </table>"
    Response.Write "</form>"
End Sub

Sub SaveClient()
    Dim ClientID, ClientName, ClientNum, ClientType, ShortedForm

    ClientID = PE_CLng(Trim(Request.Form("ClientID")))
    ClientType = PE_CLng(Trim(Request.Form("ClientType")))
    ClientNum = Trim(Request.Form("ClientNum"))
    ClientName = Trim(Request.Form("ClientName"))
    ShortedForm = Trim(Request.Form("ShortedForm"))

    If ClientName = "" Then
        FoundErr = True
        ErrMsg = "客户名称不能为空！"
    End If
    If ShortedForm = "" Then
        FoundErr = True
        ErrMsg = "客户简称（助记码）不能为空！"
    End If

    If FoundErr Then
        Exit Sub
    End If

    Dim sqlClient, rsClient
    Dim sqlCompany, rsCompany, CompanyID
    Dim sqlContacter, rsContacter, ContacterID

    Set rsClient = Server.CreateObject("adodb.recordset")
    Set rsCompany = Server.CreateObject("adodb.recordset")
    Set rsContacter = Server.CreateObject("adodb.recordset")

    If Action = "SaveAdd" Then
        If AdminPurview > 1 And arrPurview(1) = False And arrPurview(3) = False Then
            Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
            Call WriteEntry(6, AdminName, "越权操作")
            Exit Sub
        End If
        ClientID = GetNewID("PE_Client", "ClientID")
        sqlClient = "SELECT top 1 * FROM PE_Client"
        rsClient.Open sqlClient, Conn, 1, 3
        rsClient.addnew
        rsClient("ClientID") = ClientID
        rsClient("CreateTime") = Now()
        rsClient("Owner") = AdminName
        If ClientType = 0 Then
            sqlCompany = "select top 1 * From PE_Company"
            rsCompany.Open sqlCompany, Conn, 1, 3
            rsCompany.addnew
            rsCompany("CompanyID") = GetNewID("PE_Company", "CompanyID")
        Else
            sqlContacter = "select top 1 * From PE_Contacter"
            rsContacter.Open sqlContacter, Conn, 1, 3
            rsContacter.addnew
            rsContacter("ContacterID") = GetNewID("PE_Contacter", "ContacterID")
            rsContacter("CreateTime") = Now()
            rsContacter("Owner") = AdminName
        End If
    Else
        If AdminPurview > 1 And arrPurview(2) = False And arrPurview(3) = False Then
            Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
            Call WriteEntry(6, AdminName, "越权操作")
            Exit Sub
        End If

        sqlClient = "SELECT * FROM PE_Client Where ClientID=" & ClientID & ""
        rsClient.Open sqlClient, Conn, 1, 3
        If rsClient.BOF And rsClient.EOF Then
            FoundErr = True
            ErrMsg = "找不到指定的客户！"
        Else
            If rsClient("Owner") <> AdminName And AdminPurview > 1 And arrPurview(3) = False Then
                Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
                Call WriteEntry(6, AdminName, "越权操作")
                rsClient.Close
                Set rsClient = Nothing
                Exit Sub
            End If

            If ClientType <> rsClient("ClientType") Then
                If rsClient("ClientType") = 0 Then
                    Conn.Execute ("delete from PE_Company where ClientID=" & rsClient("ClientID") & "")
                    Conn.Execute ("delete from PE_Contacter where ClientID=" & rsClient("ClientID") & " and UserType>1")
                    Conn.Execute ("update PE_Contacter set UserType=0 where ClientID=" & rsClient("ClientID") & " and UserType=1")
                Else
                    Conn.Execute ("delete from PE_Contacter where ClientID=" & rsClient("ClientID") & "")
                End If
            End If
            If ClientType = 0 Then
                sqlCompany = "select * From PE_Company Where ClientID=" & ClientID & ""
                rsCompany.Open sqlCompany, Conn, 1, 3
                If rsCompany.BOF And rsCompany.EOF Then
                    rsCompany.addnew
                    rsCompany("CompanyID") = GetNewID("PE_Company", "CompanyID")
                End If
            Else
                sqlContacter = "select * From PE_Contacter Where ClientID=" & ClientID & " and UserType=0"
                rsContacter.Open sqlContacter, Conn, 1, 3
                If rsContacter.BOF And rsContacter.EOF Then
                    rsContacter.addnew
                    rsContacter("ContacterID") = GetNewID("PE_Contacter", "ContacterID")
                    rsContacter("CreateTime") = Now()
                    rsContacter("Owner") = AdminName
                End If
            End If
        End If
    End If
    If FoundErr Then
        rsClient.Close
        Set rsClient = Nothing
        Exit Sub
    End If

    rsClient("ClientName") = ClientName
    rsClient("ClientNum") = ClientNum
    rsClient("ClientType") = ClientType
    rsClient("ShortedForm") = ShortedForm
    rsClient("Area") = PE_CLng(Trim(Request.Form("Area")))
    rsClient("ClientField") = PE_CLng(Trim(Request.Form("ClientField")))
    rsClient("ValueLevel") = PE_CLng(Trim(Request.Form("ValueLevel")))
    rsClient("CreditLevel") = PE_CLng(Trim(Request.Form("CreditLevel")))
    rsClient("Importance") = PE_CLng(Trim(Request.Form("Importance")))
    rsClient("ConnectionLevel") = PE_CLng(Trim(Request.Form("ConnectionLevel")))
    rsClient("SourceType") = PE_CLng(Trim(Request.Form("SourceType")))
    rsClient("GroupID") = PE_CLng(Trim(Request.Form("GroupID")))
    rsClient("ParentID") = PE_CLng(Trim(Request.Form("ParentID")))
    rsClient("PhaseType") = PE_CLng(Trim(Request.Form("PhaseType")))
    rsClient("Remark") = Trim(Request.Form("Remark"))
    rsClient("UpdateTime") = Now()
    rsClient.Update
    rsClient.Close
    Set rsClient = Nothing

    If ClientType = 0 Then
        rsCompany("ClientID") = ClientID
        rsCompany("Country") = Trim(Request.Form("Country"))
        rsCompany("Province") = Trim(Request.Form("Province"))
        rsCompany("City") = Trim(Request.Form("City"))
        rsCompany("Address") = Trim(Request.Form("Address"))
        rsCompany("ZipCode") = Trim(Request.Form("ZipCode"))
        rsCompany("Phone") = Trim(Request.Form("Phone"))
        rsCompany("Fax") = Trim(Request.Form("Fax1"))
        rsCompany("HomePage") = Trim(Request.Form("Homepage1"))
        rsCompany("BankOfDeposit") = Trim(Request.Form("BankOfDeposit"))
        rsCompany("BankAccount") = Trim(Request.Form("BankAccount"))
        rsCompany("TaxNum") = Trim(Request.Form("TaxNum"))
        rsCompany("StatusInField") = PE_CLng(Trim(Request.Form("StatusInField")))
        rsCompany("CompanySize") = PE_CLng(Trim(Request.Form("CompanySize")))
        rsCompany("BusinessScope") = Trim(Request.Form("BusinessScope"))
        rsCompany("AnnualSales") = Trim(Request.Form("AnnualSales"))
        rsCompany("ManagementForms") = PE_CLng(Trim(Request.Form("ManagementForms")))
        rsCompany("RegisteredCapital") = Trim(Request.Form("RegisteredCapital"))
        rsCompany.Update
        rsCompany.Close
        Set rsCompany = Nothing
    Else
        rsContacter("ClientID") = ClientID
        rsContacter("ParentID") = 0
        rsContacter("UserType") = 0
        rsContacter("TrueName") = ClientName
        rsContacter("Country") = Trim(Request.Form("Country"))
        rsContacter("Province") = Trim(Request.Form("Province"))
        rsContacter("City") = Trim(Request.Form("City"))
        rsContacter("ZipCode") = Trim(Request.Form("ZipCode"))
        rsContacter("Address") = Trim(Request.Form("Address"))
        rsContacter("Mobile") = Trim(Request.Form("Mobile"))
        rsContacter("OfficePhone") = Trim(Request.Form("OfficePhone"))
        rsContacter("HomePhone") = Trim(Request.Form("HomePhone"))
        rsContacter("PHS") = Trim(Request.Form("PHS"))
        rsContacter("Fax") = Trim(Request.Form("Fax2"))
        rsContacter("Homepage") = Trim(Request.Form("Homepage2"))
        rsContacter("Email") = Trim(Request.Form("Email"))
        rsContacter("QQ") = Trim(Request.Form("QQ"))
        rsContacter("MSN") = Trim(Request.Form("MSN"))
        rsContacter("ICQ") = Trim(Request.Form("ICQ"))
        rsContacter("Yahoo") = Trim(Request.Form("Yahoo"))
        rsContacter("UC") = Trim(Request.Form("UC"))
        rsContacter("Aim") = Trim(Request.Form("Aim"))
        rsContacter("Company") = Trim(Request.Form("Company"))
        rsContacter("Department") = Trim(Request.Form("Department"))
        rsContacter("Position") = Trim(Request.Form("Position"))
        rsContacter("Operation") = Trim(Request.Form("Operation"))
        rsContacter("Title") = Trim(Request.Form("Title"))
        rsContacter("CompanyAddress") = Trim(Request.Form("CompanyAddress"))
        rsContacter("BirthDay") = PE_CDate(Trim(Request.Form("Birthday")))
        rsContacter("IDCard") = Trim(Request.Form("IDCard"))
        rsContacter("NativePlace") = Trim(Request.Form("NativePlace"))
        rsContacter("Nation") = Trim(Request.Form("Nation"))
        rsContacter("Sex") = PE_CLng(Trim(Request.Form("Sex")))
        rsContacter("Marriage") = PE_CLng(Trim(Request.Form("Marriage")))
        rsContacter("Education") = PE_CLng(Trim(Request.Form("Education")))
        rsContacter("GraduateFrom") = Trim(Request.Form("GraduateFrom"))
        rsContacter("InterestsOfLife") = Trim(Request.Form("InterestsOfLife"))
        rsContacter("InterestsOfCulture") = Trim(Request.Form("InterestsOfCulture"))
        rsContacter("InterestsOfAmusement") = Trim(Request.Form("InterestsOfAmusement"))
        rsContacter("InterestsOfSport") = Trim(Request.Form("InterestsOfSport"))
        rsContacter("InterestsOfOther") = Trim(Request.Form("InterestsOfOther"))
        rsContacter("Income") = PE_CLng(Trim(Request.Form("Income")))
        rsContacter("Family") = Trim(Request.Form("Family"))
        rsContacter("UpdateTime") = Now()
        rsContacter.Update
        rsContacter.Close
        Set rsContacter = Nothing
    End If

    Call WriteSuccessMsg("保存客户资料成功", "Admin_Client.asp?Action=Show&ClientID=" & ClientID)
    
End Sub

Sub DelClient()
    If AdminPurview > 1 And arrPurview(4) = False Then
        Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        Exit Sub
    End If

    Response.Write "<form method='POST' name='myform' action='Admin_Client.asp'>"
    Response.Write "  <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "    <tr class='title'>"
    Response.Write "      <td height='22' colspan='2' align='center'>删 除 客 户</td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td align='right' width='15%' class='tdbg5'>选择客户：</td>"
    Response.Write "      <td><table><tr><td><input type='radio' name='ClientType' value='0'> 所有客户</td><td></td></tr>"
    Response.Write "<tr><td valign='top'><input type='radio' name='ClientType' value='1'> 指定客户组</td><td>" & GetClientGroup() & "</td></tr>"
    Response.Write "<tr><td valign='top'><input type='radio' name='ClientType' value='2' checked> 指定客户ID</td><td><input type='text' name='ClientID' size='80' value='" & Replace(Trim(Request("ClientID")), " ", "") & "'></td></tr></table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>" & vbCrLf
    Response.Write "      <td align='right' width='15%' class='tdbg5'>排除条件：</td>" & vbCrLf
    Response.Write "      <td align='left'><table width='100%'><tr><td><input name='ExcludingBalance' type='checkbox' value='Yes' checked>不包括资金余额大于0的客户</td><td><input name='ExcludingOrder' type='checkbox' value='Yes' checked>不包括已下订单的客户</td><td><input name='ExcludingBankroll' type='checkbox' value='Yes' checked>不包括有资金明细记录的客户</td></tr><tr><td><input name='ExcludingService' type='checkbox' value='Yes' checked>不包括有服务记录的客户</td><td><input name='ExcludingComplain' type='checkbox' value='Yes' checked>不包括有投诉记录的客户</td></tr></table></td></tr>" & vbCrLf
    Response.Write "    <tr class='tdbg'>" & vbCrLf
    Response.Write "      <td align='right' width='15%' class='tdbg5'>删除相关信息：</td>" & vbCrLf
    Response.Write "      <td align='left'><table width='100%'><tr><td><input name='DelOrder' type='checkbox' value='Yes'>相关订单</td><td><input name='DelBankroll' type='checkbox' value='Yes'>相关资金明细记录</td><td><input name='DelService' type='checkbox' value='Yes'>相关服务记录</td><td><input name='DelComplain' type='checkbox' value='Yes'>相关投诉记录</td></tr><tr><td><input name='DelCompany' type='checkbox' value='Yes'>相关企业</td><td><input name='DelContacter' type='checkbox' value='Yes'>相关联系人</td><td><input name='DelUser' type='checkbox' value='Yes'>相关会员及相关信息</td></tr></table>" & vbCrLf
    Response.Write "    </tr>" & vbCrLf
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td height='40' colspan='2' align='center'>"
    Response.Write "        <input name='Action' type='hidden' id='Action' value='DoDelClient'>"
    Response.Write "        <input type='submit' name='Submit' value='执行删除操作'>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "  </table>"
    Response.Write "</form>"
End Sub

Sub DoDelClient()
    If AdminPurview > 1 And arrPurview(4) = False Then
        Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        Exit Sub
    End If

    Dim ClientID
    ClientID = Trim(Request("ClientID"))
    If IsValidID(ClientID) = False Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定正确的ClientID！</li>"
        Exit Sub
    End If
    Dim ExcludingBalance, ExcludingOrder, ExcludingBankroll, ExcludingService, ExcludingComplain
    Dim DelOrder, DelBankroll, DelService, DelComplain, DelCompany, DelContacter, DelUser
    
    ExcludingBalance = Trim(Request("ExcludingBalance"))
    ExcludingOrder = Trim(Request("ExcludingOrder"))
    ExcludingBankroll = Trim(Request("ExcludingBankroll"))
    ExcludingService = Trim(Request("ExcludingService"))
    ExcludingComplain = Trim(Request("ExcludingComplain"))
    DelOrder = Trim(Request("DelOrder"))
    DelBankroll = Trim(Request("DelBankroll"))
    DelService = Trim(Request("DelService"))
    DelComplain = Trim(Request("DelComplain"))
    DelCompany = Trim(Request("DelCompany"))
    DelContacter = Trim(Request("DelContacter"))
    DelUser = Trim(Request("DelUser"))

    Dim rsClient, sqlClient, iTemp
    iTemp = 0
    sqlClient = "select * from PE_Client where ClientID in (" & ClientID & ")"
    Set rsClient = Server.CreateObject("adodb.recordset")
    rsClient.Open sqlClient, Conn, 1, 3
    Do While Not rsClient.EOF
        ClientID = rsClient("ClientID")
        If ExcludingBalance = "Yes" And rsClient("Balance") > 0 Then
            FoundErr = True
        End If
        If ExcludingOrder = "Yes" And PE_CLng(Conn.Execute("select count(0) from PE_OrderForm where ClientID=" & ClientID & "")(0)) > 0 Then
            FoundErr = True
        End If
        If ExcludingBankroll = "Yes" And PE_CLng(Conn.Execute("select count(0) from PE_BankrollItem where ClientID=" & ClientID & "")(0)) > 0 Then
            FoundErr = True
        End If
        If ExcludingService = "Yes" And PE_CLng(Conn.Execute("select count(0) from PE_ServiceItem where ClientID=" & ClientID & "")(0)) > 0 Then
            FoundErr = True
        End If
        If ExcludingComplain = "Yes" And PE_CLng(Conn.Execute("select count(0) from PE_ComplainItem where ClientID=" & ClientID & "")(0)) > 0 Then
            FoundErr = True
        End If

        If FoundErr = False Then
            If DelOrder = "Yes" Then
                Conn.Execute ("delete from PE_OrderForm where ClientID=" & ClientID & "")
            End If
            If DelBankroll = "Yes" Then
                If DelUser = "Yes" Then
                    Conn.Execute ("delete from PE_BankrollItem where ClientID=" & ClientID & "")
                Else
                    Conn.Execute ("update PE_BankrollItem set ClientID=0 where ClientID=" & ClientID & "")
                End If
            End If
            If DelService = "Yes" Then
                Conn.Execute ("delete from PE_ServiceItem where ClientID=" & ClientID & "")
            End If
            If DelComplain = "Yes" Then
                Conn.Execute ("delete from PE_ComplainItem where ClientID=" & ClientID & "")
            End If
            If DelCompany = "Yes" Then
                If DelUser = "Yes" Then
                    Conn.Execute ("delete from PE_Company where ClientID=" & ClientID & "")
                Else
                    Conn.Execute ("update PE_Company set ClientID=0 where ClientID=" & ClientID & "")
                End If
            End If
            If DelContacter = "Yes" Then
                If DelUser = "Yes" Then
                    Conn.Execute ("delete from PE_Contacter where ClientID=" & ClientID & "")
                Else
                    Conn.Execute ("update PE_Contacter set ClientID=0 where ClientID=" & ClientID & "")
                End If
            End If
            If DelUser = "Yes" Then
                Dim rsUser, tUserID, tUserName
                Set rsUser = Conn.Execute("select UserID,UserName from PE_User where ClientID=" & ClientID & "")
                Do While Not rsUser.EOF
                    tUserID = rsUser(0)
                    tUserName = rsUser(1)
                    Conn.Execute ("delete from PE_OrderForm where UserName='" & tUserName & "'")
                    Conn.Execute ("delete from PE_Payment where UserName='" & tUserName & "'")
                    Conn.Execute ("delete from PE_BankrollItem where UserName='" & tUserName & "'")
                    Conn.Execute ("delete from PE_ConsumeLog where UserName='" & tUserName & "'")
                    Conn.Execute ("delete from PE_RechargeLog where UserName='" & tUserName & "'")
                    Conn.Execute ("delete from PE_Article where Inputer='" & tUserName & "'")
                    Conn.Execute ("delete from PE_Soft where Inputer='" & tUserName & "'")
                    Conn.Execute ("delete from PE_Photo where Inputer='" & tUserName & "'")
                    Conn.Execute ("delete from PE_Comment where UserType=1 and UserName='" & tUserName & "'")
                    Conn.Execute ("delete from PE_GuestBook where GuestType=1 and GuestName='" & tUserName & "'")
                    Conn.Execute ("delete from PE_Favorite where UserID=" & tUserID & "")
                    rsUser.MoveNext
                Loop
                rsUser.Close
                Set rsUser = Nothing

                Conn.Execute ("delete from PE_User where ClientID=" & ClientID & "")
            Else
                Conn.Execute ("update PE_User set ClientID=0 where ClientID=" & ClientID & "")
            End If
            rsClient.Delete
            rsClient.Update
            iTemp = iTemp + 1
        End If
        rsClient.MoveNext
    Loop
    rsClient.Close
    Set rsClient = Nothing
    Call WriteSuccessMsg("删除客户成功！共删除了 " & iTemp & " 名客户。", "Admin_Client.asp")

End Sub

Sub SaveRemit()
    If AdminPurview > 1 And arrPurview(2) = False And arrPurview(3) = False Then
        Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        Exit Sub
    End If

    Dim ClientID, Money, ReceiptDate, Bank, Remark
    ClientID = PE_CLng(Trim(Request("ClientID")))
    Money = PE_CDbl(Trim(Request("Money")))
    ReceiptDate = Trim(Request("ReceiptDate"))
    Bank = Trim(Request("Bank"))
    Remark = Trim(Request("Remark"))
    If ClientID <= 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定客户ID！</li>"
    End If
    If Money <= 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请输入汇款金额！</li>"
    End If
    If ReceiptDate = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请输入汇款日期！</li>"
    Else
        ReceiptDate = CDate(ReceiptDate)
    End If
    
    If FoundErr = True Then Exit Sub
    
    '给客户的资金余额中加上相应款项
    Conn.Execute ("update PE_Client set Balance=Balance+" & Money & " where ClientID=" & ClientID & "")
    
    ' 向资金明细表中添加收入记录
    Call AddBankrollItem(AdminName, "", ClientID, Money, 2, Bank, 0, 1, 0, 0, Remark, ReceiptDate)
    
    Call CloseConn
    Response.Redirect "Admin_Client.asp?Action=Show&InfoType=3&ClientID=" & ClientID
End Sub

Sub SaveIncome()
    If AdminPurview > 1 And arrPurview(2) = False And arrPurview(3) = False Then
        Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        Exit Sub
    End If
    Dim ClientID
    Dim Money, Remark
    ClientID = Trim(Request("ClientID"))
    Money = Trim(Request("Money"))
    Remark = Trim(Request("Remark"))
    If ClientID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定客户ID！"
    Else
        ClientID = CLng(ClientID)
    End If
    If Money = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请输入支付金额！</li>"
    Else
        Money = CDbl(Money)
    End If
    If Remark = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请输入收入项目！</li>"
    End If
    
    If FoundErr = True Then Exit Sub
    
    Dim trs
    Set trs = Conn.Execute("select UserName,Balance from PE_User where ClientID=" & ClientID & "")
    If trs.BOF And trs.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的客户！</li>"
    End If
    Set trs = Nothing
    
    If FoundErr = True Then Exit Sub
        
    '给客户的资金余额中加上相应款项
    Conn.Execute ("update PE_Client set Balance=Balance+" & Money & " where ClientID=" & ClientID & "")
                
    '向资金明细表中添加收入记录
    Call AddBankrollItem(AdminName, "", ClientID, Money, 4, "", 0, 1, 0, 0, Remark, Now())
    
    Call CloseConn
    Response.Redirect "Admin_Client.asp?Action=Show&InfoType=3&ClientID=" & ClientID
End Sub

Sub SavePayment()
    If AdminPurview > 1 And arrPurview(2) = False And arrPurview(3) = False Then
        Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        Exit Sub
    End If
    Dim ClientID, Balance, OrderFormID
    Dim rsOrderForm, sqlOrderForm
    Dim Money, Remark
    ClientID = Trim(Request("ClientID"))
    OrderFormID = PE_CLng(Trim(Request("OrderFormID")))
    Money = Trim(Request("Money"))
    Remark = Trim(Request("Remark"))
    If ClientID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定客户ID！"
    Else
        ClientID = CLng(ClientID)
    End If
    If Money = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请输入支付金额！</li>"
    Else
        Money = CDbl(Money)
    End If
    If Remark = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请输入收入项目！</li>"
    End If
    
    If FoundErr = True Then Exit Sub
    
    Dim trs
    Set trs = Conn.Execute("select UserName,Balance from PE_User where ClientID=" & ClientID & "")
    If trs.BOF And trs.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的客户！</li>"
    Else
        Balance = trs(1)
    End If
    Set trs = Nothing
    
    If FoundErr = True Then Exit Sub
    
    If OrderFormID > 0 Then
        Set rsOrderForm = Server.CreateObject("Adodb.RecordSet")
        sqlOrderForm = "select OrderFormNum,Status,MoneyTotal,MoneyReceipt from PE_OrderForm where OrderFormID=" & OrderFormID
        rsOrderForm.Open sqlOrderForm, Conn, 1, 3
        If rsOrderForm.BOF And rsOrderForm.EOF Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>找不到指定的订单！</li>"
            rsOrderForm.Close
            Set rsOrderForm = Nothing
            Exit Sub
        End If
        If rsOrderForm("MoneyTotal") <= rsOrderForm("MoneyReceipt") Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>此订单已经付清，无需再支付！</li>"
            rsOrderForm.Close
            Set rsOrderForm = Nothing
            Exit Sub
        End If
        rsOrderForm("MoneyReceipt") = rsOrderForm("MoneyReceipt") + Money
        If rsOrderForm("Status") = 2 Then
            rsOrderForm("Status") = 3
        End If
        rsOrderForm.Update
        rsOrderForm.Close
        Set rsOrderForm = Nothing
    End If
    
    '给客户的资金余额中减去相应款项
    Conn.Execute ("update PE_Client set Balance=Balance-" & Money & " where ClientID=" & ClientID & "")
                
    '向资金明细表中添加支出记录
    Call AddBankrollItem(AdminName, "", ClientID, Money, 4, "", 0, 2, OrderFormID, 0, Remark, Now())
    
    Call CloseConn
    If OrderFormID > 0 Then
        Response.Redirect "Admin_Order.asp?Action=ShowOrder&OrderFormID=" & OrderFormID
    Else
        Response.Redirect "Admin_Client.asp?Action=Show&InfoType=3&ClientID=" & ClientID
    End If
End Sub



Function GetClientGroup()
    Dim strGroup, rsGroup, i
    i = 0
    strGroup = "<table><tr>"
    For i = 0 To UBound(arrGroupID)
        strGroup = strGroup & "<td><input name='GroupID' type='checkbox' value='" & i & "'> " & GetArrItem(arrGroupID, i) & "</td>"
        If (i + 1) Mod 6 = 0 Then strGroup = strGroup & "</tr><tr>"
    Next
    strGroup = strGroup & "</tr></table>"
    GetClientGroup = strGroup
End Function
%>
