<!--#include file="check.asp"-->
<%

Call hrPower(4.5,0)

startdate=request("startdate")
if startdate="" or isnull(startdate) then startdate=date()
enddate=request("enddate")
if enddate="" or isnull(enddate) then enddate=date()


id=request.QueryString("id")
Nowpage=cint(request.QueryString("page"))
id=request("id")
%>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>每日商户排行</title>
<link href="images/main.css" rel="stylesheet" type="text/css" media="all" />
<script src="js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
</head>
<!--#include file="top.asp"-->
<script language="javascript">
try{
    var nav="H05";
    var subnav="L0504";
	
    document.getElementById(nav).className="current";
    document.getElementById(subnav).className="first current";
    document.getElementById(subnav).parentNode.parentNode.style.display="block";

}catch(e){
	document.getElementById("H05").className="current";
}
</script>
<div id="systime"><p id="servertime"></p></div>
<div id="mainBody" >

<div class="space">&nbsp;</div>
<div class="list">

<script   language="JavaScript">   
  function   ValidateInput()   
  {   

      document.form1.submit();   
      document.form1.Submit.disabled=true;   
  }   
  </script> 
<table class="listtable">
             <form name="form1" method="get" action="DayCount.asp">
<tr onmouseover="this.oldcolor=this.style.backgroundColor;this.style.backgroundColor='infobackground'" onmouseout="this.style.backgroundColor=this.oldcolor" style="color:#333333;background-color:#F7F6F3;">
              <td height="30" colspan="13" align="center">



&nbsp;&nbsp;&nbsp;开始时间&nbsp;&nbsp;
<input name="startdate" type="text" class="inputbox" id="startdate" size="10" value="<%=startdate%>" onClick="WdatePicker()" readonly>
&nbsp;&nbsp;&nbsp;&nbsp;结束时间&nbsp;&nbsp;
<input name="enddate" type="text" class="inputbox" id="enddate" value="<%=enddate%>" size="10" onClick="WdatePicker()" readonly> 




<input type="button" name="Submit" onClick="JavaScript:ValidateInput();" value="立即查询" id="Submit" /></td>
             </td>
			 
              </tr></form>
</table>



<table class="listtable">
  <thead>
    <tr>
      <th scope="col">商户名</th>
            <th scope="col">总金额</th>
            <th scope="col">商户所得</th>
            <th scope="col">充值次数</th>

    </tr>
  </thead>
  <tbody> 




           <%
		  

		   searchstr=""

		   if isdate(startdate) then 
		      if not searchstr="" then searchstr=searchstr+" and "
 		     searchstr=searchstr+"regdate >= '"&startdate&"'"
		   end if

		   if isdate(enddate) then 
		      if not searchstr="" then searchstr=searchstr+" and "
 		      searchstr=searchstr+"regdate <= '"&enddate&"'"
		   end if


		   if not searchstr="" then searchstr=" where "+searchstr	
		   if request("action")="search" then 
		   			set Rs=GrateRs("select upline,SUM(Price) as gaga ,SUM(fencheng) as fencheng ,count(*) as total from mobile "&searchstr&" group BY upline order by gaga desc ",1)
		   		else
		   			set Rs=GrateRs("select upline,SUM(Price) as gaga ,SUM(fencheng) as fencheng ,count(*) as total from mobile "&searchstr&" group BY upline order by gaga desc ",1)

		   end if

		   Rs.PageSize=60
		   if not Rs.eof then 
		   If Nowpage=0 then Nowpage=1
		   Rs.AbsolutePage=Nowpage 
		   i=1
		   do while not Rs.eof and i<=Rs.pagesize
		   %>
<%if i mod 2 =0 then%>
         <tr class="listtr1" >
<%else%>
         <tr class="listtr2" >
<%end IF%>
              <td><%=Rs("upline")%></td>
              <td><%=Rs("gaga")%></td>
              <td><%=Rs("fencheng")%></td>
              <td><%=Rs("total")%></td>

            </tr>
			<%
		   i=i+1
		   Rs.movenext
		   loop
		  %>
<tr onmouseover="this.oldcolor=this.style.backgroundColor;this.style.backgroundColor='infobackground'" onmouseout="this.style.backgroundColor=this.oldcolor" style="color:#284775;background-color:White;">
              <td height="26" colspan="7">&nbsp;<strong>翻页: :</strong>
                <%
  myurl="DayCount.asp?action=search&startdate="&startdate&"&enddate="&enddate&"&"
  response.write("共："&Rs.recordcount&"条记录，共:"&Rs.PageCount&"页,"&Rs.PageSize&"条/页,第"&NowPage&"页&nbsp;")
  response.write("<a href='"&myurl&"page=1'>"&"首页</a>&nbsp;")
  if NowPage>1 then response.write("<a href='"&myurl&"page="&Nowpage-1&"'>上一页</a>&nbsp;")
  if NowPage<Rs.PageCount then response.write("<a href='"&myurl&"page="&Nowpage+1&"'>下一页</a>&nbsp;")
  response.write("<a href='"&myurl&"page="&Rs.PageCount&"'>尾页</a>&nbsp;")
		%>
                &nbsp;</td>
            </tr>
			  <%else%>
<tr onmouseover="this.oldcolor=this.style.backgroundColor;this.style.backgroundColor='infobackground'" onmouseout="this.style.backgroundColor=this.oldcolor" style="color:#284775;background-color:White;">
              <td height="26" colspan="7">对不起,无记录!</td>
              </tr>
			  <%end if%>
        

          </table>
       </td>
      </tr>
	  

    </table></td>
  </tr>
</table>
</body>
</html>
<%
call DBConnEnd
%>