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

<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">

    <style type="text/css">
        .header-center {
            text-align: center;
        }
    </style>
</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>MADA Daily Settlement</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">Settlements</li>
			  <li class="breadcrumb-item active">MADA Daily Settlement</li>
			</ol>
		  </div>
		</div>
	  </div><!-- /.container-fluid -->
	</section>
		<!-- /.content-header -->
		<!-- Main content -->
	<section class="content">
	    <div class="container-fluid">
        <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">
                    <div class="col-sm-3">
                        <div class="form-group">
                            <label>Settlement 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 class="col-sm-3">
                        <div class="form-group">
                            <asp:Label ID="lbl_File_Number" runat="server" class="fieldNormal" Text="" Visible="false"></asp:Label>
                            <asp:Label ID="lbl_Status" runat="server" class="fieldNormal" Text="" Visible="false"></asp:Label>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-12" style="margin-bottom: 1%">
                        <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" OnClientClick="$('#cover-spin').show();" CssClass="btn btn-primary btn-l" />&nbsp;&nbsp;
                        <asp:Button ID="btnGenReport" runat="server" Text="Summary Report" CssClass="btn btn-primary btn-l" OnClientClick="$('#cover-spin').show();" OnClick="btnGenReport_Click" />
                        <asp:Button ID="Button1" runat="server" Text="Claim Report" CssClass="btn btn-primary btn-l" OnClientClick="$('#cover-spin').show();" OnClick="btnClaimReport_Click" Visible="False" />
                    </div>
                </div>
              </div>
              <!-- /.card-body -->
            </div>
		   
            <asp:Panel ID="pnl_result" runat="server">
                <div class="card card-info color-palette-box">
                    <div class="card-header">
                        <h3 class="card-title">
                            <i class="fas fa-tag"></i>
                            <b>MADA Settlement</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 dir="ltr" border="0" cellpadding="0" cellspacing="0" class="table table-striped table-bordered table-sm" style="width: 100%">
                            <thead>
                                <tr>
                                    <td valign="middle" align="center" style="font-weight: bold">MADA ATM - POS - ECOM  Recon. Summary</td>
                                    <td valign="middle" align="center" style="font-weight: bold">ECOM Debit</td>
                                    <td valign="middle" align="center" style="font-weight: bold">ECOM Credit</td>
                                    <td valign="middle" align="center" style="font-weight: bold">POS Debit</td>
                                    <td valign="middle" align="center" style="font-weight: bold">POS Credit</td>
                                    <td valign="middle" align="center" style="font-weight: bold">ATM Debit</td>
                                    <td valign="middle" align="center" style="font-weight: bold">ATM Credit</td>
                                    <td valign="middle" align="center" style="font-weight: bold">NET Total</td>
                                </tr>
                            </thead>
                            <tr>
                                <td valign="middle" align="left">MADA (A2FTRPT1 Report - A
                                </td>
                                <td align="right" valign="middle">
                                    <asp:Label ID="lbl_debitECOM_BankAmount" runat="server"></asp:Label>
                                </td>
                                <td align="right" valign="middle">
                                    <asp:Label ID="lbl_creditECOM_BankAmount" runat="server"></asp:Label>
                                </td>
                                <td align="right" valign="middle">
                                    <asp:Label ID="lbl_debitPOS_BankAmount" runat="server"></asp:Label>
                                </td>
                                <td align="right" valign="middle">
                                    <asp:Label ID="lbl_creditPOS_BankAmount" runat="server"></asp:Label>
                                </td>
                                <td align="right" valign="middle">
                                    <asp:Label ID="lbl_debitATM_BankAmount" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_creditATM_BankAmount" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_BankTotal" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="left" valign="middle">SAIB (Switch Settlement Report) - B
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_debitECOM_SamaAmount" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_creditECOM_SamaAmount" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_debitPOS_SamaAmount" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_creditPOS_SamaAmount" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_debitATM_SamaAmount" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_creditATM_SamaAmount" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_SpanTotal" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td valign="middle" align="left">Differences ( A - B )
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_debitECOM_diff" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_creditECOM_diff" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_debitPOS_diff" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_creditPOS_diff" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_debitATM_diff" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_creditATM_diff" runat="server" oncopy="event.KeyCode=0;"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_NetDiffTotal" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr style="display: none;">
                                <td align="left" valign="middle">Issuer (Reversal Difference)
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_debitPos_Rvslamt" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_CreditPos_Rvslamt" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_debitATM_Rvslamt" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_creditATM_Rvslamt" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr style="display: none;">
                                <td align="left" valign="middle">UnMatched (Txn in Switch Not in MADA)
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_DebitPos_Unmtch" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_CreditPos_Unmtch" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_DebitATM_Unmtch" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="right">
                                    <asp:Label ID="lbl_CreditATM_Unmtch" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tfoot style="display: none;">
                                <tr style="display: none;">
                                    <td valign="middle" align="left" style="width: 15%">Overall Differences
                                    </td>
                                    <td valign="middle" align="center" style="width: 15%">
                                        <asp:Label ID="lbl_debitPOS_difference" runat="server"></asp:Label>
                                    </td>
                                    <td valign="middle" align="center" style="width: 15%">
                                        <asp:Label ID="lbl_creditPOS_difference" runat="server"></asp:Label>
                                    </td>
                                    <td valign="middle" align="center" style="width: 15%">
                                        <asp:Label ID="lbl_debitATM_difference" runat="server"></asp:Label>
                                    </td>
                                    <td valign="middle" align="center" style="width: 15%">
                                        <asp:Label ID="lbl_creditATM_difference" runat="server" oncopy="event.KeyCode=0;"></asp:Label>
                                    </td>
                                </tr>
                                <%--<caption>
                                </caption>--%>
                            </tfoot>
                        </table>
                        <asp:Button ID="btn_print" runat="server" Text="Print" class="btn btn-primary btn-l" OnClick="btn_print_Click" />
                    </div>
                    <!-- /.card-body -->
                </div>
            </asp:Panel>
					
            <div id="tlfFilesArea" class="card card-info color-palette-box" runat="server">
                <div class="card-header">
                    <h3 class="card-title">
                        <i class="fas fa-tag"></i>
                        <b>TLF Files Total</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 dir="ltr" border="0" cellpadding="0" cellspacing="0" class="table table-striped table-bordered table-sm" style="width: 100%">
                        <thead>
                            <tr>
                                <td valign="middle" align="center" style="font-weight: bold">MADA TLF Files Total</td>
                                <td valign="middle" align="center" style="font-weight: bold">ECOM Debit</td>
                                <td valign="middle" align="center" style="font-weight: bold">ECOM Credit</td>
                                <td valign="middle" align="center" style="font-weight: bold">POS Debit</td>
                                <td valign="middle" align="center" style="font-weight: bold">POS Credit</td>
                                <td valign="middle" align="center" style="font-weight: bold">ATM Debit</td>
                                <td valign="middle" align="center" style="font-weight: bold">ATM Credit</td>
                                <td valign="middle" align="center" style="font-weight: bold">NET Total</td>
                            </tr>
                        </thead>
                        <tr>
                            <td valign="middle" align="center" class="style29">Total</td>
                            <td valign="middle" align="right">
                                <asp:Label ID="LabelTLF06" runat="server" class="fieldNormal"></asp:Label>
                            </td>
                            <td valign="middle" align="right">
                                <asp:Label ID="LabelTLF05" runat="server" class="fieldNormal"></asp:Label>
                            </td>
                            <td valign="middle" align="right">
                                <asp:Label ID="LabelTLF04" runat="server" class="fieldNormal"></asp:Label>
                            </td>
                            <td valign="middle" align="right">
                                <asp:Label ID="LabelTLF03" runat="server" class="fieldNormal"></asp:Label>
                            </td>
                            <td valign="middle" align="right">
                                <asp:Label ID="LabelTLF02" runat="server" class="fieldNormal"></asp:Label>
                            </td>
                            <td valign="middle" align="right">
                                <asp:Label ID="LabelTLF01" runat="server" class="fieldNormal" oncopy="event.KeyCode=0;"></asp:Label>
                            </td>
                            <td valign="middle" align="right">
                                <asp:Label ID="LabelTLFTotal" runat="server" class="fieldNormal" oncopy="event.KeyCode=0;"></asp:Label>
                            </td>
                        </tr>
                    </table>
                </div>
                <!-- /.card-body -->
            </div>
			
			<!-- /.modal -->
            <asp:Panel ID="pnlResult_TicketEntry" runat="server" Visible="false">
                <!-- Default box -->
                <div class="card card-info color-palette-box">
                    <div class="card-header">
                        <h3 class="card-title">
                            <i class="fas fa-tag"></i>
                            <b>MADA Ticket 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">
                        <asp:GridView ID="GridView1" class="table table-striped table-bordered table-sm" runat="server" AutoGenerateColumns="False" 
                            OnRowCreated="GridView1_RowCreated" DataKeyNames="Event_Name" EmptyDataText="There are no results">
                            <Columns>
                                <asp:BoundField DataField="Event_Name" HeaderText="Account&nbsp;Name" HeaderStyle-CssClass="header-center" />
                                <asp:BoundField DataField="From_Account" HeaderText="Debit&nbsp;Account" HeaderStyle-CssClass="header-center" />
                                <asp:BoundField DataField="To_Account" HeaderText="Credit&nbsp;Account" HeaderStyle-CssClass="header-center" />
                                <asp:BoundField DataField="DbAmt" HeaderText="Debit" DataFormatString="{0:n}" HeaderStyle-CssClass="header-center" ItemStyle-HorizontalAlign="Right" />
                                <asp:BoundField DataField="CRAmt" HeaderText="Credit" DataFormatString="{0:n}" HeaderStyle-CssClass="header-center" ItemStyle-HorizontalAlign="Right" />
                                <asp:BoundField DataField="Narrative" HeaderText="Narratives" HeaderStyle-CssClass="header-center" />
                                <asp:BoundField DataField="CS_GL_Desc" HeaderText="Status" HeaderStyle-CssClass="header-center" />
                                <asp:BoundField DataField="CS_GL_Code" HeaderText="" HeaderStyle-CssClass="header-center" />
                                <asp:BoundField DataField="file_number" HeaderText="File&nbsp;Number" Visible="True" HeaderStyle-CssClass="header-center" />
                            </Columns>
                        </asp:GridView>
                        <div class="row" style="margin-left:1%; margin-top: 2%; margin-right: 1%">
                            <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                <tr>
                                    <td style="text-align:left">
                                        <% if (GridView1.Rows.Count >= 1)
                                            { %>
                                        <% if (lbl_Status.Text == "000" || lbl_Status.Text == "008")
                                            { %>
                                        <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')" />
                                        <%} %>
                                        <% 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')" />
                                        <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')" />
                                        <%} %>
                                        <%} %>
                                        <%--<asp:Button ID="bttn_GenerateGL0" runat="server" Text="Generate GL" CssClass="btn btn-primary btn-l"
                                            OnClick="ButtonGenerateGL_Click" OnClientClick="return SaveConfirmation('Are you sure to send all the entries for approval')" />--%>
                                    </td>
                                    <td style="text-align:right">
                                        <b>Difference(CR-DB) &nbsp; : &nbsp;</b><asp:Label ID="lbl_CR_DR_Diff" runat="server"></asp:Label>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <asp:Label ID="Lbl_MannualDif" runat="server" Text="" class="fieldError"></asp:Label>
                    <!-- /.card-body -->
                </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)');
		});
    </script>
</asp:Content>
