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

<head>

<link rel="stylesheet" type="text/css" href="../images/<%=request.cookies("imgdir")%>/css/style.css" media="all"/>
<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")
 strtype=request("strtype")
 
 if strdate1="" then 
   strdate1=date()-10
 end if
 if strdate2="" then 
   strdate2=date()+1
  
 end if
 
 
 
 

%>
<br>

<table width="688" border="0" align="center" cellspacing="0">
 <tr height="38"  style="background-color:#D6E4FF"  class="TableHeader">   
    <td width="52" class="STYLE1"><div align="right"><span class="STYLE1 STYLE2">开始：</span></div></td>
    <td width="137" class="STYLE1"><b><b>
      <input name=date1 size="15"   value=<%=strdate1%>>
    </b></b></td>
    <td width="65" class="STYLE1"><div align="right"><span class="STYLE2">结束：</span></div></td>
    <td width="110" class="STYLE1"><b><b>
      <input name=date2  size="15"   value=<%=strdate2%>>
    </b></b></td>
    <td width="52" class="STYLE1 STYLE2"><div align="right">类别：</div></td>
    <td width="118" class="STYLE1 STYLE2"><select name="strtype">
          <option selected="selected"><%=strtype%> </option>
          <option value="通知提醒短信">通知提醒短信</option>
          <option value="邮件提醒短信">邮件提醒短信</option>
		  <option value="内部短信">内部短信</option>
 		  <option value="工资提醒短信">工资提醒短信</option>
		  <option value="OA精灵短信">OA精灵短信</option>
        </select></td>
    <td width="61" class="STYLE1 STYLE2">
      <div align="center">
        <input name="Submit" type="submit" class="topanniu" value="查询" />     
      </div></td>
  </tr>
</table>
 
<br>

<table width="519" border="1" align="center" cellpadding="3"   cellspacing="0"  bordercolor="#6D8DD8"  class="mtable">

<%
if strtype="内部短信" then
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.短信提醒 = '已短信提醒') and (updatetime BETWEEN '"&strdate1&"'  AND   '"&strdate2&"') GROUP BY m.upname"
rs.open sql,conn,1,1

%>

 <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  class="STYLE1" 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
end if
%>

<%  
if strtype="邮件提醒短信" then
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  class="STYLE1" 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
end if
%>





<%  

if strtype="OA精灵短信" then
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  class="STYLE1" 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
end if

%>



<%  


if strtype="工资提醒短信" then
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  class="STYLE1" 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
end if
%>








<%  
if strtype="通知提醒短信" then

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  class="STYLE1" 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
end if


%>





	<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>  