<!-- #include file="include/adovbs.inc" -->
<!-- #include file="include/dataconn.asp" -->
<!-- #include file="include/checksession.asp" -->
<!-- #include file="common.asp" -->
<%
 dtfrom=trim(request("dtfrom"))
  dtto=trim(request("dtto"))
  if len(dtfrom)=0 and len(dtto)=0 then
	  sql="SELECT sum(AllMoney)  as TotalMoney FROM HyMoneyLog where computetime <='"&thistoday&"'"
  end if
  if len(dtfrom)>0 and len(dtto)=0 then
	  sql="SELECT sum(AllMoney)  as TotalMoney FROM HyMoneyLog where computetime >='"&dtfrom&"'"
  end if
  if len(dtfrom)=0 and len(dtto)>0 then
	  sql="SELECT sum(AllMoney)  as TotalMoney FROM HyMoneyLog where computetime <='"&dtto&"'"
  end if
  if len(dtfrom)>0 and len(dtto)>0 then
	  sql="SELECT sum(AllMoney)  as TotalMoney FROM HyMoneyLog where computetime <='"&dtto&"' and computetime>='"&dtfrom&"'"
  end if  
  
	set HyTjRs=server.CreateObject("adodb.recordset")
	Count=0
	HyTjRs.Open sql,conn		
	if HyTjRs.RecordCount>0 then
		if len(HyTjRs("TotalMoney"))>0 then
			Count=HyTjRs("TotalMoney")
		end if 
	end if
	
  if len(dtfrom)=0 and len(dtto)=0 then
	  sql="SELECT sum(HyBuyCount)  as TotalMoney FROM HyClub where IsApproved=true and ApprovedTime <='"&thistoday&"'"
  end if
  if len(dtfrom)>0 and len(dtto)=0 then
	  sql="SELECT sum(HyBuyCount)  as TotalMoney FROM HyClub where  IsApproved=true and ApprovedTime >='"&dtfrom&"'"
  end if
  if len(dtfrom)=0 and len(dtto)>0 then
	  sql="SELECT sum(HyBuyCount)  as TotalMoney FROM HyClub where  IsApproved=true and ApprovedTime <='"&dtto&"'"
  end if
  if len(dtfrom)>0 and len(dtto)>0 then
	  sql="SELECT sum(HyBuyCount)  as TotalMoney FROM HyClub where   IsApproved=true and ApprovedTime <='"&dtto&"' and ApprovedTime>='"&dtfrom&"'"
  end if 
	set HyTjRs=server.CreateObject("adodb.recordset")
	incomeCount=0
	AllApprovedDan=0
	HyTjRs.Open sql,conn		
	if HyTjRs.RecordCount>0 then
		if len(HyTjRs("TotalMoney"))>0 then
			AllApprovedDan=HyTjRs("TotalMoney")
			incomeCount=HyTjRs("TotalMoney")*session("JiaruMoney")
		end if 
	end if  
	
  if len(dtfrom)=0 and len(dtto)=0 then
	  sql="SELECT count(HyBuyCount)  as TotalMoney FROM HyClub where IsApproved=true and ApprovedTime <='"&thistoday&"'"
  end if
  if len(dtfrom)>0 and len(dtto)=0 then
	  sql="SELECT count(HyBuyCount)  as TotalMoney FROM HyClub where  IsApproved=true and ApprovedTime >='"&dtfrom&"'"
  end if
  if len(dtfrom)=0 and len(dtto)>0 then
	  sql="SELECT count(HyBuyCount)  as TotalMoney FROM HyClub where  IsApproved=true and ApprovedTime <='"&dtto&"'"
  end if
  if len(dtfrom)>0 and len(dtto)>0 then
	  sql="SELECT count(HyBuyCount)  as TotalMoney FROM HyClub where   IsApproved=true and ApprovedTime <='"&dtto&"' and ApprovedTime>='"&dtfrom&"'"
  end if 
	set HyTjRs=server.CreateObject("adodb.recordset")
	HyTjRs.Open sql,conn
	AllApprovedMan=0		
	if HyTjRs.RecordCount>0 then
		if len(HyTjRs("TotalMoney"))>0 then
			AllApprovedMan=HyTjRs("TotalMoney")
		end if 
	end if 
			
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>支出奖金统计</title>
<link rel="stylesheet" href="include/e1.css" type="text/css">
<script language='javascript' src='include/common.js'></script>
<script>
	function fPopUpCalendarDlg(ctrlobj)
	{
		showx = event.screenX - event.offsetX - 4 - 210 ; // + deltaX;
		showy = event.screenY - event.offsetY + 18; // + deltaY;
		newWINwidth = 210 + 4 + 18;

		retval = window.showModalDialog("Include/CalendarDlg.htm", "", "dialogWidth:197px; dialogHeight:210px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no; "  );
		if( retval != null ){
			ctrlobj.value = retval;
		}else{
			//alert("canceled");
		}
	}
</script>
</head>

<body onmouseover="self.status=' www.topkj.cn | 欢迎您的光临';return true">
<FORM name=form1 action="yejisum.asp" method=post>
        <table align="center" bgcolor="#AAAAAA" border="0" cellpadding="0" cellspacing="0"  width="80%"><tr><td>  
    <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1">
          <tr> 
        <td height="30" bgcolor="2b7aa0"> 
          <div align="center"><font color="#FFFFFF"><font size="4">统 
                计 条 件</font></font></div></td>
      </tr>
      <tr>
            <td height="25" bgcolor="#FFFFFF"> 
              <div align="center"><font color="#FFFFFF"><font color="#000000">从</font></font> 
                <input id="dtfrom" name="dtfrom" readonly value="<% =dtfrom %>" size="12">
            <img src="image/datetime.gif" style="cursor:hand;" align="absmiddle" alt="弹出日历下拉菜单" onClick="fPopUpCalendarDlg(document.form1.dtfrom);return false" width="16"> 
            到 
                <input id="dtto" name="dtto" readonly value="<% =dtto %>" size="12">
            <img src="image/datetime.gif" style="cursor:hand;" align="absmiddle" alt="弹出日历下拉菜单" onClick="fPopUpCalendarDlg(document.form1.dtto);return false" width="16"> 
            &nbsp; 
            <input type="image" value="submit" src="Image/027.gif" id="image1" name="image1">
              </div></td>
      </tr>
    </table>
</TD></tr></table>

      </FORM>
	  
<br>
	 <table align="center" bgcolor="#AAAAAA" border="0" cellpadding="0" cellspacing="0"  width="80%"><tr><td>    
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1">
        <tr bgcolor="2b7aa0"> 
          <td height="30" colspan="2"> 
            <div align="center"><font color="#FFFFFF" size="4">统 计 结 果</font></div></td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td height="25" colspan="2"> <div align="center"> <font size="4"> 
              <%if len(dtfrom)=0 and len(dtto)=0 then%>
              到目前为止 
              <%else%>
              从<font color="#0066CC">&nbsp;<%=dtfrom%>&nbsp;</font>到<font color="0066CC">&nbsp;<%=dtto%> &nbsp;</font> 
              <%end if%>
              </font> </div></td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td width="31%"> <div align="right"><img src="Image/dsis-usernew-ico-01.gif" width="60" height="54"></div></td>
          <td width="69%" bgcolor="#FFFFFF"><font size="4">会员总计(已审核)：<font color="#FF0000"><strong>&nbsp;<%=AllApprovedMan%>&nbsp;人</strong></font></font></td>
        </tr>
		<% if GetDisplay("HyBuyCount")=true then%>
        <tr bgcolor="#FFFFFF"> 
		<%else%>
        <tr bgcolor="#FFFFFF" style="display:none"> 		
		<%end if%>
          <td width="31%"> <div align="right"><img src="Image/dsis-usernew-ico-02.gif" width="60" height="54"></div></td>
          <td width="69%" bgcolor="#FFFFFF"><font size="4">单数总计(已审核)：<font color="#FF0000"><strong>&nbsp;<%=AllApprovedDan%>&nbsp;单</strong></font></font></td>
        </tr>				
        <tr bgcolor="#FFFFFF"> 
          <td width="31%"> <div align="right"><img src="Image/dsis-usernew-ico-05.gif" width="60" height="54"></div></td>
          <td width="69%" bgcolor="#FFFFFF"><font size="4">收入总计：<font color="#FF0000"><strong>￥&nbsp;<%=incomeCount%></strong></font></font></td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td width="31%"> <div align="right"><img src="Image/dsis-usernew-ico-05.gif" width="60" height="54"></div></td>
          <td width="69%" bgcolor="#FFFFFF"><font size="4">支出奖金总计：<font color="#FF0000"><strong>￥&nbsp;<%=count%></strong></font></font></td>
        </tr>
		<tr bgcolor="#FFFFFF"> 
          <td width="31%"> <div align="right"><img src="Image/dsis-usernew-ico-04.gif" width="60" height="54"></div></td>
          <td width="69%" bgcolor="#FFFFFF"><font size="4">拨出率：<font color="#FF0000"><strong>&nbsp;<%=left(cdbl(count)*100/cdbl(incomeCount),5)%>%</strong></font></font></td>
        </tr>		
      </table>
</td></tr></table>
</body>
</html>
