<!--#include file="../fy.Function.asp"-->
<!--#include file="../../fy_inc/cls_pageview.asp"-->
<!doctype html>
<html>
<head>
<meta charset="gb2312">
<title>会员有效期日志 </title>
<link rel="stylesheet" type="text/css" href="../css/base.css">
<link rel="stylesheet" type="text/css" href="../css/content.css">
</head>
<body>
<div class="content"> 
	<div class="breadnav">当前位置：<a href="#">后台首页</a> >> 会员有效期日志 </div>
   	<%	ConnectionDatabase	
	dim MaxPerPage,RS,TotalPut,TotalPages,I,CurrentPage,SQL,ComeUrl
		  MaxPerPage=20
		ComeUrl=Cstr(Request.ServerVariables("HTTP_REFERER"))
		if request("Action")="del" then
		  Dim Param
		  Select Case ChkNumeric(request("deltype"))
		   Case 1
			Param="datediff('d',adddate," & NowString & ")>11"
		   Case 2
			 Param="datediff(d,adddate," & NowString & ")>31"
		   Case 3
			Param="datediff('d',adddate," & NowString & ")>61"
		   Case 4
			Param="datediff('d',adddate," & NowString & ")>91"
		   Case 5
			Param="datediff('d',adddate," & NowString & ")>181"
		   Case 6
			Param="datediff('d',adddate," & NowString & ")>366"
		  End Select
		  If Param<>"" Then Conn.Execute("Delete From Edays_fy Where 1=1 and  " & Param)
		  Call fycms.Alert("已按所给的条件，删除了有效期日志的相关记录！",ComeUrl)
		end if
		%>

 <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <thead>
      <tr>
      <th>用户名</th>
	  <th>操作时间</th>
	  <th>IP地址</th>
	  <th>增加有效期</th>
	  <th>减少有效期</th>
	  <th>摘要</th>
	  <th>操作员</th>
	  <th>备注</th>
	  </tr>


    </thead>
			  <%
		  CurrentPage	= ChkNumeric(request("page"))
		  Set RS=Server.CreateObject("ADODB.RecordSet")
			RS.Open "Select ID,UserID,AddDate,IP,Edays,Flag,UserLog,Descript From Edays_fy order by ID desc",conn,1,1
			If RS.Eof And RS.Bof Then
			 echo "<tr><td colspan=9 align=center height=25 class='tdbg'>找不到相关记录！</td></tr>"
			Else
			   TotalPut=rs.recordcount
							if (TotalPut mod MaxPerPage)=0 then
								TotalPages = TotalPut \ MaxPerPage
							else
								TotalPages = TotalPut \ MaxPerPage + 1
							end if
							if CurrentPage > TotalPages then CurrentPage=TotalPages
							if CurrentPage < 1 then CurrentPage=1
							rs.move (CurrentPage-1)*MaxPerPage
							SQL = rs.GetRows(MaxPerPage)
							rs.Close:set rs=Nothing
							ShowContent
		   End If
		%>		
    </table>
<table border="0" style="margin-top:20px" width="90%" align=center>
<tr><td><strong>特别提醒：</strong>
如果有效期日志记录太多，影响了系统性能，可以删除一定时间段前的记录以加快速度。但可能会带来会员在查看以前收过费的信息时重复收费（这样会引发众多消费纠纷问题），无法通过有效期日志记录来真实分析会员的消费习惯等问题。
</td></tr>
<form action="?action=del" method=post onSubmit="return(confirm('确实要删除有关记录吗？一旦删除这些记录，会出现会员查看原来已经付过费的收费信息时重复收费等问题。请慎重!'))">
<tr><td class="tl">删除范围：<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="执行删除" class="btn btn_primary"></td></tr>
  </form>
</table>
<%
Sub ShowContent
For i=0 To Ubound(SQL,2)
	%>
  <tr height="25" >
    <td width="80"  ><%=SQL(1,i)%></td>
    <td><%=SQL(2,i)%></td>
    <td><%=SQL(3,i)%></td>
    <td><%if SQL(5,I)=1 Then echo SQL(4,I) ELSE echo "0"%>天</td>
    <td><%if SQL(5,I)=2 Then echo SQL(4,I) ELSE echo "0"%>天</td>
    <td width="59"  ><%if SQL(5,I)=1 Then echo "<font color=red>收入</font>" Else echo "支出"%></td>
    <td><%=SQL(6,i)%></td>
	<td class="td_bg"  align="center"><%=SQL(7,i)%></td>
  </tr>
  <%Next
  echo "<tr><td colspan=9 align=right class='td_bg'>"
  Call ShowPagePara(totalPut, MaxPerPage, "", True, "条记录", CurrentPage, "")
  echo "</td></tr>"
End Sub
				
	Public Function ShowPagePara(totalnumber, MaxPerPage, FileName, ShowAllPages, strUnit, CurrentPage, ParamterStr)
		  Dim N, I, PageStr
				Const Btn_First = "第一页"'样式定义
				Const Btn_Prev = "上一页" 
				Const Btn_Next = "下一页" 
				Const Btn_Last = "最后一页" 
				  PageStr = ""
					If totalnumber Mod MaxPerPage = 0 Then
						N = totalnumber \ MaxPerPage
					Else
						N = totalnumber \ MaxPerPage + 1
					End If
				If N > 1 Then
					PageStr = PageStr & ("页次：<font color=red>" & CurrentPage & "</font>/" & N & "页 共有:" & totalnumber & strUnit & " 每页:" & MaxPerPage & strUnit & " ")
					If CurrentPage < 2 Then
						PageStr = PageStr & Btn_First & " " & Btn_Prev & " "
					Else
						PageStr = PageStr & ("<a href=" & FileName & "?page=1" & "&" & ParamterStr & ">" & Btn_First & "</a> <a href=" & FileName & "?page=" & CurrentPage - 1 & "&" & ParamterStr & ">" & Btn_Prev & "</a> ")
					End If
					
					If N - CurrentPage < 1 Then
						PageStr = PageStr & " " & Btn_Next & " " & Btn_Last & " "
					Else
						PageStr = PageStr & (" <a href=" & FileName & "?page=" & (CurrentPage + 1) & "&" & ParamterStr & ">" & Btn_Next & "</a> <a href=" & FileName & "?page=" & N & "&" & ParamterStr & ">" & Btn_Last & "</a> ")
					End If
					If ShowAllPages = True Then
						PageStr = PageStr & ("GO:<select  onChange='location.href=this.value;' style='width:55;' name='select'>")
				   For I = 1 To N
					 If Cint(CurrentPage) = I Then
						PageStr = PageStr & ("<option value=" & FileName & "?page=" & I & "&" & ParamterStr & " selected>NO." & I & "</option>")
					 Else
						 PageStr = PageStr & ("<option value=" & FileName & "?page=" & I & "&" & ParamterStr & ">NO." & I & "</option>")
					 End If
				   Next
				  PageStr = PageStr & "</select>"
				  End If
			 End If
			 ShowPagePara = PageStr
			 echo ShowPagePara
	End Function
%> 

</div>
</body>
</html>
