<!--#include file =../conn.asp-->
<!-- #include file="inc/const.asp" -->
<!-- #include file="../inc/dv_clsother.asp" -->
<%
Head()
Dim admin_flag
admin_flag=",36,"
If Not Dvbbs.master Or InStr(","&Session("flag")&",",admin_flag)=0 Then
	Errmsg=ErrMsg + "<BR><li>本页面为管理员专用，请<a href=../admin_login.asp target=_top>登录</a>后进入。<br><li>您没有管理本页面的权限。"
	Dvbbs_Error()
Else
	If Request("action")="readme" Then
		NetPay()
	Else
		Main()
	End If
	If FoundErr Then Call Dvbbs_Error()
	Footer()
End If

Sub Main()
	Dim StartTime,EndTime,sType,KeyWord,IsSuc,MoneySize,PayMoney,SqlString
	StartTime = Request("StartTime")
	EndTime = Request("EndTime")
	sType = Request("sType")
	KeyWord = Replace(Request("keyword"),"'","''")
	MoneySize = Request("MoneySize")
	PayMoney = Request("PayMoney")
	IsSuc = Request("IsSuc")

	If IsSuc = "" Or Not IsNumeric(IsSuc) Then IsSuc = 0
	If IsSuc = 1 Then
		If SqlString = "" Then
			SqlString = " Where O_IsSuc = 1"
		Else
			SqlString = SqlString & " And O_IsSuc = 0"
		End If
	ElseIf IsSuc = 2 Then
	End If
	If StartTime <> "" And IsDate(StartTime) Then
		If SqlString = "" Then
			SqlString = " Where O_AddTime >= '"&StartTime&"'"
		Else
			SqlString = SqlString & " And O_AddTime >= '"&StartTime&"'"
		End If
	End If
	If EndTime <> "" And IsDate(EndTime) Then
		If SqlString = "" Then
			SqlString = " Where O_AddTime <= '"&EndTime&"'"
		Else
			SqlString = SqlString & " And O_AddTime <= '"&EndTime&"'"
		End If
	End If
	If sType = "" Or Not IsNumeric(sType) Then sType = 0
	If sType = 1 Then
		If SqlString = "" Then
			SqlString = " Where O_Type = 1"
		Else
			SqlString = SqlString & " And O_Type = 1"
		End If
	ElseIf sType = 2 Then
		If SqlString = "" Then
			SqlString = " Where O_Type = 2"
		Else
			SqlString = SqlString & " And O_Type = 2"
		End If
	End If
	If KeyWord <> "" Then
		If SqlString = "" Then
			SqlString = " Where (O_UserName Like '%"&keyword&"%' Or O_PayCode Like '%"&keyword&"%')"
		Else
			SqlString = SqlString & " And (O_UserName Like '%"&keyword&"%' Or O_PayCode Like '%"&keyword&"%')"
		End If
	End If
	If MoneySize = "" Or Not IsNumeric(MoneySize) Then MoneySize=0
	MoneySize = Cint(MoneySize)
	If PayMoney <> "" And IsNumeric(PayMoney) Then
		If MoneySize = 0 Then
			If SqlString = "" Then
				SqlString = " Where O_PayMoney > "&PayMoney&""
			Else
				SqlString = SqlString & " And O_PayMoney > "&PayMoney&""
			End If
		Else
			If SqlString = "" Then
				SqlString = " Where O_PayMoney < "&PayMoney&""
			Else
				SqlString = SqlString & " And O_PayMoney < "&PayMoney&""
			End If
		End If
	End If

	Dim Page,MaxRows,Endpage,CountNum,PageSearch
	PageSearch = "StartTime="&StartTime&"&EndTime="&EndTime&"&keyword="&KeyWord&"&sType="&sType&"&IsSuc="&IsSuc&"&MoneySize="&MoneySize&"&PayMoney="&PayMoney&""
	Endpage = 0
	MaxRows = 20
	Page = Request("Page")
	If IsNumeric(Page) = 0 or Page="" Then Page=1
	Page = Clng(Page)
	Response.Write "<script language=""JavaScript"" src=""../inc/Pagination.js""></script>"
%>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
<tr><th>论坛交易信息管理</th></tr>
<tr><td class="forumRow" style="line-height : 18px ;">
<B>说明</B>：<BR>
1、建议您开启网络支付或手机短信通道用于用户购买用户点券，<a href="Challenge.asp"><font color=red>前往网络支付或手机短信设置</font></a><BR>
2、论坛中的交易贴、VIP用户、道具中心等交易的货币为论坛金币或点券<BR>
3、金币可通过道具中心赠与用户或论坛版主奖励，点券可通过网络支付或手机短信通道购买，详见相关的设置<BR>
4、此页面功能为查询网络支付或手机短信购买点券的详细情况，由于论坛存在数据破坏等未知因素，此处数据仅供参考，请管理员参考官方相应文档做好论坛安全工作
</td>
</tr>
<FORM METHOD=POST ACTION="ForumPay.asp">
<tr>
<td class="forumRow" style="line-height : 18px ;">
<B>说明</B>：开始和结束时间不填写为查询所有，下拉菜单中选项不选则查询所有信息，关键字可输入用户名、订单号
</td>
</tr>
<tr>
<td class="forumRow" style="line-height : 18px ;">
关键字：
<input size=15 name="keyword" type=text value="<%=keyword%>">
开始时间：
<input size=15 name="StartTime" type=text value="<%=StartTime%>">
结束时间：
<input size=15 name="EndTime" type=text value="<%=EndTime%>">
格式：yyyy-mm-dd
</td>
</tr>
<tr>
<td class="forumRow" style="line-height : 18px ;">
类　型：
<Select Size=1 Name="sType">
<Option value=0>所有</Option>
<Option value=1 <%If sType = 1 Then Response.Write "Selected"%>>网络支付</Option>
<Option value=2 <%If sType = 2 Then Response.Write "Selected"%>>手机短信</Option>
</Select>
交易状态：
<Select Size=1 Name="IsSuc">
<Option value=0>所有</Option>
<Option value=1 <%If IsSuc = 1 Then Response.Write "Selected"%>>成功</Option>
<Option value=2 <%If IsSuc = 2 Then Response.Write "Selected"%>>失败</Option>
</Select>
交易金额：
多于
<input type=radio value="0" name="MoneySize" <%If MoneySize = 0 Then Response.Write "Checked"%>>
少于
<input type=radio value="1" name="MoneySize" <%If MoneySize = 1 Then Response.Write "Checked"%>>
<input type=text size=10 name="PayMoney" value="<%=PayMoney%>">
<input name="submit" value="提交查询" type=Submit>
</td>
</tr>
</FORM>
</table><br>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
<tr>
<th width="150">用户名</th>
<th>订单号</th>
<th width="35">金额</th>
<th width="70">订单类型</th>
<th width="35">状态</th>
<th width="100">交易时间</th>
</tr>
<%
	'Response.Write SqlString
	Dim PageAmount,AllAmount
	PageAmount = 0
	AllAmount = 0
	Set Rs = Dvbbs.Execute("Select Sum(O_PayMoney) From Dv_ChanOrders "&SqlString&"")
	AllAmount = Rs(0)
	If IsNull(AllAmount) Then AllAmount = 0
	Set Rs = Server.CreateObject ("adodb.recordset")
	Sql = "Select O_PayMoney,O_UserName,O_PayCode,O_Type,O_IsSuc,O_AddTime From Dv_ChanOrders "&SqlString&" Order By O_ID Desc"
	If Not IsObject(Conn) Then ConnectionDatabase
	Rs.Open Sql,conn,1,1
	If Rs.Eof And Rs.Bof Then
		Response.Write "<tr><td class=forumRow height=23 colspan=6>未找到相关的交易信息。</td></tr>"
	Else
		CountNum = Rs.RecordCount
		If CountNum Mod MaxRows=0 Then
			Endpage = CountNum \ MaxRows
		Else
			Endpage = CountNum \ MaxRows+1
		End If
		Rs.MoveFirst
		If Page > Endpage Then Page = Endpage
		If Page < 1 Then Page = 1
		If Page >1 Then 				
			Rs.Move (Page-1) * MaxRows
		End if
		SQL=Rs.GetRows(MaxRows)
		For i=0 To Ubound(SQL,2)
			PageAmount = PageAmount + SQL(0,i)
%>
<tr align=center>
<td class="forumRow" height=23><a href="../dispuser.asp?name=<%=Server.HtmlEncode(SQL(1,i))%>" target=_blank><%=Server.HtmlEncode(SQL(1,i))%></a></td>
<td class="forumRow"><%=SQL(2,i)%></td>
<td width="35" class="forumRow"><%=SQL(0,i)%></td>
<td width="70" class="forumRow">
<%
Select Case SQL(3,i)
Case 1
	Response.Write "网络支付"
Case 2
	Response.Write "手机短信"
End Select
%>
</td>
<td width="35" class="forumRow">
<%
Select Case SQL(4,i)
Case 0
	Response.Write "<font color=gray>失败</font>"
Case 1
	Response.Write "成功"
End Select
%>
</td>
<td><%=FormatDateTime(SQL(5,i),2)%>&nbsp;<%=FormatDateTime(SQL(5,i),4)%></td>
</tr>
<%
		Next
	End If
	Rs.Close
	Set Rs=Nothing
	Response.Write "<tr><td class=forumRow height=23 colspan=6><B>本页交易金额</B>：<B>"&PageAmount&"</B> 元人民币，<B>本次查询交易总金额</B>：<B>"&AllAmount&"</B> 元人民币</td></tr>"
	Response.Write "</table>"
	PageSearch=Replace(Replace(PageSearch,"\","\\"),"""","\""")
	If CountNum > 0 Then Response.Write "<SCRIPT>PageList("&Page&",3,"&MaxRows&","&CountNum&","""&PageSearch&""",1);</SCRIPT>"
End Sub

Sub NetPay()
%>
<P>
<%
End Sub
%>