<!--#include file="../check.asp"--><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>商户后台 - 首页</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link type="text/css" rel="stylesheet" href="/css/reset.css" />
<link type="text/css" rel="stylesheet" href="/css/main.css" />
<link type="text/css" rel="stylesheet" href="/css/template_vendor.css" />
<link type="text/css" rel="stylesheet" href="/css/dashboard.aspx.css" />
<script type="text/javascript" src="/scripts/common.js"></script>
<script type="text/javascript" src="/scripts/nav.js"></script>
<script type="text/javascript" src="/scripts/footerdock.js"></script>
</head>
<body>
<!--#include file="top.asp"-->
<script type="text/javascript">
function viewBulletin(id) {
	window.open('bulletin.asp?id=' + id, 'bulletin', 'width=500,height=450,left=320,top=160,scrollbars=yes');
}
</script>


<%
Set Rs=Server.CreateObject("ADODB.Recordset")
set Rs=GrateRs("select * from member where username='"&session("Usr_UserName")&"'",1)
regtime=Rs("regtime")
rs.close
set rs=nothing
qq =  DateDiff("d", regtime, Now)
%>

	<div id="mainborder">
		<div id="main">
			
		<div id="mainpart">
			<div id="welcome">
				您好 <span class="orange"><%=session("usr_username")%></span> 欢迎回来。
				您的商户号 <span class="orange"><%=session("Usr_userid")%></span>
				创建于 <span class="orange"><%=regtime%></span>
				已使用 <span class="orange"><%=qq%></span> 天。
			</div>
			
			<div id="buttonlist">
				<ul>
					<li><a href="Orders.asp"><img src="../images/icon/calendar.gif" border="0" alt="" /><br />订单查询</a></li>
					<li><a href="Merchandises.asp"><img src="../images/icon/server.gif" border="0" alt="" /><br />服务器管理</a></li>

					<li><a href="Merchandises.asp"><img src="../images/icon/folditem.gif" border="0" alt="" /><br />分区管理</a></li>
					<li><a href="Groups.asp"><img src="../images/icon/foldgroup.gif" border="0" alt="" /><br />分组管理</a></li>
					<li><a href="Downloads.asp"><img src="../images/icon/shield.gif" border="0" alt="" /><br />相关下载</a></li>
					<li><a href="Profit.asp"><img src="../images/icon/money.gif" border="0" alt="" /><br />提成比例</a></li> 
					<li><a href="MessageBox.asp"><img src="../images/icon/book.gif" border="0" alt="" /><br />留言信箱</a></li>
				</ul>
			</div>

			<div>
				<div class="fl"><h3 class="ico_histo">最新订单</h3></div>
				<div class="fr"><a href="Orders.asp" class="ico_search block">查询更多...</a></div>
				<div class="lb clear"></div>
			</div>
			<div class="gridwrap">
				<table cellpadding="5" cellspacing="0" class="grid fixed">
					<thead>
						<th width="105">时间</th>
						<th>分区</th>
						<th width="85">帐号ID</th>
						<th width="65">金额</th>
						<th width="100">支付方式</th>
						<th width="130">卡号/银行订单号</th>
					</thead>


                <%



upline=Session("Usr_UserName")
startdate=ClearSQL(request("startdate"))
if startdate="" or isnull(startdate) then startdate=date()
enddate=ClearSQL(request("enddate"))
if enddate="" or isnull(enddate) then enddate=date()




		   searchstr=""
		   dateparam="d"
		   if upline<>"" then searchstr="state<3 and upline='"&upline&"'"

		   
		   if isdate(startdate) then 
		      if not searchstr="" then searchstr=searchstr+" and "
 		     searchstr=searchstr+"regdate >= '"&startdate&"'"
		   end if

		   if isdate(enddate) then 
		      if not searchstr="" then searchstr=searchstr+" and "
 		      searchstr=searchstr+"regdate <= '"&enddate&"'"
		   end if

				
			 
		   if not searchstr="" then searchstr=" where "+searchstr





	
		   sqlInfo = "Select * from mobile "&searchstr&" order by id desc"
		   set Rs=GrateRs(sqlInfo,1)
		   Rs.PageSize=15
		   if not Rs.eof then 
		   If Nowpage=0 then Nowpage=1
		   Rs.AbsolutePage=Nowpage
		   i=1
		   do while not Rs.eof and i<=Rs.pagesize
		   	
		   %>




							<tr class="alt">
<td><%=Rs("regDate")&"&nbsp;"&Rs("regTime")%></td>
<td><%
						set wrs = GrateRs("select wooolName from L_woool where ID="&rs("wooolID"),1)
						if wrs.recordcount<>0 then
						response.Write wrs("wooolName")
						else response.write "<font color=red>服务已被删除</font>"
						end if
						%></td>
<td><%=rs("number")%></td>
<td><%=zero(formatnumber(rs("Price")))%> <span class="gray">元</span></td>
<td><%=rs("Pname")%></td>
<td><%=rs("usercode")%></td>


</tr>


                <%
		   i=i+1
		   Rs.movenext
		   loop
end if
		  %>
 




					
				</table>
			</div>
		</div>



<%



		   '总金额//////////////////////////////////////////
		   sqlInfot = "Select sum(price) as tp,sum(fencheng) as gmm from mobile "&searchstr&""	
		   set Rsp=GrateRs(sqlInfot,1)
		   if Rsp("tp")="" or isnull(rsp("tp")) then
		   tp=0
		   gmm=0
		   else
		   tp=rsp("tp")
		   gmm=rsp("gmm")
		   end if


		   Set Rs=Server.CreateObject("ADODB.Recordset")
			set Rs=GrateRs("select * from member where username='"&upline&"'",1)
			moneyTotal=Rs("moneyTotal")
			removeMoney=Rs("removeMoney")
			if moneyTotal-removeMoney<0 then 
			Money=0
			else
			Money= moneyTotal-removeMoney
		   	end if


		   Set Rst=Server.CreateObject("ADODB.Recordset")
			set Rst=GrateRs("select SUM(money) as txMoney from M_tixian where username='"&upline&"' and state=0",1)
			if IsNull(Rst("txMoney")) then
			txMoney= zero(formatnumber(("0")))
			else
			txMoney= zero(Rst("txMoney"))
			end if

			%>



		<div id="aside">
			<div class="asideblock">
				<h3 class="ico_wallet">我的账户</h3>
				<ul>
					<li>今日收入 : &nbsp; <span id="incomeToday"><%=zero(formatnumber(gmm))%></span> 元</li>
					<li>帐户金额 : &nbsp; <span id="balance"><%=zero(formatnumber(Money))%></span> 元</li>
					<li>正在提现 : &nbsp; <span id="encashing"><%=zero(formatnumber(txMoney))%></span> 元</li>
					
					<li>商户级别 : &nbsp; <span class="red">
<%
			select case Rs("hy")
			case 0
			 response.write("普通会员")
			case 1
			 response.write("高级会员")
			case 2
			 response.write("黄金商户")
			case 3
			 response.write("白金商户")
			case 4
			 response.write("钻石商户")
			case else
			 response.write("未知级别")
			end select
			%>


</span></li>
					<li>商户积分 : &nbsp;  <span class="red"><%=rs("jifen")%></span> 分　<a href="profit.asp" class="underline">积分用途</a></li>
					<li><a href="Balance.asp"><img id="btn_encash" src="../images/encash.gif" onmouseover="javascript:this.src='../images/encash_hover.gif';" onmouseout="javascript:this.src='../images/encash.gif';" alt="" border="0" /></a></li>
				</ul>
			</div>
			
			<div class="asideblock">
				<h3 class="ico_msg">站内公告</h3>
				<ul>

<%
Set Rs=GrateRs("select top 6 * from H_news order by newsid desc",1)
if not Rs.eof then 
do while not Rs.eof and i<=Rs.pagesize
%>
							<li class="lister nowrap">
								<a title="<%=Rs("topic")%>" href="javascript:viewBulletin(<%=Rs("newsid")%>);"><%=Rs("topic")%></a>
								<span style="display:none"><br /><span class="gray small"><%=Rs("time")%></span></span>
							</li>

<%
Rs.movenext
loop
end if
%>

						
				</ul>
			</div>
		</div>

		<div class="clear"></div>
	
		</div>
	</div>
</div>
</body>
</html>
