<%@ Language=VBScript %>
<%if Session("weight")<>5 then 
Response.Redirect "error.asp?cause=4"
 end if
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<LINK 
href="css/default.css" rel=stylesheet>
</HEAD>
<BODY bgColor=#FFFBE7>
<object runat=server id=conn1 progid="adodb.connection"></object>
<%application.Lock
conn1.Open Application("p_jyzx")
Application.UnLock
%>
<%	
 set rs=server.CreateObject ("ADODB.recordset")
 sql="select * from my_system where system_id=1"
 rs.Open sql,conn1,3
 if rs.RecordCount<>0 then
	affiliate_visit_value=rs("affiliate_visit_value")
	affiliate_join_value=rs("affiliate_join_value")
	affiliate_join_vip=rs("affiliate_join_vip")
	
 end if   
  temp_order=4
  if request("my_order")<>"" then
	temp_order=request("my_order")
  end if
 if temp_order=1  then
  sql="select * from affiliate order by visit_counter desc"
  elseif temp_order=2  then
   sql="select * from affiliate order by visit_counter asc"
  elseif temp_order=3  then
   sql="select * from affiliate order by ask_money asc"
  elseif temp_order=4  then
   sql="select * from affiliate order by ask_money desc"
 end if
set rs=server.CreateObject ("ADODB.recordset")

   rs.Open sql,conn1,3,2
	rs.PageSize=15
'Response.Write sql
'Response.End 
if session("cur_page")="" then
	session("cur_page")=1
end if

if Request("move")=1 then
	session("cur_page")=1
end if
if Request("move")=2 then
	session("cur_page")=session("cur_page")-1
end if
if Request("move")=3 then
	session("cur_page")=session("cur_page")+1
end if
if Request("move")=4 then
	session("cur_page")=rs.PageCount
end if
if session("cur_page")<1 then
session("cur_page")=1
end if
if session("cur_page")>rs.PageCount then
session("cur_page")=rs.PageCount
end if
   


%>
<TABLE cellSpacing=0 cellPadding=0 width=100% align=center border=0>
  <TBODY>
  <TR >
    <TD  align=left > <font size=4  color=#ff9933>E网友情联盟管理 </font></TD>
    <TD  align=left ><font size=4><a href="affiliate_manage.asp">返回</a></font></TD>
   </TR>
</TBODY>    
 </table>   
<FORM action="affiliate_list.asp" method=POST id=form1 name=form1 >
<p>排序方式：
<%if temp_order=1 then%>
<SELECT id=select1 name=my_order onchange="javascript:form1.submit();">
<OPTION value=1 selected>未结算</OPTION>
<OPTION value=2>已结算</OPTION>
<OPTION value=3>未要求付款/汇款</OPTION>
<OPTION value=4>已要求付款/汇款</OPTION>
</SELECT>
<%elseif temp_order=2 then%>
<SELECT id=select1 name=my_order onchange="javascript:form1.submit();">
<OPTION value=1>未结算</OPTION>
<OPTION value=2 selected>已结算</OPTION>
<OPTION value=3>未要求付款/汇款</OPTION>
<OPTION value=4>已要求付款/汇款</OPTION>
</SELECT>
<%elseif temp_order=3 then%>
<SELECT id=select1 name=my_order onchange="javascript:form1.submit();">
<OPTION value=1>未结算</OPTION>
<OPTION value=2>已结算</OPTION>
<OPTION value=3 selected>未要求付款/汇款</OPTION>
<OPTION value=4>已要求付款/汇款</OPTION>
</SELECT>
<%elseif temp_order=4 then%>
<SELECT id=select1 name=my_order onchange="javascript:form1.submit();">
<OPTION value=1>未结算</OPTION>
<OPTION value=2>已结算</OPTION>
<OPTION value=3>未要求付款/汇款</OPTION>
<OPTION value=4 selected>已要求付款/汇款</OPTION>
</SELECT>
<%end if%>

</p> </FORM>    
   
  
 <BR>
 <TABLE cellSpacing=0 cellPadding=0 width=100% align=center border=0>
  <TBODY>
  <TR> 
  
    <TD>
      <P align=center><B><FONT color=#ff9933>E网友情联盟用户列表</FONT></B></P>
      <TABLE cellSpacing=1 width="100%" align=center bgColor=#FFCC33>
        <TBODY> 
        <TR bgcolor="#FFE28C" > 
          <TD align=middle width=30 height=23>编号</TD>
          <TD align=middle height=23><STRONG>用户名</STRONG></TD>
          <TD align=middle height=23><STRONG>账户金额</STRONG></TD>
          <TD align=middle height=23><STRONG>上次结算时间</STRONG></TD>
       
          <TD align=middle height=23><STRONG>操 作</STRONG></TD>
       
                    <td></td>
          </TR>
  <%	rows=1
  if rs.RecordCount<>0 then
	rs.AbsolutePage=session("cur_page")
	end if
	while not rs.EOF and rows<=rs.PageSize 
	ask_money="未要求付款"
	if	rs("ask_money")=1 then
		ask_money="要求付款"
	end if
	
     money=rs("visit_counter")*affiliate_visit_value+rs("join_counter")*affiliate_join_value+rs("vip_join_counter")*affiliate_join_vip+rs("left_money")
    money=FormatNumber(money,2,-1)
  
%>	
        
        <TR align=middle bgColor=#FFFBE7>
          <TD height=23><%=rows%></TD>
          <TD align=middle height=23>
          <A  href="affiliate_info.asp?user_name=<%=rs("user_name")%>"
            ><%=rs("user_name")%></A></TD>
          <TD bgcolor="#FFFBE7"><%=money%>元</TD>
        <TD><%=rs("start_time")%></TD>
       <TD>
       <%if rs("visit_counter")=0 and rs("join_counter")=0 and rs("vip_join_counter")=0 then%>
       [已结算]&nbsp;
			<%if money>=100 then%><A href=affiliate_post_money.asp?user_name=<%=rs("user_name")%>  >[<%=ask_money%>/汇款]</A>&nbsp;
			<%else%>
				<A href=javascript:alert("金额必须大于100元才可以汇款！");  >[<%=ask_money%>/汇款]</A>&nbsp;
			<%end if%>	
       <%else%>
            <%if money>=100 then%>
        <A href=affiliate_clear.asp?user_name=<%=rs("user_name")%> >[结算]</A>
			<%else%>	
			<A href=javascript:alert("只有账户中金额超过100元才可以结算！") >[结算]</A>
			<%end if%>
         <A href=javascript:alert("请先结算");  >[<%=ask_money%>/汇款]</A>&nbsp;
        <%end if%>&nbsp;
       
        <A href=affiliate_del.asp?user_name=<%=rs("user_name")%> >[删除]</A></TD>
         
                    <td></td>
          </TR>
    <%
    rows=rows+1
    rs.MoveNext
    wend%> 
    <tr bgcolor=#FFF7FD>
          <td colspan=6  align=center bgcolor="#FFFBE7"> 
            <% 'if session("cur_page")>1then %>
            <a href="affiliate_list.asp?move=1&my_order=<%=temp_order%>">首页</a>　 <a href="affiliate_list.asp?move=2&my_order=<%=temp_order%>">上一页</a> 
            <%' end if%>
            <% 'if session("cur_page")<rs.PageCount  then %>
            <a href="affiliate_list.asp?move=3&my_order=<%=temp_order%>">下一页</a>　 <a href="affiliate_list.asp?move=4&my_order=<%=temp_order%>">末页</a> 
            <%' end if %>
          </td>
 </tr>
 <tr bgcolor=#FFF7FD>
          <td colspan=6  align=center bgcolor="#FFFBE7"> 第<%=session("cur_page")%>页/共<%=rs.PageCount%>页 
          </td>
 </tr>
    
       
        </TBODY></TABLE></TD></TR></TBODY></TABLE>
<HR width="100%" SIZE=1>



</BODY>
</HTML>
