<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true"
    ValidateRequest="false" CodeBehind="PaymentAction.aspx.cs" Inherits="PowerEasy.Module.Promotion.WebSite.Admin.Promotion.PaymentAction"
    Title="支付处理" %>
<%@ Import Namespace="PowerEasy.Framework.Common" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CphNavigation" runat="server">
        <pe:ExtendedSiteMapPath ID="SmpNavigator" SiteMapProvider="AdminMapProvider" runat="server" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CphContent" runat="server">

    <script type="text/javascript" src="../../JS/Common.js" ></script>
<script language="javascript" type="text/javascript">
    function GetSum(ID)
    {
        var getTable = document.getElementById('<%=LstCommissionDetail.ClientID %>');
    
        switch (ID)
        {
          case "1":
            getTable = document.getElementById('<%=LstCommissionDetail.ClientID %>');
           break;
		   case "2":
		    getTable = document.getElementById('<%=LstRegisterCommission.ClientID %>');
		   break;
        } 
       
        var objValue='';
        for(var i=0;i<getTable.length;i++)
        {
            if(getTable[i].selected)
            {
                  if(i==0)
                  {
                     objValue=getTable[i].value;
                  }
                  else
                  {
                     objValue+=","+getTable[i].value;
                  }
            }
        }
        var x = new AjaxRequest('XML','commentform');
        x.para = ['id=' + objValue,'typeid=' + ID,'shop='+document.getElementById("commissionsum").innerHTML,'users='+document.getElementById("usercommissionsum").innerHTML];
        x.post('Promotion', '<%=BasePath %>ajax.aspx?HandlerName=PromotionAjaxHandler', function(s) {
        var xml = x.createXmlDom(s);
        var commissionsum = xml.getElementsByTagName("sum")[0].firstChild.data;
		var totalsum=xml.getElementsByTagName("totalsum")[0].firstChild.data;
		switch (ID)
        {
		  case "1":
           document.getElementById("commissionsum").innerHTML=commissionsum;
		  break;
          case "2":
           document.getElementById("usercommissionsum").innerHTML=commissionsum;
		  
		  break;
		}
		
          document.getElementById("totalsum").innerHTML=totalsum + "元";
    });
      
    
    }

</script>


    <asp:ScriptManager ID="SmCategory" runat="server" EnablePartialRendering="true">
    </asp:ScriptManager>
    
    <script type="text/javascript">
        function DoPostBack(username)
        {
            __doPostBack("AddUserButton",username);
        }
        
    </script>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="border">
<tr align="center">
            <td colspan="2" class="spacingtitle">
                佣金支付明细
            </td>
        </tr>
        <tr class="tdbg">
            <td align="right" style="width: 28%" >
                <strong>用户名：</strong>
            </td>
            <td>
                <asp:TextBox ID="TxtUserName" runat="server" Width="147px" MaxLength="20" 
                    ValidationGroup="username"  ontextchanged="TxtUserName_TextChanged" AutoPostBack="true"  />
                <pe:RequiredFieldValidator ID="ValrBankShortName" runat="server" ControlToValidate="TxtUserName"
                    ErrorMessage="用户名称不能为空！" SetFocusOnError="true" Display="Dynamic" ValidationGroup="username" />
                <pec:FloatingDialog ID="FdSelectUser" runat="server" Width="670" Height="400" Name="用户列表" BeginString="&lt;=【" EndString="】"
                Skin="floatingDialogFontSkin" Title="用户列表" LoadUrl="UserNameList.aspx?Select=single" />
            </td>
        </tr>
        
        <asp:Panel ID="PnlShow" runat="server" Visible="false">
            <tr class="tdbg">
            <td align="right" style="width: 28%">
                <strong>申请时间：</strong>
            </td>
            <td>
                <pe:ExtendedLabel ID="ELblTime" runat="server"></pe:ExtendedLabel>
            </td>
        </tr>
          <tr class="tdbg">
            <td align="right" style="width: 28%">
                <strong>申请金额：</strong>
            </td>
            <td>
                <pe:ExtendedLabel ID="ELblAmount" runat="server"></pe:ExtendedLabel>
            </td>
        </tr>
          <tr class="tdbg">
            <td align="right" style="width: 28%">
                <strong>佣金余额：</strong>
            </td>
            <td>
                <pe:ExtendedLabel ID="ELbBalance" runat="server"></pe:ExtendedLabel>
            </td>
        </tr>
        
        </asp:Panel>
          <tr class="tdbg">
            <td align="right" style="width: 28%">
                <strong>查询方式：</strong>
            </td>
            <td> 
              搜索全部未支付佣金：<asp:Button ID="BtnAllSearch" runat="server" CssClass="inputbutton" 
                    Text="搜索" onclick="BtnAllSearch_Click" ValidationGroup="username" />
              <br />
             搜索从<pe:DatePicker ID="DpkBeginDate" Width="70px" runat="server"></pe:DatePicker>&nbsp;到&nbsp;<pe:DatePicker ID="DpkEndDate" Width="70px" runat="server"></pe:DatePicker>佣金 
                <asp:Button ID="BtnSearch" runat="server" CssClass="inputbutton" ValidationGroup="username" Text="搜索" 
                    CausesValidation="False" onclick="BtnSearch_Click" />                
                </td>
        </tr>
        
        <tr class="tdbg">
        <td align="right" style="width: 28%" valign="top">
                <strong>佣金列表：</strong>
            </td>
            <td>
            <table border="0" cellpadding="0" cellspacing="0" >
        <tr align="center">
            <td id="TabTitle0" class="titlemouseover"  onclick="ShowTabs(0)">
                注册佣金列表
            </td>
            <asp:Panel ID="pnl" runat="server">
             <td id="TabTitle1" class="tabtitle"  onclick="ShowTabs(1)">
              <asp:Label ID="LblShopList" runat="server" Text="商品佣金列表"></asp:Label>  
              
            </td></asp:Panel>
            </tr></table> 
            
        <!--注册佣金列表-->
            <table style="width: 100%; " cellpadding="2" cellspacing="1" class="border"  
        id="Tabs0">
        <tr><td>
       
        <table border="0" cellpadding="0" cellspacing="0"><tr>
                  <td style="width: 94px">注册会员名</td><td style="width: 85px">时间</td>
                  <td style="width: 67px">金额</td></tr></table>
              <asp:ListBox ID="LstRegisterCommission" runat="server" DataTextField="FilelName" DataValueField="Id"  
                                SelectionMode="Multiple" Height="200px" Width="400px" onchange="GetSum('2')" >                                
                                </asp:ListBox>
                                <br />
                     <input id="BtnSelectUserAll" onclick="SelectUserAll()" type="button" class="inputbutton"
                                value="  选定所有项  " /> <input id="BtnCancelUserAll" onclick="UnSelectUserAll()" type="button" class="inputbutton"
                                value="取消选定所有项" /> 
        </td></tr>

        </table>
         <!--注册佣金列表-->
        <asp:Panel ID="PnlShop" runat="server">
            
            <!--商品佣金列表-->
           <table style="width: 100%; display:none;" table-layout: fixed;" cellpadding="2" cellspacing="1"
        class="border" id="Tabs1">
        <tr><td>
        <table border="0" cellpadding="0" cellspacing="0" style="width: 321px"><tr>
                  <td style="width: 71px">订单号</td><td style="width: 89px">时间</td>
                  <td style="width: 67px">金额</td><td style="width: 59px">数量</td><td>总额</td></tr></table>
              <asp:ListBox ID="LstCommissionDetail" runat="server" DataTextField="FilelName" DataValueField="Id"  
                                SelectionMode="Multiple" Height="200px" Width="400px" onchange="GetSum('1')" >                                
                                </asp:ListBox>
                                <br />
                     <input id="BtnSelectAll" onclick="SelectAll()" type="button" class="inputbutton"
                                value="  选定所有项  " /> <input id="BtnCancelAll" onclick="UnSelectAll()" type="button" class="inputbutton"
                                value="取消选定所有项" />
        </td></tr>
        </table>
        </asp:Panel>
		<table border="0" cellpadding="0" cellspacing="0" style="width: Auto"><tr><Td>
		  所选总金额：<font color="red"><span id="totalsum" >0.00元</span></font>=注册佣金所选金额为：<font color="red"><span id="usercommissionsum">0.00元</span></font><asp:Label ID="LblShop" runat="server"  Text=" + 商品佣金所选金额为："></asp:Label><font color="red"><span id="commissionsum" style='<%=ShopDisplay%>' >0.00元</span></font>
		  </td></tr></table>             
            </td>
        </tr>
        
       <tr class="tdbgbottom">
            <td colspan="2">
                <asp:Button ID="BtnUpdate" runat="server" Text="审批通过" OnClick="BtnUpdate_Click" ValidationGroup="username" />&nbsp;&nbsp;<asp:Button ID="BtnNoPass" runat="server" Text="拒绝申请" OnClientClick="" onclick="BtnNoPass_Click" ValidationGroup="username" />
            &nbsp;&nbsp;<asp:Button ID="BtnComeBack" Text="返回" OnClick="BtnComeBack_Click" runat="server" /></td>
        </tr>
        </table>
		  
		<br />
        
      <asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate> 
<table style="width: 100%; margin: 0 auto;" cellpadding="0" cellspacing="0">
  <tr>
            <td id="AdminTabs">
                <ul>
                    <!-- CSS Tabs -->
                    <li <pe:ExtendedLiteral HtmlEncode="false" runat="server" ID="LtrCommissionDetail" /> >
                        <asp:LinkButton ID="LinkCommissionDetail" runat="server" CommandArgument="0" onclick="ShowBookmarks"><span>已结清佣金列表</span></asp:LinkButton>
                    </li>
                    <li  <pe:ExtendedLiteral ID="LtrGatheringDetail" runat="server" 
                            HtmlEncode="false"/> >
                            <asp:LinkButton ID="LinkGatheringDetail" 
                            runat="server" CommandArgument="1" onclick="ShowBookmarks"><span>已付款提现记录</span></asp:LinkButton>
                                    </li>
                </ul>
            </td>
        </tr>
    </table>
     <pe:ExtendedGridView ID="EgvGatheringDetail" runat="server" CheckBoxFieldHeaderWidth="3%"  
                 DataSourceID="OdsGatheringDetail" IsHoldState="True" SerialText=""  Visible="false"
                  AutoGenerateColumns="False" AllowPaging="True" DataKeyNames="ID">
              <Columns>
                  <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" />
                   <pe:TemplateField HeaderText="申请金额" SortExpression="Amount">
                <ItemStyle HorizontalAlign="Center" Width="7%"  />
                <ItemTemplate>
                    <%# Eval("Amount","{0:N2}")%>元
                </ItemTemplate>
            </pe:TemplateField>                     
                  <asp:BoundField DataField="UserName" HeaderText="用户名" 
                      SortExpression="UserName" />
                  <asp:BoundField DataField="CreateTime" HeaderText="申请时间" 
                      SortExpression="CreateTime" />
                   <pe:TemplateField HeaderText="状态" SortExpression="State">
                <ItemStyle HorizontalAlign="Center" />
                <ItemTemplate>
                    <%#PowerEasy.Module.Promotion.BusinessLogic.ApplyGathering.GetState(DataConverter.ToInt32(Eval("State")))%>
                </ItemTemplate>
            </pe:TemplateField>
                  <asp:BoundField DataField="ApprovalHuman" HeaderText="审批人" 
                      SortExpression="ApprovalHuman" />
                  <asp:BoundField DataField="Sender" HeaderText="汇款人" 
                      SortExpression="Sender" />
                  <asp:BoundField DataField="ProcessingTime" HeaderText="审批时间" 
                      SortExpression="ProcessingTime" />
                  <asp:BoundField DataField="RemittancesTime" HeaderText="汇款时间" 
                      SortExpression="RemittancesTime" />
                      
                        <pe:TemplateField HeaderText="实付金额" SortExpression="RealityAmount">
                <ItemStyle HorizontalAlign="Center" Width="7%"  />
                <ItemTemplate>
                    <%# Eval("RealityAmount", "{0:N2}")%>元
                </ItemTemplate>
            </pe:TemplateField>
                      
              </Columns>
             </pe:ExtendedGridView>
             <asp:ObjectDataSource ID="OdsGatheringDetail" runat="server" 
                  SelectMethod="GetApplyGatheringInfoListByUserName" EnablePaging="True" MaximumRowsParameterName="maxNumberRows" StartRowIndexParameterName="startRowIndexId"
                  TypeName="PowerEasy.Module.Promotion.BusinessLogic.ApplyGathering" 
                SelectCountMethod="GetTotalOfApplyGathering">
                 <SelectParameters>
                     <asp:ControlParameter ControlID="HdnUserName" Name="UserName" 
                         PropertyName="Value" Type="String" />
                     <asp:ControlParameter ControlID="HdnState" DefaultValue="2" Name="State" 
                         PropertyName="Value" Type="Int32" />
                 </SelectParameters>
             </asp:ObjectDataSource>
             
            <pe:ExtendedGridView ID="EgvCommissionDetail" runat="server" 
                CheckBoxFieldHeaderWidth="3%" DataSourceID="OdsCommissionDetail" 
                IsHoldState="True" SerialText="" AutoGenerateColumns="False" 
                AllowPaging="True" DataKeyNames="ID">
                <Columns>
                    <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" />
                    <asp:BoundField DataField="ProductID" HeaderText="商品编号" 
                        SortExpression="ProductID" />
                    <asp:BoundField DataField="UserName" HeaderText="用户名" 
                        SortExpression="UserName" />
                    <asp:BoundField DataField="Commission" HeaderText="佣金" 
                        SortExpression="Commission" />
                    <asp:BoundField DataField="CreateTime" HeaderText="创建时间" 
                        SortExpression="CreateTime" />
                    <asp:BoundField DataField="GatheringID" HeaderText="申请明细ID" 
                        SortExpression="GatheringID" />
                    <asp:BoundField DataField="Amount" HeaderText="数量" 
                        SortExpression="Amount" />
                   
                </Columns>
            </pe:ExtendedGridView>
             <asp:ObjectDataSource ID="OdsCommissionDetail" runat="server" 
                SelectMethod="GetCommissionInfoListByUserName"  EnablePaging="True" MaximumRowsParameterName="maxNumberRows" StartRowIndexParameterName="startRowIndexId"
                TypeName="PowerEasy.Module.Promotion.BusinessLogic.CommissionDetailManage" 
                SelectCountMethod="TotalOfCommissionDetailInfo">
                 <SelectParameters>
                     <asp:ControlParameter ControlID="HdnUserName" Name="userName" 
                         PropertyName="Value" Type="String" />
                     <asp:ControlParameter ControlID="HdnStateType" DefaultValue="2" 
                         Name="stateType" PropertyName="Value" Type="Int32" />
                 </SelectParameters>
            </asp:ObjectDataSource>
             <asp:HiddenField ID="HdnUserName" runat="server" />
             <asp:HiddenField ID="HdnState" runat="server" />
            <asp:HiddenField ID="HdnStateType" runat="server" />
             </ContentTemplate></asp:UpdatePanel>
        
<br />
<br />
<script language="javascript" type="text/javascript">
          function ShowTabs(ID){
               for (i=0;i< 2;i++){
                    if(i == ID){
                        document.getElementById("TabTitle" + i).className="titlemouseover";
                        document.getElementById("Tabs" + i).style.display="";
                    }
                    else{
                        document.getElementById("TabTitle" + i).className="tabtitle";
                        document.getElementById("Tabs" + i).style.display="none";
                    }
               }
          } 
        </script>
</asp:Content>
