<!--#include file="../checkLogin.asp"-->
<!--#include file="../SQLconn.asp"-->
<html>

<head>

<link rel="stylesheet" href="../css/style.css">
<title>发送短信统计</title>
<style type="text/css">
<!--
.STYLE2 {font-size: 12px}
.STYLE3 {color: #000000}

-->
</style>
</head>
<body topmargin="5" leftmargin="5">

<form id="form1" name="form1" method="post" action="tongjiduanxin.asp">

<%
  
 strdate1=request("date1")
 strdate2=request("date2")
 
 if strdate1="" then 
   strdate1=date()-30
 end if
 if strdate2="" then 
   strdate2=date()+1
  
 end if
 
 
 
Set rs=Server.CreateObject("Adodb.Recordset")

sql="SELECT m.upname, COUNT(*) AS shuliang   FROM message m INNER JOIN      seemessage s ON m.mid = s.mid  WHERE (s.havesee = '已发手机') and (updatetime BETWEEN '"&strdate1&"'  AND   '"&strdate2&"') GROUP BY m.upname"
rs.open sql,conn,1,1

%>
<br>
<table width="500" border="1" align="center" cellpadding="3"   cellspacing="0"  bordercolor="#6D8DD8"  class="mtablehui"> 
<tr style="background-color:#D6E4FF"  class="TableHeader">      <td height="30" colspan="3" valign="middle"  align="center" nowrap class="NemuNot">
<table width="500" border="0" align="center" cellspacing="0">
  <tr>
    <td width="45" class="STYLE1"><div align="right"><span class="STYLE1 STYLE2">开始</span></div></td>
    <td width="105" class="STYLE1"><b><b>
      <input name=date1 size="15"   value=<%=strdate1%>>
    </b></b></td>
    <td width="51" class="STYLE1"><div align="right"><span class="STYLE2">结束</span></div></td>
    <td width="105" class="STYLE1"><b><b>
      <input name=date2  size="15"   value=<%=strdate2%>>
    </b></b></td>
    <td width="103" class="STYLE1 STYLE2">
      <div align="center">
        <input name="Submit" type="submit" class="topanniu" value="查询" />     
      </div></td>
  </tr>
</table>
</td>    </tr>    </table>   
<br>

<table width="519" border="1" align="center" cellpadding="3"   cellspacing="0"  bordercolor="#6D8DD8"  class="mtable">
 <tr style="background-color:#D6E4FF"  class="TableHeader">
  
	  <td height="30" align="center" nowrap class="STYLE1">发送人</td>
      <td align="center" nowrap class="STYLE1">数量</td>
  </tr>
<%  total=0
   While NOT rs.EOF
	
%>
    <tr onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#EFF8FF'">
	<td width="296" height="30">
	
	
	
	  <div align="center"><%=rs("upname")%>  短信</div></td>
    <td width="205" height="30" class="STYLEname"><div align="center" class="STYLEmian STYLE3"><%=rs("shuliang")%></div></td>
    </tr>
<% 
total=total+rs("shuliang")
 rs.MoveNext
Wend%>

<%  

Set rstongzhi=Server.CreateObject("Adodb.Recordset")

sqltongzhi="SELECT g.upname, COUNT(*) AS shuliang   FROM email g INNER JOIN      emailsee s ON g.id = s.fid  WHERE (s.短信提醒 = '已短信提醒') and (upDatetime BETWEEN '"&strdate1&"'  AND   '"&strdate2&"') GROUP BY g.upname"
rstongzhi.open sqltongzhi,conn,1,1



   While NOT rstongzhi.EOF
	
%>
    <tr onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#EFF8FF'">
	<td width="296" height="30">
	
	
	
	  <div align="center"><%=rstongzhi("upname")%>  邮件</div></td>
    <td width="205" height="30" class="STYLEname"><div align="center" class="STYLEmian STYLE3"><%=rstongzhi("shuliang")%></div></td>
    </tr>
<% 
total=total+rstongzhi("shuliang")
 rstongzhi.MoveNext
Wend%>





<%  

Set rstongzhi=Server.CreateObject("Adodb.Recordset")

sqltongzhi="SELECT  COUNT(*) AS shuliang, 发送人 FROM duanxinCount  WHERE   类型='OA精灵' and  (发送时间 BETWEEN '"&strdate1&"'  AND   '"&strdate2&"') GROUP BY 发送人 order by 发送人"
rstongzhi.open sqltongzhi,conn,1,1
   While NOT rstongzhi.EOF	
%>
    <tr onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#EFF8FF'">
	<td width="296" height="30">
	
	  <div align="center"><%=rstongzhi("发送人")%>OA精灵</div></td>
    <td width="205" height="30" class="STYLEname"><div align="center" class="STYLEmian STYLE3"><%=rstongzhi("shuliang")%></div></td>
    </tr>
<% 
total=total+rstongzhi("shuliang")
 rstongzhi.MoveNext
Wend%>



<%  

Set rstongzhi=Server.CreateObject("Adodb.Recordset")

sqltongzhi="SELECT  COUNT(*) AS shuliang, 发送人 FROM duanxinCount  WHERE   类型='工资短信' and  (发送时间 BETWEEN '"&strdate1&"'  AND   '"&strdate2&"') GROUP BY 发送人"
rstongzhi.open sqltongzhi,conn,1,1
   While NOT rstongzhi.EOF	
%>
    <tr onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#EFF8FF'">
	<td width="296" height="30">
	
	  <div align="center"><%=rstongzhi("发送人")%>工资短信</div></td>
    <td width="205" height="30" class="STYLEname"><div align="center" class="STYLEmian STYLE3"><%=rstongzhi("shuliang")%></div></td>
    </tr>
<% 
total=total+rstongzhi("shuliang")
 rstongzhi.MoveNext
Wend%>








<%  

Set rstongzhi=Server.CreateObject("Adodb.Recordset")

sqltongzhi="SELECT g.upname, COUNT(*) AS shuliang   FROM gonggao g INNER JOIN      gonggaosee s ON g.id = s.fid  WHERE (s.短信提醒 = '已短信提醒') and (upDatetime BETWEEN '"&strdate1&"'  AND   '"&strdate2&"') GROUP BY g.upname"
rstongzhi.open sqltongzhi,conn,1,1



   While NOT rstongzhi.EOF
	
%>
    <tr onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#EFF8FF'">
	<td width="296" height="30">
	
	
	
	  <div align="center"><%=rstongzhi("upname")%>  通知</div></td>
    <td width="205" height="30" class="STYLEname"><div align="center" class="STYLEmian STYLE3"><%=rstongzhi("shuliang")%></div></td>
    </tr>
<% 
total=total+rstongzhi("shuliang")
 rstongzhi.MoveNext
Wend%>





	<tr onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#EFF8FF'">
	<td width="296" height="30"> <div align="center">合计</div></td>
    <td width="205" class="STYLEname"><div align="center" class="STYLEmian STYLE3"><%=total%></div></td>
    </tr>
	<tr onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#EFF8FF'">
	  <td height="45"><div align="center">
	    <DIV> balance的值就是短信剩余数量 </DIV>
	  </div></td>
	  <td class="STYLEname"><div align="center" class="STYLETITLE STYLE3">
	    <%
	  
	 

	  	Set RS=Server.CreateObject("Adodb.Recordset")
		sql="select * from varset where  name='发送短信账号'"
		RS.open sql,conn,1,1
		'aaaa="http://www.stongnet.com/sdkhttp/getbalance.aspx?reg=101100-WEB-HUAX-151464&pwd=RDJJAZRC"
		a=RS("vname")
		aa=RS("vname1")
		
		aaaa="http://www.stongnet.com/sdkhttp/getbalance.aspx?reg="&a&"&pwd="&aa
		
 
Set Http = Server.CreateObject("MSXML2.XMLHttp")
'Http.Open "Post","http://www.stongnet.com/sdkhttp/getbalance.aspx?reg=101100-WEB-HUAX-151464&pwd=RDJJAZRC",False
Http.Open "Post",aaaa,False
'//如果你硬要用request.form("CompanyName")来接收值，加入这一句
Http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
Http.Send StrPost
'//如果你返回的是文本信息，用下面接收
ReSult = Http.ResponseText
'//如果你返回的是HTML文件，用下面接收
'ReSult = bytes2BSTR(Http.ResponseBody)
Response.Write ReSult 

%>
      </div></td>
    </tr>
</table>

  <div align="center">
    <p>&nbsp;</p>
    <p><br>
      <div>
      <br>
      </p>
  </div>
  <p align="center">&nbsp;</p>
</form>


</body>  
  
</html>  