<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%Option Explicit%>
<!--#include file="../Conn.asp"-->
<!--#include file="../HSK_Cls/HSK.CommonCls.asp"-->
<!--#include file="../HSK_Cls/HSK.AdministratorCls.asp"-->
<!--#include file="Include/Session.asp"-->
<%
Dim KSCls
Set KSCls = New User_PointDetail
KSCls.HSK_Run()
Set KSCls = Nothing

Class User_PointDetail
        Private KS,KSCls
		Private MaxPerPage,RS,TotalPut,TotalPages,I,Page,SQL,ComeUrl
		Private Sub Class_Initialize()
		  MaxPerPage=30
		  Set KS=New PublicCls
		  Set KSCls=New ManageCls
		End Sub
        Private Sub Class_Terminate()
		 Call CloseConn()
		 Set KS=Nothing
		 Set KSCls=Nothing
		End Sub
       Sub HSK_Run()
          Response.Write "<html>"
			Response.Write"<head>"
			Response.Write"<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
			Response.Write"<link href=""Include/Admin_Style.CSS"" rel=""stylesheet"" type=""text/css"">"
			Response.Write"<script src=""../HSK_JS/jquery.js""></script>"
			Response.Write"</head>"
			Response.Write"<body leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"">"
	      If Not KS.ReturnPowerResult(0, "KMUA10005") Then
			  response.Write ("<script>$(parent.document).find('#BottomFrame')[0].src='javascript:history.back();';</script>")
			  Call KS.ReturnErr(1, "")
			End If
			Response.Write"<div class='topdashed sort'>手机短信明细</div>"
		ComeUrl=Cstr(Request.ServerVariables("HTTP_REFERER"))
		if KS.G("Action")="del" then
		  Dim Param
		  Select Case KS.ChkClng(KS.G("DelType"))
		   Case 1 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>11"
		   Case 2 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>31"
		   Case 3 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>61"
		   Case 4 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>91"
		   Case 5 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>181"
		   Case 6 Param="datediff(" & DataPart_D & ",adddate," & SqlNowString & ")>366"
		  End Select
		  If Param<>"" Then Conn.Execute("Delete From Log_SMS Where 1=1 and " & Param)
          KS.echo "<script>$(top.frames['FrameTop'].document).find('#ajaxmsg').toggle();alert('已按所给的条件，删除了手机短信明细的相关记录！');</script>"
		end if
		%>
<table width="100%" border="0" align="center" cellspacing="0" cellpadding="0">
  <tr class="sort">
      <td width=50>ID</td>
      <td width=100 height="25">发送编号</td>
      <td width=100>用户名</td>
      <td width=100>接收手机号</td>
      <td width=60>类型</td>
      <td width=80>发送时间</td>
      <td width=70>用户IP</td>
      <td width=60>状态</td>
      <td width=70>短信费用</td>
      <td width=>短信内容</td>
  </tr>
  <%
  Page	= KS.ChkClng(request("page"))
  If Page<=0 Then Page=1
   if request("keyword")<>"" then
    Param=" username='" & request("keyword") & "'"
   else
    Param=" 1=1"
   end if
  Dim SQLStr,FieldStr:FieldStr="*"
  If DataBaseType=1 Then
					Dim Cmd : Set Cmd = Server.CreateObject("ADODB.Command")
					Set Cmd.ActiveConnection=conn
					Cmd.CommandText="KS_GetPageRecords"
					Cmd.CommandType=4	
					CMD.Prepared = true 
					Cmd.Parameters.Append cmd.CreateParameter("@tblName",202,1,200)
					Cmd.Parameters.Append cmd.CreateParameter("@fldName",202,1,200)
					Cmd.Parameters.Append cmd.CreateParameter("@pagesize",3)
					Cmd.Parameters.Append cmd.CreateParameter("@pageindex",3)
					Cmd.Parameters.Append cmd.CreateParameter("@ordertype",3)
					Cmd.Parameters.Append cmd.CreateParameter("@strWhere",202,1,1000)
					Cmd.Parameters.Append cmd.CreateParameter("@fieldIds",202,1,1000)
					Cmd("@tblName")="Log_SMS"
					Cmd("@fldName")= "ID"
					Cmd("@pagesize")=MaxPerPage
					Cmd("@pageindex")=page
					Cmd("@ordertype")=1
					Cmd("@strWhere")=Param
					Cmd("@fieldIds")=FieldStr
					Set Rs=Cmd.Execute
					Set Cmd=Nothing
	 Else
			SQLStr=KS.GetPageSQL("Log_SMS","ID",MaxPerPage,Page,1,Param,FieldStr)
			Set RS = Server.CreateObject("AdoDb.RecordSet")
			RS.Open SQLStr, conn, 1, 1
	 End If
  
	If RS.Eof And RS.Bof Then
	 Response.Write "<tr><td colspan=10 align=center height=25 class='splittd'>还没有短信记录！</td></tr>"
	Else
        TotalPut=Conn.Execute("Select count(1) From Log_SMS")(0)
		SQL = rs.GetRows(MaxPerPage)
		rs.Close:set rs=Nothing
		ShowContent
   End If
%>		
</table>

<div>
		<form action="?" name="myform" method="post">
		   <div style="border:1px dashed #cccccc;margin:3px;padding:4px">
			  &nbsp;<strong>按用户搜索=></strong>
			 &nbsp;用户名:<input type="text" class='textbox' name="keyword">
			  &nbsp;<input type="submit" value="开始搜索" class="button" name="s1">
			  </div>
		</form>
		</div>


<div class="attention">
<strong>特别提醒：</strong>
如果手机短信记录太多，影响了系统性能，可以删除一定时间段前的记录以加快速度（这样会引发众多消费纠纷问题）。
<br />
<iframe src='about:blank' style='display:none' name='_hiddenframe' id='_hiddenframe'></iframe>
<form action="?action=del" target="_hiddenframe" method=post onsubmit="return(confirm('确实要删除有关记录吗？'))">
删除范围：<input name="deltype" type="radio" value=1>
10天前 
    <input name="deltype" type="radio" value="2" />
    1个月前
    <input name="deltype" type="radio" value="3" />
    2个月前
    <input name="deltype" type="radio" value="4" />
    3个月前
    <input name="deltype" type="radio" value="5" />
    6个月前
    <input name="deltype" type="radio" value="6" checked="checked" />
    1年前
    <input type="submit" value="执行删除" onclick="$(parent.frames['FrameTop'].document).find('#ajaxmsg').toggle();" class="button">
	</form>
</div>
<%End Sub
Sub ShowContent
 Dim OutMoney
For i=0 To Ubound(SQL,2)
	%>
  <tr height="25" class='list' onMouseOver="this.className='listmouseover'" onMouseOut="this.className='list'">
  <td  class="splittd" align=middle><%=SQL(0,i)%></td>
  <td  class="splittd" align=middle><%=SQL(2,i)%></td>
    <td  class="splittd" align=middle><a href="?keyword=<%=SQL(1,i)%>"><%=SQL(1,i)%></a></td>
      <td  class="splittd" align=middle><%=SQL(3,i)%></td>
	  <td  class="splittd" align=middle>
	  <% Select Case SQL(6,i)
	      Case 0:Response.WRite "立即"
		  Case 1:Response.Write "定时"
		 End Select	
	   %></td>
      <td  class="splittd" align=center><%=SQL(8,i)%></td>
      <td  class="splittd" align=center><%=SQL(9,i)%></td>
      <td  class="splittd" align=center><% Select Case SQL(7,i)
	      Case 0:Response.WRite "成功"
		  Case 1:Response.Write "<font color=red>失败</font>"
		 End Select	
	   %></td>
      <td  class="splittd" align=center><% =formatnumber(SQL(5,I),2,-1)%></td>
      <td  class="splittd" align=middle><span title="<%=SQL(4,I)%>"><%=Left(SQL(4,I),22)%></span></td>
    </tr>
<%
OutMoney = OutMoney + SQL(5,I)
Next
%>
  <tr class='list' onmouseout="this.className='list'" onmouseover="this.className='listmouseover'">
  <td class="splittd" colspan='5' align='right'>本页合计：</td>
  <td class="splittd" align='right'><%=OutMoney%>元</td>
  <td class="splittd" colspan='4'>&nbsp;</td>
  </tr> 

  <% 
     Dim TotalOutMoney:TotalOutMoney=conn.execute("Select sum(PayMoney) From Log_SMS")(0)
  %>
    <tr class='list' onmouseout="this.className='list'" onmouseover="this.className='listmouseover'">
    <td class="splittd" colspan='5' align='right'>所有合计：</td>
    <td class="splittd" align='right'><%=totalOutMoney%>点</td>
    <td class="splittd" colspan='4'>&nbsp;</td>
    </tr> 
  <%  
  Response.Write "<tr><td colspan=9 align=right class='list' onMouseOver=""this.className='listmouseover'"" onMouseOut=""this.className='list'"">"
    Call KS.ShowPage(totalput, MaxPerPage, "", Page,true,true)
  Response.Write "</td></tr>"
End Sub
				
End Class
%> 
