<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Main.master" AutoEventWireup="true"
    CodeFile="SettlSearch.aspx.cs" Inherits="SettlSearch" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <!-- DataTables -->
    <link rel="stylesheet" href="../plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
    <link rel="stylesheet" href="../plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
    <link rel="stylesheet" href="../plugins/datatables-buttons/css/buttons.bootstrap4.min.css">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
	  <div class="container-fluid">
		<div class="row mb-2">
		  <div class="col-sm-6">
			<h1><asp:Label ID="lblTitle" runat="server" Text="Label"></asp:Label></h1>
		  </div>
		  <div class="col-sm-6">
			<ol class="breadcrumb float-sm-right">
			  <li class="breadcrumb-item"><a href="#">Home</a></li>
			  <li class="breadcrumb-item active">Settlement</li>
			  <li class="breadcrumb-item active">Settlement Search</li>
			</ol>
		  </div>
		</div>
	  </div><!-- /.container-fluid -->
	</section>
        <!-- /.content-header -->
        <!-- Main content -->
        <section class="content">
	    <div class="container-fluid">
        <asp:Label ID="lblError" runat="server" Visible="false"></asp:Label>
        <div class="card card-warning">
              <%--<div class="card-header">
                <h3 class="card-title">Search Filters</h3>
              </div>--%>
              <!-- /.card-header -->
              <div class="card-body">
                  <div class="row">
                      <%if (selectedCardScheme == "Visa" || selectedCardScheme == "MCacq" || selectedCardScheme == "VISA_BILL_M" || selectedCardScheme == "VISA_BILL_Q" || selectedCardScheme == "MC_BILL")
                          {  %>
                      <div class="col-sm-4">
                          <div class="form-group">
                              <label>Product</label>
                              <asp:DropDownList ID="ddlProducts" runat="server" DataTextField="PRODUCT_NAME" 
                                  DataValueField="ID" class="form-control select2" AutoPostBack="True"
                                  OnSelectedIndexChanged="ddlProducts_SelectedIndexChanged">
                              </asp:DropDownList>

                          </div>
                      </div>
                      <%} %>

                      <%if ((Helper.IsMultiCurrencyProduct_CS(ddlProducts.SelectedValue)))
                          {  %>
                      <div class="col-sm-4">
                          <div class="form-group">
                              <label>Currency</label>
                              <asp:DropDownList ID="ddlCurrency" runat="server" DataTextField="Curr_Name" 
                                  DataValueField="CardScheme_Curr_ID" class="form-control select2">
                              </asp:DropDownList>

                          </div>
                      </div>
                      <%} %>

                      <div class="col-sm-4">
                          <div class="form-group">
                              <label>Date</label>
                              <div class="input-group date" id="sdate" data-target-input="nearest">
                                  <asp:TextBox ID="txtsdate" data-target="#sdate" runat="server" class="form-control datetimepicker-input"></asp:TextBox>
                                  <div class="input-group-append" data-target="#sdate" data-toggle="datetimepicker">
                                      <div class="input-group-text"><i class="fa fa-calendar"></i></div>
                                  </div>
                              </div>
                          </div>
                      </div>

                  </div>
                  <div class="row">
                      <div class="col-12">
                          <asp:Button ID="Button3" runat="server" Text="Search" CssClass="btn btn-primary btn-l" OnClick="ButtonSearch_Click" />&nbsp;&nbsp;
                        <asp:Button ID="btnGenDtlReport" runat="server" Text="Detail Report" CssClass="btn btn-primary btn-l"
                            OnClientClick="" OnClick="btnGenDtlReport_Click" />&nbsp;&nbsp;
                            <% if (selectedCardScheme == "Visa")
                                { %>
                          <asp:Button ID="btnGenSumReport" runat="server" Text="Visa Summary Report" CssClass="btn btn-primary btn-l"
                              OnClientClick="" OnClick="btnGenSumReport_Click" />&nbsp;&nbsp;
                            <%} %>
                          <% if (selectedCardScheme == "Amex")
                              { %>
                          <asp:Button ID="Button1" runat="server" Text="Amex Summary Report" CssClass="btn btn-primary btn-l"
                              OnClientClick="" OnClick="btnGenAmexSumReport_Click" />&nbsp;&nbsp;
                            <%} %>
                          <% if (selectedCardScheme == "Maestro")
                              { %>
                          <asp:Button ID="Button2" runat="server" Text="MDS Summary Report" CssClass="btn btn-primary btn-l"
                              OnClientClick="" OnClick="btnGenMDSSumReport_Click" />&nbsp;&nbsp;
                            <%} %>
                            &nbsp;<asp:Label ID="lbl_File_Number" runat="server" class="btn btn-primary btn-l" Text="" Visible="false"></asp:Label>
                          <asp:Label ID="lbl_Status" runat="server" class="fieldNormal" Text="" Visible="false"></asp:Label>
                      </div>
                    </div>
              </div>
              <!-- /.card-body -->
            </div>

		    <!-- PanelMcAcq -->
            <asp:Panel ID="PanelMcAcq" runat="server" Visible="false">
                <div class="card card-info color-palette-box">
                    <div class="card-header">
                        <h3 class="card-title">
                            <i class="fas fa-tag"></i>
                            <b>Select Mastercard Acquirer File</b>
                        </h3>

                        <div class="card-tools">
                            <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                <i class="fas fa-minus"></i>
                            </button>
                        </div>
                    </div>
                    <div class="card-body ">
                        <div style="width: 100%; display: inline-block; vertical-align: top; overflow-x: auto;">
                            <asp:GridView ID="gvMcAcq" class="table table-striped table-bordered table-sm" OnRowCreated="gvMcAcq_RowCreated" runat="server" AutoGenerateColumns="False" OnRowCommand="GridView1_RowCommand" OnPreRender="GridView1_PreRender"
                                DataKeyNames="File_Number" EmptyDataText="There are no results">
                                <Columns>
                                    <asp:TemplateField>
                                        <HeaderStyle Width="5" />
                                        <HeaderTemplate>
                                            <asp:CheckBox ID="chkAll" runat="server" onclick="CheckAll(this)" />
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            &nbsp &nbsp
                                    <asp:CheckBox ID="chkRow" runat="server" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="File_Number" HeaderText="File Name" />
                                    <asp:BoundField DataField="File Name" HeaderText="File Name" />
                                    <asp:BoundField DataField="Settlement Cycle" HeaderText="Settlement Cycle" />
                                    <asp:BoundField DataField="Setttlement Amount" HeaderText="Settlement Amount" />
                                    <%--  <asp:BoundField DataField="Settlement Currency Code" HeaderText=" Settlement Currency Code" />--%>
                                    <asp:BoundField DataField="Setttlement Result" HeaderText="Status" />
                                </Columns>
                            </asp:GridView>
                        </div>
                        <div class="row" style="margin-left: 1%; margin-top: 1%; margin-bottom: 1%">
                            <asp:Button ID="ProcessMcAcqSettlementCycle" runat="server" Text="Process" CssClass="btn btn-primary btn-l" OnClick="bttn_ProcessdMcAcqSettlementCycle" OnClientClick="return SaveConfirmation('Are you sure to process')" />
                        </div>
                    </div>

                    <!-- /.card-body -->
                </div>
            </asp:Panel>

            <asp:Panel ID="pnlUploadFees" runat="server" Visible="false">
                <div class="card card-info color-palette-box">
                    <div class="card-header">
                        <h3 class="card-title">
                            <i class="fas fa-tag"></i>
                            <b>pload Swift Fees File</b>
                        </h3>

                        <div class="card-tools">
                            <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                <i class="fas fa-minus"></i>
                            </button>
                        </div>
                    </div>
                    <div class="card-body ">
                        <table border="0" width="60%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                            <tr>
                                <td class="tdNormal" style="width: 15%">Choose File
                                </td>
                                <td colspan="3" style="width: 50%">
                                    <asp:FileUpload ID="FileUpload1" runat="server" class="fieldWithBtn" />
                                </td>
                                <td class="tdNormal" style="width: 3%"></td>
                                <td class="tdNormal">
                                    <asp:Button ID="btnUpload" runat="server" Text="Upload" class="btn btn-primary btn-l"
                                        OnClick="btnUpload_Click" />
                                    <asp:Button ID="btnUpload1" runat="server" Text="Process File" class="btn btn-primary btn-l"
                                        OnClick="btnUpload1_Click" />
                                </td>
                            </tr>

                            <caption>
                                &nbsp;</caption>

                        </table>
                        <table border="0" width="100%" cellpadding="0" cellspacing="0" class="btn btn-primary btn-l">
                            <tr>
                                <td class="tdNormal" style="width: 73%">
                                    <asp:Button ID="Button4" runat="server" Text="Process" CssClass="btn btn-primary btn-l"
                                        OnClick="bttn_ProcessdMcAcqSettlementCycle"
                                        OnClientClick="return SaveConfirmation('Are you sure to process')"
                                        Visible="False" />
                                </td>
                                <td class="tdNormal" style="width: 10%"></td>

                            </tr>
                        </table>
                    </div>
                </div>
            </asp:Panel>
                <br />
            <asp:Panel ID="pnlResult" runat="server" Visible="false">
                <div class="card card-info color-palette-box">
                    <div class="card-header">
                        <h3 class="card-title">
                            <i class="fas fa-tag"></i>
                            <b>Settlements</b>
                        </h3>

                        <div class="card-tools">
                            <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                <i class="fas fa-minus"></i>
                            </button>
                        </div>
                    </div>
                    <div class="card-body">
                        <div style="width: 100%; display: inline-block; vertical-align: top; overflow-x: auto;">
                            <asp:GridView ID="GridView1" CssClass="table table-striped table-bordered table-sm" runat="server" AutoGenerateColumns="False"
                                DataKeyNames="csr_code" AllowPaging="false" OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound"
                                OnRowCreated="GridView1_RowCreated" ShowFooter="true" EmptyDataText="There are no Results">
                                <Columns>
                                    <asp:BoundField DataField="Event_Name" HeaderText="Account&nbsp;Name" />
                                    <asp:BoundField DataField="From_Account" HeaderText="Dr&nbsp;Account" />
                                    <asp:BoundField DataField="To_Account" HeaderText="Cr&nbsp;Account" />
                                    <asp:BoundField DataField="Narrative" HeaderText="Narrative" />
                                    <asp:BoundField DataField="Cardscheme_Curr_Name" HeaderText="Currency"/>
                                    <asp:BoundField DataField="DbAmt" dataformatstring="{0:N2}" HeaderText="Dr&nbsp;Amount" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right"/>
                                    <asp:BoundField DataField="CRAmt" dataformatstring="{0:N2}" HeaderText="Cr&nbsp;Amount" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right"/>
                                    <asp:BoundField DataField="evnt_code" HeaderText="evnt_code" />
                                    <asp:BoundField DataField="file_number" HeaderText="file_number" />
                                    <asp:BoundField DataField="CS_GL_Desc" HeaderText="Status" />
                                    <asp:BoundField DataField="EDITABLE" HeaderText="EDITABLE" />
                                    <asp:TemplateField HeaderText="Actions">
                                        <ItemTemplate>
                                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                                Action
                                            </button>
                                            <div class="dropdown-menu">
                                                <a class="dropdown-item" href="#">
                                                    <asp:Button ID="View" CssClass="btn btn-outline-info btn-block btn-sm" runat="server" Text="View" CommandName="v" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" /></a>
                                                <a class="dropdown-item" href="#">
                                                    <asp:Button ID="Delete" CssClass="btn btn-outline-danger btn-block btn-sm" runat="server" Text="Delete" CommandName="d" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" /></a>
                                            </div>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                        </div>

                        <div class="row" style="margin-top: 2%">

                            <% if (GridView1.Rows.Count >= 1)
                                { %>
                            <% if (lbl_Status.Text == "000" || lbl_Status.Text == "008")
                                { %>
                            <div class="col-sm-6 float-left">
                                <div class="form-group">
                                    <asp:Button ID="bttn_AddDiff" runat="server" Text="Add Diff Entry" CssClass="btn btn-primary btn-l" OnClick="bttn_AddDiff_Click" />
                                </div>
                            </div>
                            <%}
                                } %>

                            <div class="col-sm-6" style="text-align:right">
                                <div class="form-group">
                                    <label>Difference (CR-DB)</label>
                                    <asp:Label ID="lbl_CR_DR_Diff" runat="server"></asp:Label>
                                </div>
                            </div>
                        </div>

                       <%--<table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                       <tr>
                            <td class="tdNormal" style="width: 73%"></td>
                            <td class="tdNormal" style="width: 10%">Difference(CR-DB):
                            </td>
                            <td class="tdNormal">
                                
                            </td>
                        </tr>
                         <tr>
                            <td class="tdNormal" style="width: 73%">
                             <% if (GridView1.Rows.Count >= 1)
                                { %>
                                <% if (lbl_Status.Text == "000" || lbl_Status.Text == "008")
                                   { %>
                                  
                                 <%}
                                } %>
                            </td>
                            <td class="tdNormal" style="width: 10%">
                            </td>
                            <td class="tdNormal">
                               
                            </td>
                        </tr>
                         
                    </table>
                     <br /> <br />--%>
                        <asp:Label ID="Lbl_MannualDif" runat="server" Visible="false"></asp:Label>
                        <asp:Panel ID="pnlAddMannualDiff" runat="server" Width="100%" Visible="false">
                            <div class="card card-info color-palette-box">
                                <div class="card-header">
                                    <h3 class="card-title">
                                        <i class="fas fa-tag"></i>
                                        <b>Add New Diff Entry</b>&nbsp;&nbsp;<i>(<%if (selected_RC_code == 15) //VISA show product only for visa
                                                                                     { %>  <%=ddlProducts.SelectedItem.Text%><%} %>)</i>
                                    </h3>

                                    <div class="card-tools">
                                        <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                            <i class="fas fa-minus"></i>
                                        </button>
                                    </div>
                                </div>
                                <div class="card-body ">
                                    <div class="row">
                                        <div class="col-sm-4">
                                            <label>Account Name</label>
                                            <div class="form-group">
                                                <asp:DropDownList ID="ddl_CS_EventList" class="form-control" runat="server"
                                                    DataTextField="Event_Name" DataValueField="Cs_Evnt_Code" AutoPostBack="true"
                                                    OnSelectedIndexChanged="ddl_CS_EventList_SelectedIndexChanged">
                                                </asp:DropDownList>
                                            </div>
                                        </div>
                                        <div class="col-sm-4">
                                            <label>Amount</label>
                                            <div class="form-group">
                                                <asp:TextBox ID="txtAmount" runat="server" class="form-control"></asp:TextBox>
                                            </div>
                                            <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtAmount" Type="Double"></asp:RangeValidator>
                                        </div>
                                        <div class="col-sm-4">
                                            <label>&nbsp;</label><br />
                                            <div class="form-group">
                                                <asp:DropDownList ID="ddlGLtype" runat="server" class="form-control">
                                                    <asp:ListItem Value="DB">DB</asp:ListItem>
                                                    <asp:ListItem Value="CR">CR</asp:ListItem>
                                                </asp:DropDownList>
                                            </div>
                                        </div>
                                        <div class="col-sm-3">
                                            <label>Debit Account</label>
                                            <div class="form-group">
                                                <asp:Label ID="lbl_FromAcct" runat="server"></asp:Label>
                                            </div>
                                        </div>
                                        <div class="col-sm-3">
                                            <label>Credit Account</label>
                                            <div class="form-group">
                                                <asp:Label ID="lbl_ToAcct" runat="server"></asp:Label>
                                            </div>
                                        </div>
                                        <div class="col-sm-3">
                                            <label>Narrative</label>
                                            <div class="form-group">
                                                <asp:Label ID="lbl_Narr" runat="server"></asp:Label>
                                            </div>
                                        </div>
                                        <div class="col-sm-3">
                                            <label>Settlement Currency</label>
                                            <div class="form-group">
                                                <asp:Label ID="lbl_Sett_Curr" runat="server"></asp:Label>
                                            </div>
                                        </div>
                                        <div class="col-sm-12" style="text-align: center; margin-bottom: 2%">
                                            <asp:Button ID="btnSavePost" runat="server" Text="Save" class="btn btn-primary btn-l" OnClick="btnSavePost_Click" OnClientClick="return SaveConfirmation('Ar you sure to pass mannual entry')" />&nbsp;&nbsp;
                                            <asp:Button ID="btnCancelPost" runat="server" Text="Cancel" class="btn btn-primary btn-l" CausesValidation="False" OnClick="btnCancelPost_Click" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </asp:Panel>
                        
                        <div class="card card-info color-palette-box">
                            <div class="card-header">
                                <h3 class="card-title">
                                    <i class="fas fa-tag"></i>
                                    <b>VAT</b>
                                </h3>

                                <div class="card-tools">
                                    <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                        <i class="fas fa-minus"></i>
                                    </button>
                                </div>
                            </div>
                            <div class="card-body ">
                                <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                    <tr>
                                        <td class="tdNormal" colspan="5">
                                            <div style="width: 100%; display: inline-block; vertical-align: top; overflow-x: auto;">
                                                <asp:GridView ID="GridViewVAT" CssClass="table table-striped table-bordered table-sm" runat="server" AutoGenerateColumns="False" DataKeyNames="csr_code" OnRowCommand="GridViewVAT_RowCommand"
                                                    OnRowCreated="GridViewVAT_RowCreated" EmptyDataText="There are no Results">

                                                    <Columns>
                                                        <asp:BoundField DataField="Event_Name" HeaderText="Account&nbsp;Name" />
                                                        <asp:BoundField DataField="From_Account" HeaderText="Dr&nbsp;Account" />
                                                        <asp:BoundField DataField="To_Account" HeaderText="Cr&nbsp;Account" />
                                                        <asp:BoundField DataField="Narrative" HeaderText="Narrative" />
                                                        <asp:BoundField DataField="Cardscheme_Curr_Name" HeaderText="Currency" />
                                                        <asp:BoundField DataField="DbAmt" dataformatstring="{0:N2}" HeaderText="Amount" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right"/>
                                                        <asp:BoundField DataField="CRAmt" dataformatstring="{0:N2}" HeaderText="Cr&nbsp;Amount" Visible="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right"/>
                                                        <asp:BoundField DataField="evnt_code" HeaderText="evnt_code" />
                                                        <asp:BoundField DataField="file_number" HeaderText="file_number" Visible="True" />
                                                        <asp:BoundField DataField="CS_GL_Desc" HeaderText="Status" />
                                                        <asp:BoundField DataField="EDITABLE" HeaderText="EDITABLE" />
                                                        <asp:TemplateField HeaderText="Actions">
                                                            <ItemTemplate>
                                                                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                                                    Action
                                                                </button>
                                                                <div class="dropdown-menu">
                                                                    <a class="dropdown-item" href="#">
                                                                        <asp:Button ID="View" CssClass="btn btn-outline-info btn-block btn-sm" runat="server" Text="View" CommandName="v" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" /></a>
                                                                </div>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>

                                                        <%-- <asp:ButtonField  ButtonType="Image" ItemStyle-Width="20px" CommandName="d" Text="Delete"
                                                        ImageUrl="~/Images/delete.jpg"></asp:ButtonField>--%>
                                                    </Columns>

                                                </asp:GridView>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                                <div class="row" style="margin-left: 0.5%; margin-top: 2%;">
                                    <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">

                                        <tr id="rowBttn" runat="server">
                                            <td style="text-align: left">
                                                <% if (GridView1.Rows.Count >= 1)
                                                    { %>
                                                <% if (lbl_Status.Text == "000" || lbl_Status.Text == "008")
                                                    { %>
                                                <asp:Button ID="btnReprocess" runat="server" Text="Rerocess" CssClass="btn btn-primary btn-l"
                                                    OnClick="btnReprocess_Click" OnClientClick="return SaveConfirmation('Are you sure to send all the entries for Reprocess')" />&nbsp;
                                                <asp:Button ID="bttn_Approval" runat="server" Text="Submit for Approval " CssClass="btn btn-primary btn-l"
                                                    OnClick="ButtonSubmitForApproval_Click" OnClientClick="return SaveConfirmation('Are you sure to send all the entries for approval')" />&nbsp;
                                                <%} %>
                                                <% if (lbl_Status.Text == "001")
                                                    { %>
                                                <asp:Button ID="bttn_CreateGL" runat="server" Text="Approve" CssClass="btn btn-primary btn-l"
                                                    OnClick="bttn_ApproveAndCreateGL" OnClientClick="return SaveConfirmation('Are you sure to process the GL')" />&nbsp;
                                                <asp:Button ID="bttn_Reject" runat="server" Text="Reject" CssClass="btn btn-primary btn-l"
                                                    OnClick="ButtonRejectForApproval_Click" OnClientClick="return SaveConfirmation('Are you sure to cancel all the entries')" />
                                                <%} %>
                                                <%} %>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </asp:Panel>
                <br />

                <asp:Panel ID="pnlResultFees" runat="server" Width="100%" Visible="false">
                    <fieldset id="addItem">
                        <legend id="addItem">Settlements Fees</legend>
                    </fieldset>
                    <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                        <tr>
                            <td class="tdNormal" colspan="5">
                                <div style="width: 100%; display: inline-block;vertical-align: top; overflow-x: auto;">
                                <asp:GridView ID="GridView3" CssClass="table table-striped table-bordered table-sm" Width="100%" runat="server" AutoGenerateColumns="False"
                                    DataKeyNames="Cst_Code" AllowPaging="False" AllowSorting="True" ShowFooter="true"
                                    CellPadding="4" ForeColor="#333333" GridLines="None" 
                                     EmptyDataText="There are no Results" onrowcommand="GridView3_RowCommand" 
                                    OnRowCreated="GridView3_RowCreated" >
                                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Right" />
                                    <Columns>
                                        <asp:BoundField DataField="Event_Name" HeaderText="Account&nbsp;Name" />
                                        <asp:BoundField DataField="From_Account" HeaderText="Dr&nbsp;Account" />
                                        <asp:BoundField DataField="To_Account" HeaderText="Cr&nbsp;Account" />
                                        <asp:BoundField DataField="Amount" dataformatstring="{0:N2}" HeaderText="Amount" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right"/>
                                        <asp:BoundField DataField="AMOUNT_SIGN" dataformatstring="{0:N2}" HeaderText="Db/Cr" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right"/>
                                        <asp:BoundField DataField="Narrative" HeaderText="Narrative" />
                                        <asp:BoundField DataField="file_number" HeaderText="file_number" Visible="True" />
                                        <asp:BoundField DataField="CS_GL_Desc" HeaderText="Status" />
                                        <asp:ButtonField ButtonType="Image" ItemStyle-Width="20px" CommandName="d" Text="Delete"
                                            ImageUrl="~/Images/delete.jpg"></asp:ButtonField>
                                    </Columns>
                                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="Black" />
                                    <EditRowStyle BackColor="#999999" />
                                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" HorizontalAlign="Right" />
                                </asp:GridView>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="tdNormal" style="width: 73%">
                             <% if (GridView3.Rows.Count >= 1)
                                { %>
                                <% if (lbl_Status.Text == "000" || lbl_Status.Text == "008")
                                   { %>
                                  <asp:Button ID="Button7" runat="server" Text="Add Manual Entry" 
                                    CssClass="btn btn-primary btn-l" onclick="Button7_Click"
                                     />
                                     <asp:Button ID="Button8" runat="server" Text="Submit for Approval " CssClass="btn btn-primary btn-l"
                                     Width="120px" 
                                    OnClientClick="return SaveConfirmation('Are you sure to send all the entries for approval')" 
                                    onclick="Button8_Click" />
                                 <%} %>
                                 <% if (lbl_Status.Text == "001")
                                    { %>
                                <asp:Button ID="Button9" runat="server" Text="Approve" CssClass="btn btn-primary btn-l"
                                     OnClientClick="return SaveConfirmation('Are you sure to process the GL')" 
                                    onclick="Button9_Click" />
                                <asp:Button ID="Button10" runat="server" Text="Reject" CssClass="btn btn-primary btn-l"
                                      
                                    OnClientClick="return SaveConfirmation('Are you sure to cancel all the entries')" 
                                    onclick="Button10_Click" />
                                <%} %>
                                <%} %>
                            </td>
                            <td class="tdNormal" style="width: 10%">
                            </td>
                            <td class="tdNormal">
                               
                            </td>
                        </tr>
                        <caption>
                            &nbsp;</caption>
                    </table>
                </asp:Panel>


            <!-- pnlAddFee -->
            <asp:Panel ID="pnlAddFee" runat="server" Width="100%" Visible="false">
                <div class="card card-info color-palette-box">
                    <div class="card-header">
                        <h3 class="card-title">
                            <i class="fas fa-tag"></i>
                            <b>Add New Diff Entry</b>
                        </h3>

                        <div class="card-tools">
                            <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                <i class="fas fa-minus"></i>
                            </button>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="col-sm-4">
                            <label>Account Name</label>
                            <div class="form-group">
                                <asp:DropDownList ID="ddlAccountFee" class="form-control" runat="server"
                                    DataTextField="Event_Name" DataValueField="Cs_Evnt_Code"
                                    AutoPostBack="true" OnSelectedIndexChanged="ddlAccountFee_SelectedIndexChanged">
                                </asp:DropDownList>
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <label>Amount</label>
                            <div class="form-group">
                                <asp:TextBox ID="txtAmountFee" runat="server" class="form-control"></asp:TextBox>
                            </div>
                            <asp:RangeValidator ID="RangeValidator2" runat="server" ControlToValidate="txtAmountFee" Type="Double"></asp:RangeValidator>
                        </div>
                        <div class="col-sm-4">
                            <label>&nbsp;</label><br />
                            <div class="form-group">
                                <asp:DropDownList ID="DropDownList2" runat="server">
                                    <asp:ListItem Value="DB">DB</asp:ListItem>
                                    <asp:ListItem Value="CR">CR</asp:ListItem>
                                </asp:DropDownList>
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <label>Reference Number</label>
                            <div class="form-group">
                                <asp:TextBox ID="txtRefNum" runat="server" class="form-control"></asp:TextBox>
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <label>Debit Account</label>
                            <div class="form-group">
                                <asp:Label ID="lblDBAccountFee" runat="server" class="form-control"></asp:Label>
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <label>Credit Account</label>
                            <div class="form-group">
                                <asp:Label ID="lblCRAccountFee" runat="server" class="form-control"></asp:Label>
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <label>Narrative</label>
                            <div class="form-group">
                                <asp:Label ID="lblNarFee" runat="server" class="form-control"></asp:Label>
                            </div>
                        </div>
                        <div class="col-sm-4">
                            <label>Settlement Currency</label>
                            <div class="form-group">
                                <asp:Label ID="lblSettleCurFee" runat="server" class="form-control"></asp:Label>
                            </div>
                        </div>
                        <div class="col-sm-12" style="text-align: center; margin-bottom: 2%">
                            <asp:Button ID="Button6" runat="server" Text="Save" class="btn btn-primary btn-l" OnClick="Button6_Click" OnClientClick="return SaveConfirmation('Ar you sure to pass mannual entry')" />&nbsp;&nbsp;
                            <asp:Button ID="Button5" runat="server" Text="Cancel" class="btn btn-primary btn-l" CausesValidation="False" OnClick="Button5_Click" />
                        </div>
                    </div>
                    <!-- /.card-body -->
                </div>
            </asp:Panel>

            <asp:Panel ID="pnlBR" runat="server" Visible="true">
                <div class="row">
                    <div class="modal fade" id="modal-xl">
                        <div class="modal-dialog modal-xl" style="max-width: max-content;">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h4 class="modal-title">Settlement Details :</h4>
                                    <asp:Label ID="lbl_Detail" runat="server" Visible="false"></asp:Label>
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                        <span aria-hidden="true">&times;</span>
                                    </button>
                                </div>
                                <div class="modal-body">
                                    <div class="card-body">
                                        <asp:GridView ID="GridView2" class="table table-striped table-bordered table-sm" runat="server" AutoGenerateColumns="False"
                                            DataKeyNames="Sre_ID" OnRowCommand="GridView1_RowCommand" EmptyDataText="There are no Results">
                                            <Columns>
                                                <asp:BoundField DataField="Sre_ID" HeaderText="SRE&nbsp;ID" />
                                                <asp:BoundField DataField="Settl_Date" HeaderText="Settlement&nbsp;Date" />
                                                <asp:BoundField DataField="clrng_Amt" HeaderText="Clearing&nbsp;Amount" />
                                                <asp:BoundField DataField="Settl_Amt" HeaderText="Settlement&nbsp;Amount" />
                                            </Columns>
                                        </asp:GridView>
                                        <div class="row" style="margin-left: 1%; margin-top: 2%;">
                                            Go To Page&nbsp;: &nbsp;
                                <asp:DropDownList ID="ddlPages2" runat="server" class="form-control select2"
                                    AutoPostBack="True" Width="9%" Height="6%" OnSelectedIndexChanged="ddlPages2_SelectedIndexChanged">
                                </asp:DropDownList>
                                        </div>
                                    </div>
                                    <!-- /.card-body -->

                                </div>
                                <div class="modal-footer justify-content-between">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                </div>
                            </div>
                            <!-- /.modal-content -->
                        </div>
                        <!-- /.modal-dialog -->

                    </div>

                    <!-- /.modal -->
                </div>
            </asp:Panel>
        
	</div><!-- /.container-fluid -->
	</section>
        <!-- /.content -->
    </div>
    <!-- Toastr -->
    <!-- jQuery -->
    <script src="../plugins/jquery/jquery.min.js"></script>
    <!-- Bootstrap 4 -->
    <script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
    <!-- SweetAlert2 -->
    <script src="../plugins/sweetalert2/sweetalert2.min.js"></script>
    <!-- Toastr -->
    <script src="../plugins/toastr/toastr.min.js"></script>
    <!-- AdminLTE App -->
    <script src=".../dist/js/adminlte.min.js"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="../plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
    <script src="../plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="../plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
    <script src="../plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
    <script src="../plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
    <script src="../plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
    <script src="../plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
    <script src="../plugins/jszip/jszip.min.js"></script>
    <script src="../plugins/pdfmake/pdfmake.min.js"></script>
    <script src="../plugins/pdfmake/vfs_fonts.js"></script>
    <script src="../plugins/datatables-buttons/js/buttons.html5.min.js"></script>
    <script src="../plugins/datatables-buttons/js/buttons.print.min.js"></script>
    <script src="../plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
    <script src="../plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
    <!-- AdminLTE App -->
    <script src="../dist/js/adminlte.min.js"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="../dist/js/demo.js"></script>
    <script src="../plugins/select2/js/select2.full.min.js"></script>
    <!-- Bootstrap4 Duallistbox -->
    <script src="../plugins/bootstrap4-duallistbox/jquery.bootstrap-duallistbox.min.js"></script>
    <!-- InputMask -->
    <script src="../plugins/moment/moment.min.js"></script>
    <script src="../plugins/inputmask/jquery.inputmask.min.js"></script>
    <!-- date-range-picker -->
    <script src="../plugins/daterangepicker/daterangepicker.js"></script>
    <!-- bootstrap color picker -->
    <script src="../plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js"></script>
    <!-- Tempusdominus Bootstrap 4 -->
    <script src="../plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
    <!-- Bootstrap Switch -->
    <script src="../plugins/bootstrap-switch/js/bootstrap-switch.min.js"></script>
    <!-- BS-Stepper -->
    <script src="../plugins/bs-stepper/js/bs-stepper.min.js"></script>
    <!-- dropzonejs -->
    <script src="../plugins/dropzone/min/dropzone.min.js"></script>
    <!-- AdminLTE App -->
    <script>

        $(function () {

            $('#ContentPlaceHolder1_GridView1').DataTable({
                "responsive": true, "lengthChange": false, "autoWidth": false,
                "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
            }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');

            //Date picker
            //$('#ContentPlaceHolder1_TextBox1').daterangepicker()

            $('#sdate').datetimepicker({
                //format: 'L'
                format: 'DD-MM-YYYY'
            });

            //$('#reservationdatetime').datetimepicker({ icons: { time: 'far fa-clock'} });
            //        $('#ContentPlaceHolder1_GridView1').DataTable({
            //            "responsive": true, "lengthChange": false, "autoWidth": false,
            //            "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
            //        }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');

            //        $('#ContentPlaceHolder1_gvChannel').DataTable({
            //            "responsive": true, "lengthChange": false, "autoWidth": false,
            //            "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
            //        }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');

            //        $('#ContentPlaceHolder1_gvEJ').DataTable({
            //            "responsive": true, "lengthChange": false, "autoWidth": false,
            //            "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"]
            //        }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');

            $('#<%= ddlPages2.ClientID %>').change(function () {
                $("#cover-spin").show();
            });
                
        });
    </script>
</asp:Content>
