<!--#include file="Admin_Common.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 = "Order_OrderItem"   '其他权限

Dim ProductID
Dim sql, Querysql, Fromsql, strResultTips


ProductID = PE_CLng(Trim(Request("ProductID")))

strFileName = "Admin_OrderItem.asp?SearchType=" & SearchType & "&Field=" & strField & "&Keyword=" & Keyword & "&ProductID=" & ProductID

If Action = "outExcel" Then
    Call GetSqlStr
    Call outHead2
    Call outExcel
ElseIf Action = "ShowSearchForm" Then
    Call outhead
    Call ShowSearchForm
Else
    Call GetSqlStr
    Call outhead
    Call main
    If FoundErr = True Then
        Call WriteErrMsg(ErrMsg, ComeUrl)
    End If
End If
Response.Write "</body></html>"
Call CloseConn

Sub outhead()
    Response.Write "<html><head><title>销售明细表</title>"
    Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>"
    Response.Write "<link rel='stylesheet' href='Admin_Style.css' type='text/css'>"
    Response.Write "</head>"
    Response.Write "<body leftmargin='2' topmargin='0' marginwidth='0' marginheight='0'>"
    Response.Write "<table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' Class='border'>"
    Call ShowPageTitle("销 售 明 细 表", 10202)
    Response.Write "    <tr class='tdbg' height='30'> "
    Response.Write "  <form name='form1' action='Admin_OrderItem.asp' method='get'>"
    Response.Write "      <td>快速查找："
    Response.Write "      <select size=1 name='SearchType' onChange='javascript:submit()'>"
    Response.Write "          <option value='0'"
    If SearchType = 0 Then Response.Write " selected"
    Response.Write ">所有销售记录</option>"
    Response.Write "          <option value='1'"
    If SearchType = 1 Then Response.Write " selected"
    Response.Write ">今天销售明细</option>"
    Response.Write "          <option value='2'"
    If SearchType = 2 Then Response.Write " selected"
    Response.Write ">本周销售明细</option>"
    Response.Write "          <option value='3'"
    If SearchType = 3 Then Response.Write " selected"
    Response.Write ">本月销售明细</option>"
    Response.Write "        </select>&nbsp;&nbsp;&nbsp;&nbsp;<a href='Admin_OrderItem.asp'>销售明细首页</a></td>"
    Response.Write "  </form>"
    Response.Write "<form name='form2' method='post' action='Admin_OrderItem.asp'>"
    Response.Write "    <td>高级查询："
    Response.Write "      <select name='Field' id='Field'>"
    Response.Write "      <option value='ClientName' selected>客户名称</option>"
    Response.Write "      <option value='UserName'>用户名</option>"
    Response.Write "      <option value='ProductName'>商品名称</option>"
    Response.Write "      <option value='InputTime'>购买时间</option>"
    Response.Write "      </select>"
    Response.Write "      <input name='Keyword' type='text' id='Keyword' size='20' maxlength='30'>"
    Response.Write "      <input type='submit' name='Submit2' value=' 查 询 '>"
    Response.Write "      <input name='SearchType' type='hidden' id='SearchType' value='10'>&nbsp;&nbsp;&nbsp;&nbsp;<a href='Admin_OrderItem.asp?Action=ShowSearchForm'><b>复杂查询</b></a>"
    Response.Write " </td>"
    Response.Write "</form>"
    Response.Write "</table>"
    Response.Write "<br>"
End Sub

Sub outHead2()
    Response.Write "<html><head>" & vbCrLf
    Response.ContentType = "application/vnd.ms-excel" & vbCrLf
    Response.AddHeader "Content-Disposition", "attachment"
    Response.Write "<meta http-equiv=""Content-Language"" content=""zh-cn"">" & vbCrLf
    Response.Write "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">" & vbCrLf
    Response.Write "<title>销售明细表</title>" & vbCrLf
    Response.Write "<body>" & vbCrLf
End Sub

Sub GetSqlStr()
    If Action = "outExcel" Then
        sql = "select top " & MaxPerPage
    Else
        sql = "select"
    End If
    sql = sql & " P.ProductID,P.ProductName,P.Unit,I.SaleType,I.PresentExp,I.Price,I.TruePrice,I.Amount,O.OrderFormID,O.OrderFormNum,O.InputTime,O.UserName,O.ClientID,C.ShortedForm as ClientName "
    Fromsql = " from PE_Product P inner join (PE_OrderFormItem I inner join (PE_OrderForm O left join PE_Client C on O.ClientID=C.ClientID) on I.OrderFormID=O.OrderFormID) on P.ProductID=I.ProductID"
    sql = sql & Fromsql
    Querysql = Querysql & " where (O.MoneyReceipt>=O.MoneyTotal or O.MoneyReceipt>0) "

    Select Case SearchType
    Case 0
        'sqlOrder = sqlOrder & " order by O.OrderFormID desc"
        'sqlMoney = "select sum(MoneyTotal) from PE_OrderForm"
        'sqlMoney2 = "select sum(MoneyReceipt) from PE_OrderForm"
        strResultTips = "所有商品销售记录"
    Case 1
        Querysql = Querysql & " and datediff(" & PE_DatePart_D & ",O.InputTime," & PE_Now & ")<1"
        strResultTips = "今天的商品销售记录"
    Case 2
        Querysql = Querysql & " and datediff(" & PE_DatePart_W & ",O.InputTime," & PE_Now & ")<1"
        strResultTips = "本周的商品销售记录"
    Case 3
        Querysql = Querysql & " and datediff(" & PE_DatePart_M & ",O.InputTime," & PE_Now & ")<1"
        strResultTips = "本月的商品销售记录"
    Case 4
        Querysql = Querysql & " and I.ProductID=" & ProductID & ""
        strResultTips = "指定商品的销售记录"
    Case 10
        If Keyword = "" Then
            strResultTips = "所有商品销售记录"
        Else
            Select Case strField
            Case "ClientName"
                Querysql = Querysql & " and C.ClientName like '%" & Keyword & "%'"
                strResultTips = "客户名称中含有“ <font color=red>" & Keyword & "</font> ”的商品销售记录"
            Case "UserName"
                Querysql = Querysql & " and C.ClientName like '%" & Keyword & "%'"
                strResultTips = "客户名称中含有“ <font color=red>" & Keyword & "</font> ”的订单"
            Case "UserName"
                Querysql = Querysql & " and O.UserName like '%" & Keyword & "%'"
                strResultTips = "用户名中含有“ <font color=red>" & Keyword & "</font> ”的商品销售记录"
            Case "ProductName"
                Querysql = Querysql & " and P.ProductName like '%" & Keyword & "%'"
                strResultTips = "商品名称中含有“ <font color=red>" & Keyword & "</font> ”的商品销售记录"
            Case "InputTime"
                    If IsDate(Keyword) = True Then
                        If SystemDatabaseType = "SQL" Then
                            Querysql = Querysql & " and O.InputTime='" & Keyword & "' "
                        Else
                            Querysql = Querysql & " and O.InputTime=#" & Keyword & "# "
                        End If
                        strResultTips = "购买时间为 <font color=red>" & Keyword & "</font> 的商品销售记录"
                    Else
                        FoundErr = True
                        ErrMsg = ErrMsg & "<li>查询的购买时间格式不正确！</li>"
                    End If
            End Select
        End If
    Case 99
        strResultTips = "销售明细复杂查询结果"
        Dim BeginID, EndID, BeginDate, EndDate, MinMoney, MaxMoney, ClientName, UserName, AgentName, ProductName, AgentOrder
        BeginID = PE_CLng(Trim(Request("BeginID")))
        EndID = PE_CLng(Trim(Request("EndID")))
        BeginDate = Trim(Request("BeginDate"))
        EndDate = Trim(Request("EndDate"))
        MinMoney = PE_CDbl(Trim(Request("MinMoney")))
        MaxMoney = PE_CDbl(Trim(Request("MaxMoney")))
        ClientName = ReplaceBadChar(Trim(Request("ClientName")))
        UserName = ReplaceBadChar(Trim(Request("UserName")))
        AgentName = ReplaceBadChar(Trim(Request("AgentName")))
        ProductName = ReplaceBadChar(Trim(Request("ProductName")))
        AgentOrder = PE_CLng(Trim(Request("AgentOrder")))

        strFileName = "Admin_OrderItem.asp?SearchType=99&BeginID=" & BeginID & "&EndID=" & EndID & "&BeginDate=" & BeginDate & "&EndDate=" & EndDate & "&MinMoney=" & MinMoney & "&MaxMoney=" & MaxMoney
        strFileName = strFileName & "&ClientName=" & ClientName
        strFileName = strFileName & "&UserName=" & UserName & "&AgentName=" & AgentName
        strFileName = strFileName & "&ProductName=" & ProductName & "&AgentOrder=" & AgentOrder

        If BeginID > 0 Then
            Querysql = Querysql & " And O.OrderFormID>=" & BeginID
        End If
        If EndID > 0 Then
            Querysql = Querysql & " And O.OrderFormID<=" & EndID
        End If

        If BeginDate <> "" Then
            BeginDate = PE_CDate(BeginDate)
            If SystemDatabaseType = "SQL" Then
                Querysql = Querysql & " And O.InputTime>='" & BeginDate & "'"
            Else
                Querysql = Querysql & " And O.InputTime>=#" & BeginDate & "#"
            End If
        End If
        If EndDate <> "" Then
            EndDate = PE_CDate(EndDate)
            If SystemDatabaseType = "SQL" Then
                Querysql = Querysql & " And O.InputTime<='" & EndDate & "'"
            Else
                Querysql = Querysql & " And O.InputTime<=#" & EndDate & "#"
            End If
        End If
        If MinMoney > 0 Then
            Querysql = Querysql & " And I.TruePrice * I.Amount>=" & MinMoney
        End If
        If MaxMoney > 0 Then
            Querysql = Querysql & " And I.TruePrice * I.Amount<=" & MaxMoney
        End If
        If ClientName <> "" Then
            Querysql = Querysql & " And C.ClientName like '%" & ClientName & "%'"
        End If
        If UserName <> "" Then
            Querysql = Querysql & " And O.UserName like '%" & UserName & "%'"
        End If
        If AgentName <> "" Then
            Querysql = Querysql & " And O.AgentName = '" & AgentName & "'"
        End If
        If AgentOrder = 1 Then
            Querysql = Querysql & " And O.AgentName <>''"
        ElseIf AgentOrder = 2 Then
            Querysql = Querysql & " And O.AgentName =''"
        End If
        If ProductName <> "" Then
            Querysql = Querysql & " And P.ProductName like '%" & ProductName & "%'"
        End If
    Case Else
        FoundErr = True
        ErrMsg = ErrMsg & "<li>错误的参数！</li>"
    End Select
End Sub

Sub main()
    Dim rsOrderItem
    Dim dblPrice, dblAmount, dblSubtotal, dblTotal, i, PresentExp
    Dim TotalQuerySql
    dblSubtotal = 0
    dblTotal = 0
    PresentExp = 0
    
    Call PopCalendarInit
    Response.Write "<table width='100%'><tr><td align='left'><img src='images/img_u.gif' align='absmiddle'>您现在的位置：<a href='Admin_OrderItem.asp'>销售明细</a>&nbsp;&gt;&gt;&nbsp;"
    
    Response.Write strResultTips

    totalPut = PE_CLng(Conn.Execute("select Count(*) " & Fromsql & 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

    TotalQuerySql = Querysql   '统计不需要加入分页的条件
    If CurrentPage > 1 Then
        Querysql = Querysql & " and I.ItemID < (select min(ItemID) from (select top " & ((CurrentPage - 1) * MaxPerPage) & " I.ItemID " & Fromsql & Querysql & " order by I.ItemID desc) as QueryOrderFormItem) "
    End If
    sql = sql & Querysql & " order by I.ItemID desc"

    Response.Write "</td></tr></table>"
    If FoundErr = True Then Exit Sub
    
    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='120'><b>下单时间</b></td>"
    Response.Write "    <td width='100'><b>订单编号</b></td>"
    Response.Write "    <td width='60'><b>客户名称</b></td>"
    Response.Write "    <td width='60'><b>用户名</b></td>"
    Response.Write "    <td><b>商 品 名 称</b></td>"
    Response.Write "    <td width='40'><b>单位</b></td>"
    Response.Write "    <td width='50'><b>数量</b></td>"
    Response.Write "    <td width='60'><b>实价</b></td>"
    Response.Write "    <td width='60'><b>指定价</b></td>"
    Response.Write "    <td width='80'><b>金 额</b></td>"
    Response.Write "    <td width='40'><b>积分</b></td>"
    Response.Write "  </tr>"
    
    Set rsOrderItem = Server.CreateObject("Adodb.RecordSet")
    rsOrderItem.Open sql, Conn, 1, 1
    If rsOrderItem.BOF And rsOrderItem.EOF Then
        totalPut = 0
        Response.Write "<tr class='tdbg' height='50'><td colspan='20' align='center'>没有任何商品销售记录！</td></tr>"
    Else
        Do While Not rsOrderItem.EOF
            dblPrice = rsOrderItem("TruePrice")
            dblAmount = rsOrderItem("Amount")
            dblSubtotal = dblPrice * dblAmount
            dblTotal = dblTotal + dblSubtotal
            PresentExp = PresentExp + rsOrderItem("PresentExp")
            
            Response.Write "  <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
            Response.Write "    <td width='120' align='center'>" & rsOrderItem("InputTime") & "</td>"
            Response.Write "    <td width='100' align=center><a href='Admin_Order.asp?Action=ShowOrder&OrderFormID=" & rsOrderItem("OrderFormID") & "'>" & rsOrderItem("OrderFormNum") & "</td>"
            Response.Write "    <td width='60' align=center><a href='Admin_Client.asp?Action=Show&ClientID=" & rsOrderItem("ClientID") & "'>" & rsOrderItem("ClientName") & "</td>"
            Response.Write "    <td width='60' align=center><a href='Admin_User.asp?Action=Show&UserName=" & rsOrderItem("UserName") & "'>" & rsOrderItem("UserName") & "</td>"
            Response.Write "    <td><a href='Admin_OrderItem.asp?SearchType=4&ProductID=" & rsOrderItem("ProductID") & "'>" & rsOrderItem("ProductName") & "</a>"
            Select Case rsOrderItem("SaleType")
            Case 1 '正常销售
            
            Case 2 '换购
                Response.Write " <font color='red'>（换购）</font>"
            Case 3 '赠送
                Response.Write " <font color='red'>（赠送）</font>"
            Case 4 '批发
                Response.Write " <font color='red'>（批发）</font>"
            End Select
                
            Response.Write "</td>"
            Response.Write "    <td width='40' align=center>" & rsOrderItem("Unit") & "</td>"
            Response.Write "    <td width='50' align='center'>" & dblAmount & "</td>"
            Response.Write "    <td width='60' align='right'>" & FormatNumber(rsOrderItem("Price"), 2, vbTrue, vbFalse, vbTrue) & "</td>"
            Response.Write "    <td width='60' align='right'>" & FormatNumber(dblPrice, 2, vbTrue, vbFalse, vbTrue) & "</td>"
            Response.Write "    <td width='80' align='right'>" & FormatNumber(dblSubtotal, 2, vbTrue, vbFalse, vbTrue) & "</td>"
            Response.Write "    <td width='40' align=center>" & rsOrderItem("PresentExp") & "</td>"
            Response.Write "  </tr>"
            
            i = i + 1
            If i >= MaxPerPage Then Exit Do
            rsOrderItem.MoveNext
        Loop
    End If
    rsOrderItem.Close
    Set rsOrderItem = Nothing
    
    Response.Write "  <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
    Response.Write "    <td colspan='9' align='right'>本页合计：</td>"
    Response.Write "    <td align='right'>" & FormatNumber(dblTotal, 2, vbTrue, vbFalse, vbTrue) & "</td>"
    Response.Write "    <td align='center'>" & PresentExp & "</td>"
    Response.Write "  </tr>"

    Dim trs
    Set trs = Conn.Execute("select sum(I.SubTotal),sum(I.PresentExp),sum(I.Amount) " & Fromsql & TotalQuerySql)
    Response.Write "  <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
    Response.Write "    <td colspan='9' align='right'>总计金额：</td>"
    Response.Write "    <td align='right'>" & FormatNumber(PE_CDbl(trs(0)), 2, vbTrue, vbFalse, vbTrue) & "</td>"
    Response.Write "    <td align='center'>" & trs(1) & "</td>"
    Response.Write "  </tr>"
    Response.Write "  <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
    Response.Write "    <td colspan='9' align='right'>商品数目合计：</td>"
    Response.Write "    <td colspan='2' align='center'>" & trs(2) & "</td>"
    Response.Write "  </tr>"
    Set trs = Nothing
    Response.Write "</table>"
    Response.Write ShowPage(strFileName, totalPut, MaxPerPage, CurrentPage, True, True, "条商品销售记录", True)
    Response.Write "<br><table width='100%' border='0' cellpadding='0' cellspacing='0' class='border'><tr class='tdbg'><td>"
    Response.Write "<table border='0' cellpadding='0' cellspacing='0' width='100%'>"
    Response.Write "<form method='Get' name='out' action='Admin_OrderItem.asp'>"
    Response.Write "<tr><td width=130 align='right'><input name='SelectType' type='radio' value='ID' checked>按ＩＤ范围选择：</td><td height='28' width='310' align='left'>"
    Response.Write "起始ＩＤ<input type='text' name='BeginID'  size='10' value='1'>&nbsp;终止ＩＤ<input type='text' name='EndID'  size='10' value='1000'></td><td rowspan=2 align='left'><input name='Action' type='hidden' id='Action' value='outExcel'><input type='submit' name='Submit'  value='导出到EXCEL'></td></tr>"
    Response.Write "<tr><td width=130 align='right'><input name='SelectType' type='radio' value='Date'>按日期范围选择：</td><td height='28' align='left'>"
    Response.Write "起始日期<input type='text' name='BeginDate' id='BeginDate' size='10' maxlength='10'><a style='cursor:hand;' onClick='PopCalendar.show(document.out.BeginDate, ""yyyy-mm-dd"", null, null, null, ""11"");'><img src='Images/Calendar.gif' border='0' Style='Padding-Top:10px' align='absmiddle'></a>&nbsp;结束日期<input type='text' name='EndDate' id='EndDate' size='10' maxlength='10'><a style='cursor:hand;' onClick='PopCalendar.show(document.out.EndDate, ""yyyy-mm-dd"", null, null, null, ""11"");'><img src='Images/Calendar.gif' border='0' Style='Padding-Top:10px' align='absmiddle'></a></td></tr>"
    Response.Write "</form></table></td></tr></table>"
End Sub

Sub outExcel()
    Dim BeginDate, EndDate, BeginID, EndID, SelectType, dblPrice, dblAmount, dblSubtotal
    Dim Sqlout, Rsout

    Sqlout = sql & Querysql & " order by I.ItemID desc"

    Set Rsout = Conn.Execute(Sqlout)
    If Rsout.BOF And Rsout.EOF Then
        Response.Write "无指定的订单！"
    Else
        Response.Write "<table border=""0"" cellspacing=""1"" style=""border-collapse: collapse;table-layout:fixed"" id=""AutoNumber1"" height=""32"">" & vbCrLf
        Response.Write "<tr>" & vbCrLf
        Response.Write "<td align=""center""><span lang=""zh-cn""><b>下单时间</b></span></td>" & vbCrLf
        Response.Write "<td align=""center""><span lang=""zh-cn""><b>订单编号</b></span></td>" & vbCrLf
        Response.Write "<td align=""center""><span lang=""zh-cn""><b>客户名称</b></span></td>" & vbCrLf
        Response.Write "<td align=""center""><span lang=""zh-cn""><b>用户名</b></span></td>" & vbCrLf
        Response.Write "<td align=""center""><span lang=""zh-cn""><b>商品名称</b></span></td>" & vbCrLf
        Response.Write "<td align=""center""><span lang=""zh-cn""><b>单位</b></span></td>" & vbCrLf
        Response.Write "<td align=""center""><span lang=""zh-cn""><b>数量</b></span></td>" & vbCrLf
        Response.Write "<td align=""center""><span lang=""zh-cn""><b>实价</b></span></td>" & vbCrLf
        Response.Write "<td align=""center""><span lang=""zh-cn""><b>指定价</b></span></td>" & vbCrLf
        Response.Write "<td align=""center""><span lang=""zh-cn""><b>金额</b></span></td>" & vbCrLf
        Response.Write "<td align=""center""><span lang=""zh-cn""><b>积分</b></span></td>" & vbCrLf
        Response.Write "</tr>" & vbCrLf
        Do While Not Rsout.EOF
            dblPrice = Rsout("TruePrice")
            dblAmount = Rsout("Amount")
            dblSubtotal = dblPrice * dblAmount
            Response.Write "<tr>" & vbCrLf
            Response.Write "<td align=""center""><span lang=""zh-cn"">" & FormatDateTime(Rsout("InputTime"), 2) & "</span></td>" & vbCrLf
            Response.Write "<td align=""center""><span lang=""zh-cn"">" & Rsout("OrderFormNum") & "</span></td>" & vbCrLf
            Response.Write "<td align=""center""><span lang=""zh-cn"">" & Rsout("ClientName") & "</span></td>" & vbCrLf
            Response.Write "<td align=""center""><span lang=""zh-cn"">" & Rsout("UserName") & "</span></td>" & vbCrLf
            Response.Write "<td align=""center""><span lang=""zh-cn"">" & Rsout("ProductName")
            Select Case Rsout("SaleType")
            Case 2 '换购
                Response.Write "（换购）"
            Case 3 '赠送
                Response.Write "（赠送）"
            Case 4 '批发
                Response.Write "（批发）"
            End Select
            Response.Write "</span></td>" & vbCrLf
            Response.Write "<td align=""center""><span lang=""zh-cn"">" & Rsout("Unit") & "</span></td>" & vbCrLf
            Response.Write "<td align=""center""><span lang=""zh-cn"">" & dblAmount & "</span></td>" & vbCrLf
            Response.Write "<td align=""center""><span lang=""zh-cn"">" & FormatNumber(Rsout("Price"), 2, vbTrue, vbFalse, vbTrue) & "</span></td>" & vbCrLf
            Response.Write "<td align=""center""><span lang=""zh-cn"">" & FormatNumber(dblPrice, 2, vbTrue, vbFalse, vbTrue) & "</span></td>" & vbCrLf
            Response.Write "<td align=""center""><span lang=""zh-cn"">" & FormatNumber(dblSubtotal, 2, vbTrue, vbFalse, vbTrue) & "</span></td>" & vbCrLf
            Response.Write "<td align=""center""><span lang=""zh-cn"">" & Rsout("PresentExp") & "</span></td>" & vbCrLf
            Response.Write "</tr>" & vbCrLf
            Rsout.MoveNext
        Loop
    End If
    Rsout.Close
    Set Rsout = Nothing
End Sub

Sub ShowSearchForm()
    Call PopCalendarInit
    Response.Write "<script language='javascript'>"
    Response.Write "function SelectAgent(){"
    Response.Write "var arr=showModalDialog('Admin_SourceList.asp?TypeSelect=AgentList','','dialogWidth:600px; dialogHeight:450px; help: no; scroll: yes; status: no');"
    Response.Write "if (arr != null){"
    Response.Write "document.formSearch.AgentName.value=arr;"
    Response.Write "}"
    Response.Write "}"
    Response.Write "</script>"
    Response.Write "<form method='Get' name='formSearch' action='Admin_OrderItem.asp'>"
    Response.Write "<table width='100%' border='0' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "<tr class='title' align='center'><td colspan='6'>销 售 明 细 复 杂 查 询</td></tr>"
    Response.Write "<tr class='tdbg'><td width='120' class='tdbg5' align='right'>ＩＤ范围：</td><td>起始ＩＤ<input type='text' name='BeginID'  size='10' value=''>&nbsp;终止ＩＤ<input type='text' name='EndID'  size='10' value=''></td></tr>"
    Response.Write "<tr class='tdbg'><td width='120' class='tdbg5' align='right'>日期范围：</td><td>起始日期<input type='text' name='BeginDate' id='BeginDate' size='10' maxlength='10'><a style='cursor:hand;' onClick='PopCalendar.show(document.formSearch.BeginDate, ""yyyy-mm-dd"", null, null, null, ""11"");'><img src='Images/Calendar.gif' border='0' Style='Padding-Top:10px' align='absmiddle'></a>&nbsp;结束日期<input type='text' name='EndDate' id='EndDate' size='10' maxlength='10'><a style='cursor:hand;' onClick='PopCalendar.show(document.formSearch.EndDate, ""yyyy-mm-dd"", null, null, null, ""11"");'><img src='Images/Calendar.gif' border='0' Style='Padding-Top:10px' align='absmiddle'></a></td></tr>"
    Response.Write "<tr class='tdbg'><td width='120' class='tdbg5' align='right'>金额范围：</td><td><input type='text' name='MinMoney'  size='10' value=''> 至 <input type='text' name='MaxMoney'  size='10' value=''></td></tr>"
    Response.Write "<tr class='tdbg'><td width='120' class='tdbg5' align='right'>客户名称：</td><td><input type='text' name='ClientName'  size='30' value=''></td></tr>"
    Response.Write "<tr class='tdbg'><td width='120' class='tdbg5' align='right'>用户名：</td><td><input type='text' name='UserName'  size='30' value=''></td></tr>"
    Response.Write "<tr class='tdbg'><td width='120' class='tdbg5' align='right'>代理商：</td><td><input type='text' name='AgentName'  size='30' value=''> <input type='button' name='aaa' value='...' onclick='SelectAgent()'></td></tr>"
    Response.Write "<tr class='tdbg'><td width='120' class='tdbg5' align='right'>是否代理商销售：</td><td><input type='radio' name='AgentOrder' value='2'>否 <input type='radio' name='AgentOrder' value='1'>是 <input type='radio' name='AgentOrder' checked value='0'>所有状态</td></tr>"
    Response.Write "<tr class='tdbg'><td width='120' class='tdbg5' align='right'>商品名称：</td><td><input type='text' name='ProductName'  size='30' value=''></td></tr>"
    Response.Write "<tr class='tdbg' height='40' align='center'><td colspan='6'><input name='SearchType' type='hidden' id='SearchType' value='99'><input name='Action' type='hidden' value='Manage'><input type='submit' name='Submit'  value=' 查 询 '> "
    Response.Write "<input type='submit' name='Submit2'  value='导出到EXCEL' onclick=""document.formSearch.Action.value='outExcel';"">"
    Response.Write "</td></tr></table></form>"
End Sub
%>
