<%@ Page Language="C#" AutoEventWireup="true"  CodeBehind="agentvictoryreport.aspx.cs" Inherits="AgentManager.admin.agentvictoryreport" %>


      
      <link rel="stylesheet" href="css/bootstrap/css/bootstrap.min.css"/>
      <link rel="stylesheet" href="css/AdminLTE.css" />
      <link rel="stylesheet" href="css/plugins/iCheck/flat/blue.css"/> 

<script src="js/jquery-1.9.1.min.js"></script>
<script src="css/bootstrap/js/bootstrap.min.js"></script>
<script src="css/My97DatePicker/WdatePicker.js"></script>
<script src="js/mainData.js"></script>

     <div class="content-wrapper">
       
         <h2>
 亏盈报表 
    <small></small>
    </h2>
         
         <form action="agentvictoryreport.aspx" method="post">
 <div class="col-md-6">
              <table class="table">
                  <tr>
                     
                      <td><label>时间范围</label></td>
                    <td colspan="2">
                        <div class="btn-group">
                          
                          <button type="button" class="btn btn-default" onclick="setAutoTime('1','starttime','endtime')">最近3天</button>
                         
                          <button type="button" class="btn btn-default" onclick="setAutoTime('2','starttime','endtime')">最近7天</button>
                          <button type="button" class="btn btn-default" onclick="setAutoTime('3','starttime','endtime')">最近30天</button>
                        </div>
                    </td>
                  </tr>
                  <tr>
                      <td><label>开始时间</label></td>
                      <td><input name="starttime" type="text" id="starttime" maxlength="10" autocomplete="off" value="<%=start %>" class="form-control" onclick="WdatePicker()" /></td>
                      <td><label>结束时间</label></td>
                      <td><input name="endtime" type="text" id="endtime" maxlength="10" autocomplete="off" value="<%=end %>" class="form-control" onclick="WdatePicker()" /></td>
                      <td><input type="submit" name="Submit" value="搜索" class="btn btn-block btn-primary"/></td>
                  </tr>
              </table>
        </div>
         </form>
<section class="content">

<div id="mainbox">
<form id="form1" name="form1" method="post">
 
    <table class="box">
         <tr>
                 <td  style="background-color: #fff;color:#0026ff;">直属代理反水报表</td>

             </tr>
        <tr>
            <td  style="background-color: #367fa9;color:#fff;">代理账号</td>
            <td  style="background-color: #367fa9;color:#fff;">姓名</td>
            <td  style="background-color: #367fa9;color:#fff;">总反水</td>
           
            <td  style="background-color: #367fa9;color:#fff;">时间范围</td>
        </tr>
    
            <%
                decimal sum = 0;
                decimal sum1 = 0;
                foreach (var item in uli)
                {%>
            <tr>
             <td><%=item.Username %></td>
            <td><%=item.Myname %></td>
            
                <% sum = Convert.ToDecimal(GetAgentzfs(item.Username));sum1 += sum; %>
            <td><%= Convert.ToDecimal(sum)<0?Convert.ToDecimal(sum)*(-1):Convert.ToDecimal(sum)-Convert.ToInt32(GetZFS1(item.Username)) %></td>
                
            <td><%= start %>至<%=end %></td>
                </tr>
            <%

                } %>
           
        <tr><td>合计</td><td>-</td><td style="color:red"><%=sum1 -SumZFS %></td><td><%= start %>至<%=end %></td></tr>
        
    </table>
    <br />
<table class="box">
   
    
       <tr>
                 <td  style="background-color: #fff;color:#0026ff;">下级会员(代理)报表</td>

             </tr>
    
   

  <tr>
    <td  style="background-color: #367fa9;color:#fff;"><strong>帐号</strong></td>
    <td style="background-color: #367fa9;color:#fff;">  <strong>姓名</strong></td>
    <td  style="background-color: #367fa9;color:#fff;"><strong>上级</strong></td>
    <td  style="background-color: #367fa9;color:#fff;"><strong>账户类型</strong></td>
    <td  style="background-color: #367fa9;color:#fff;"><strong>存款次</strong></td>
    <td  style="background-color: #367fa9;color:#fff;"><strong>汇款次</strong></td>
    <td  style="background-color: #367fa9;color:#fff;"><strong>提款次</strong></td>
      <td  style="background-color: #367fa9;color:#fff;"><strong>红包次</strong></td>
      <td  style="background-color: #367fa9;color:#fff;"><strong>总存款</strong></td>
 
    <td  style="background-color: #367fa9;color:#fff;"><strong>总汇款</strong></td>
    <td  style="background-color: #367fa9;color:#fff;"><strong>总提款</strong></td>    
      <td  style="background-color: #367fa9;color:#fff;"><strong>会员总返水</strong></td>
      <td  style="background-color: #367fa9;color:#fff;"><strong>总有效投注</strong></td>
      <td  style="background-color: #367fa9;color:#fff;"><strong>总输赢</strong></td>
    <td  style="background-color: #367fa9;color:#fff;"><strong>总优惠</strong></td>    
    <td  style="background-color: #367fa9;color:#fff;"><strong>总红包</strong></td>    
    <td  style="background-color: #367fa9;color:#fff;"><strong>时间范围</strong></td>    

  </tr>
   
  <%
      int num21 = 0;
      int num22 = 0;
      int num23 = 0;
      int num24 = 0;

      if (dataTable!=null)
      {

          string str3 = "";
          string str4 = "";
          bool isagen = false;
          int num1 = 0;
          int num2 = 0;
          int num3 = 0;
          int num4 = 0;
          int num5 = 0;
          int num6 = 0;
          int num7 = 0;
          int num8 = 0;
          int num9 = 0;
          int num10 = 0;
          decimal sumvali = 0;
          decimal sumwin = 0;

          for (int i = 0; i <  dataTable.Rows.Count; i++)
          {

              str3 = dataTable.Rows[i]["username"].ToString();
              str4= dataTable.Rows[i]["myname"].ToString();
              isagen=Convert.ToBoolean(dataTable.Rows[i]["is_agent"]);
              int num11 = Convert.ToInt32(dataTable.Rows[i]["ckcs"]);
              int num12 = Convert.ToInt32(dataTable.Rows[i]["hkcs"]);
              int num13 = Convert.ToInt32(dataTable.Rows[i]["tkcs"]);
              int num14 = Convert.ToInt32(dataTable.Rows[i]["hbcs"]);
              int num15 = Convert.ToInt32(dataTable.Rows[i]["zck"]);
              int num16 = Convert.ToInt32(dataTable.Rows[i]["zhk"]);
              int num17 = Convert.ToInt32(dataTable.Rows[i]["ztk"]);
              int num18 = Convert.ToInt32(dataTable.Rows[i]["zfs"]);
              int num19 = Convert.ToInt32(dataTable.Rows[i]["zyh"]);
              int num20 = Convert.ToInt32(dataTable.Rows[i]["zhb"]);
              num1 += num11;
              num2 += num12;
              num3 += num13;
              num4 += num14;
              num5 += num15;
              num6 += num16;
              num7 += num17;
              num8 += num18;
              num9 += num19;
              num10 += num20;

              %>
    
      <tr>
    <td><strong><%=str3 %></strong></td>
    <td><strong><%=str4 %></strong></td>
    <td><strong><%=GetAgentName(str3) %></strong></td>
    <td><strong><%= isagen==true?"代理":"会员" %></strong></td>
    <td><strong><%=num11 %></strong></td>
    <td><strong><%=num12 %></strong></td>
    <td><strong><%=num13 %></strong></td>
    <td><strong><%=num14 %></strong></td>
    <td><strong><%=num15 %></strong></td>
    <td><strong><%=num16 %></strong></td>
    <td><strong><%=num17 %></strong></td>
    <td><strong><%=num18 %></strong></td>
          <% string vali_win = GetValiWin(str3);
              sumvali+=Convert.ToDecimal(vali_win.Split(',')[0]);
              sumwin+=Convert.ToDecimal(vali_win.Split(',')[1]);
              %>
    <td><strong><%= vali_win.Split(',')[0] %></strong></td>
    <td><strong><%=vali_win.Split(',')[1] %></strong></td>
    <td><strong><%=num19 %></strong></td>
    <td><strong><%=num20 %></strong></td>
   
     <td><strong><%= start %>至<%=end %></strong></td>

 

  </tr>
    
    <%


          }
        %>
              <tr>
    <td><strong style="color:red">汇总</strong></td>
    <td style="color:red"><strong>-</strong></td>
    <td style="color:red"><strong>-</strong></td>
    <td style="color:red"><strong>-</strong></td>
    <td style="color:red"><strong><%=num1 %></strong></td>

    <td style="color:red"><strong><%=num2 %></strong></td>
    <td style="color:red"><strong><%=num3 %></strong></td>
    <td style="color:red"><strong><%=num4 %></strong></td>
    <td style="color:red"><strong><%=num5 %></strong></td>
    <td style="color:red"><strong><%=num6 %></strong></td>
    <td style="color:red"><strong><%=num7 %></strong></td>
    <td style="color:red"><strong><%=num8 %></strong></td>
    <td style="color:red"><strong><%=sumvali %></strong></td>
    <td style="color:red"><strong><%=sumwin %></strong></td>
    <td style="color:red"><strong><%=num9 %></strong></td>
    <td style="color:red"><strong><%=num10 %></strong></td>
    <td><strong><%= start %>至<%=end %></strong></td>



  </tr>
    <%
        num21 = num5 + num6 - num7;
        num22 = num5;
        num23 = num6;
        num24 = num7;
            %>
    
   
    <%
      } %>
    

    
</table>

     
</form>

</div>

</section>



<%--<div class="page" id="pagebox" runat="server">
     <div>页码<strong><%= pageindex %></strong>/<%= pagecount %>，共<span><%=count %></span>条记录，每页显示<span><%= pagesize %></span>条</div>
    <div>
        <a  class="btn btn-primary btn-sm" href="lowercreditdata.aspx?username=<%=username %>&page=<%= 1 %>&starttime=<%= start %>&endtime=<%=end %>">首页</a>
        <a  class="btn btn-primary btn-sm" href="lowercreditdata.aspx?username=<%= username %>&page=<%= pageindex-1 %>&starttime=<%= start %>&endtime=<%=end %>">上一页</a>
        <a  class="btn btn-primary btn-sm" href="lowercreditdata.aspx?username=<%= username %>&page=<%= pageindex+1%>&starttime=<%= start %>&endtime=<%=end %>">下一页</a>
        <a  class="btn btn-primary btn-sm" href="lowercreditdata.aspx?username=<%= username %>&page=<%= pagecount %>&starttime=<%= start %>&endtime=<%=end %>">末页</a>
     </div>
   
</div>--%>

      


</div>





