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

<%@ Register Src="../UserControls/DatePicker.ascx" TagName="DatePicker" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script language="javascript" type="text/javascript">
        function noCopyMouse(e) {
            var isRight = (e.button) ? (e.button == 2) : (e.which == 3);
            if (isRight) {
                alert("Not Allowed to copy");
                return false;
            }
            return true;
        }

        function noCopyKey(e) {
            var forbiddenKeys = new Array('c', 'x', 'v');
            var keyCode = (e.keyCode) ? e.keyCode : e.which;
            var isCtrl;

            if (window.event)
                isCtrl = e.ctrlKey;
            else
                isCtrl = (window.Event) ? ((e.modifiers & Event.CTRL_MASK) == Event.CTRL_MASK) : false;

            if (isCtrl) {
                for (i = 0; i < forbiddenKeys.length; i++) {
                    if (forbiddenkeys[i] == String.fromCharCode(keyCode).toLowerCase()) {
                        alert("Not Allowed to Copy");
                        return false;
                    }
                }
            }
            return true;
        }

        function validateDate() {
            var message = "";
            if (document.getElementById("<%=dtp_filter_sttlDate.TextBoxClientID%>").value == "") {
                message += "You have to at enter the transaction date\n";
            }
            if (message.length > 0) {
                message = "please notice the following requirments:\n\n" + message;
                alert(message);
                return false;
            }
            return true;
        }

        function UserConfirmation() {
            var userSelection;

            userSelection = confirm("Are you sure you want to Process ?");

            if (userSelection) {
                return true;
            } else {
                return false;
            }
        }
    </script>
    <style type="text/css">
        .style2
        {
            width: 15%;
            height: 20px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table class="body_MainTB" border="0" cellpadding="0" cellspacing="0">
        <tr align="center">
            <td valign="top">
                <!------------------------------------body St  ---------------------------------------------->
                <table border="0" cellpadding="0" cellspacing="0" class="body_formTitle">
                    <tr>
                        <td>
                            Discovery Daily Settlement
                        </td>
                    </tr>
                </table>
                <br />
                <!------------------------------------body End1 ----------------------------------------------->
                <asp:Label ID="lbl_error" runat="server" Text="" class="fieldError"></asp:Label>
                <asp:Panel ID="pnl_searchCriteria" runat="server" Width="100%">
                    <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>
                    <table border="0" cellpadding="0" cellspacing="0" class="add_ItemTB1" style="width: 100%">
                        <tr>
                            <td class="tdNormal" style="width: 15%">
                                Settlement Date:
                            </td>
                            <td class="tdNormal" style="width: 20%">
                                <uc1:DatePicker ID="dtp_filter_sttlDate" runat="server" />
                            </td>
                            <td class="tdNormal" style="width: 20%">
                                <asp:RadioButton ID="rdATM" runat="server" class="fieldNormal" Checked="True" GroupName="group" Text="ATM" />&nbsp;&nbsp;
                                <asp:RadioButton ID="rdPOS" runat="server" class="fieldNormal" Checked="False" GroupName="group" Text="POS" />
                            </td>
                            <td class="tdNormal" style="width: 15%">
                                <asp:Label ID="Lbl_FileName" runat="server" Visible="false"></asp:Label>
                            </td>
                            <td class="tdNormal" style="width: 30%">
                                <asp:FileUpload ID="FileUpload1" runat="server" CssClass="form-control" ClientIDMode="Static" Visible="false" />
                            </td>
                        </tr>
                        <tr>
                            <td class="tdNormal" style="width: 15%">
                            </td>
                            <td class="tdNormal" style="width: 30%">
                                <asp:Button ID="btn_search" runat="server" Text="   Search   " class="Btn_M_Normal"
                                    OnClientClick="return validateDate()" OnClick="btnSearch_Click" />
                                <asp:Button ID="btnGenReport" runat="server" Text="Summary Report" CssClass="Btn_L_Normal1"
                                    OnClientClick="" OnClick="btnGenReport_Click" Width="128px" />
                                <asp:Button ID="btnCReport" runat="server" Text="Claim Report" CssClass="Btn_L_Normal1"
                                    OnClientClick="" OnClick="btnClaimReport_Click" Width="128px" Visible=false />
                            </td>
                            <td class="tdNormal" style="width: 10%">
                            </td>
                            <td class="tdNormal" style="width: 15%">
                            </td>
                            <td class="tdNormal" style="width: 30%">
                                <asp:Button ID="btnUpload" runat="server" Text="Load File" class="Btn_L_Normal1" OnClick="btnUpload_Click" Visible="false" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>

                <asp:Panel ID="pnl_result" runat="server" Width="100%">
                    <table dir="ltr" width="100%" border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                <table border="0" cellpadding="0" cellspacing="0" class="grid_TitleBG_B">
                                    <tr>
                                        <td>
                                            Discovery Settlement
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                    <table dir="ltr" border="0" cellpadding="0" cellspacing="0" class="add_ItemTB1" style="width: 100%">
                            <thead>
                                <tr>
                                    <td valign="middle" align="middle" style="width: 15%; font-weight: bold">DGN ATM - POS  Settlement Summary
                                    </td>
                                    <td valign="middle" align="center" style="width: 15%; font-weight: bold">Debit
                                    </td>
                                    <td valign="middle" align="center" style="width: 15%; font-weight: bold">Credit
                                    </td>
                                    <td valign="middle" align="center" style="width: 15%; font-weight: bold">NET Total
                                    </td>
                                </tr>
                            </thead>
                            <tr>
                                <td valign="middle" align="middle" style="width: 15%">DGN PDF Report - A
                                </td>
                                <td valign="middle" align="center" style="width: 15%">
                                    <asp:Label ID="lblgccpdfdebit" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="center" style="width: 15%">
                                    <asp:Label ID="lblgccpdfcredit" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="center" style="width: 15%">
                                    <asp:Label ID="lblgccpdftotal" runat="server"></asp:Label>
                                </td>

                                <%--<div><button id="myBtn" type="button" style="background:url(../Images/document_view.jpg) no-repeat 5px center; padding:20px 5px 5px 27px; border:0px;"></button></div>--%>
                            </tr>
                            <tr>
                                <td align="middle" valign="middle" class="style2">Switch Settlement Report - B
                                </td>
                                <td valign="middle" align="center" style="width: 15%">
                                    <asp:Label ID="lblgccbankdebit" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="center" style="width: 15%">
                                    <asp:Label ID="lblgccbankcredit" runat="server"></asp:Label>
                                </td>
                                <td valign="middle" align="center" style="width: 15%">
                                    <asp:Label ID="lblgccbanktotal" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td valign="middle" align="middle" style="width: 15%">Differences ( A - B )
                                </td>
                                <td valign="middle" align="center" style="width: 15%">
                                    <asp:Label ID="lbldebitdiff" runat="server" class=""></asp:Label>
                                </td>
                                <td valign="middle" align="center" style="width: 15%">
                                    <asp:Label ID="lblcreditdiff" runat="server" class=""></asp:Label>
                                </td>

                                <td valign="middle" align="center" style="width: 15%">
                                    <asp:Label ID="lblnetdiff" runat="server" class=""></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="left" valign="middle" class="style2"></td>
                            </tr>
                            <tr style="display: none;">
                                <td align="middle" valign="middle" class="style2">Issuer (Reversal Difference)
                                </td>
                                <td valign="middle" align="center" style="width: 15%">
                                    <asp:Label ID="lbl_debitPos_Rvslamt" runat="server" class="fieldNormal"></asp:Label>
                                    <asp:ImageButton ID="imagebutton7" runat="server" AlternateText="View breakdown" ImageUrl="~/Images/document_view.jpg" />
                                </td>
                                <td valign="middle" align="center" style="width: 15%">
                                    <asp:Label ID="lbl_CreditPos_Rvslamt" runat="server" class="fieldNormal"></asp:Label>
                                    <asp:ImageButton ID="imagebutton8" runat="server" AlternateText="View breakdown" ImageUrl="~/Images/document_view.jpg" />
                                </td>

                                <td></td>
                            </tr>
                            <tr style="display: none;">
                                <td align="middle" valign="middle" class="style2">UnMatched (Txn in Switch Not in MADA)
                                </td>
                                <td valign="middle" align="center" style="width: 15%">
                                    <asp:Label ID="lbl_DebitPos_Unmtch" runat="server" class=""></asp:Label>
                                    <asp:ImageButton ID="imagebutton9" runat="server" AlternateText="View breakdown" ImageUrl="~/Images/document_view.jpg" />
                                </td>
                                <td valign="middle" align="center" style="width: 15%">
                                    <asp:Label ID="lbl_CreditPos_Unmtch" runat="server" class=""></asp:Label>
                                    <asp:ImageButton ID="imagebutton10" runat="server" AlternateText="View breakdown" ImageUrl="~/Images/document_view.jpg" />
                                </td>
                                <td></td>
                            </tr>
                            <tfoot>
                                <tr style="display: none;">
                                    <td valign="middle" align="middle" style="width: 15%">Overall Differences
                                    </td>
                                    <td valign="middle" align="center" style="width: 15%">
                                        <asp:Label ID="lbl_debitPOS_difference" runat="server" class=""></asp:Label>
                                        <asp:ImageButton ID="imagebutton11" runat="server" AlternateText="View breakdown" ImageUrl="~/Images/document_view.jpg" />
                                    </td>
                                    <td valign="middle" align="center" style="width: 15%">
                                        <asp:Label ID="lbl_creditPOS_difference" runat="server" class=""></asp:Label>
                                        <asp:ImageButton ID="imagebutton12" runat="server" AlternateText="View breakdown" ImageUrl="~/Images/document_view.jpg" />
                                    </td>
                                    <td></td>

                                </tr>
                            </tfoot>
                        </table>
                        <asp:Button ID="btn_print" runat="server" Text="  Print  " class="btn btn-primary btn-l" OnClick="btn_print_Click" />
                </asp:Panel>
            </td>
        </tr>
        
        <asp:Panel ID="tlfFilesArea" runat="server" Width="100%">
        <tr>
            <td>
                <table  dir="ltr" border="0" cellpadding="0" cellspacing="0" class="add_ItemTB1" style="width: 100%">
                    <thead>
                        <tr>
                            <td valign="middle" align="middle" style="width: 15%; font-weight: bold">
                                DGN Tlf Files Total
                            </td>
                              <td valign="middle" align="middle" style="width: 15%; font-weight: bold">
                                 Debit
                            </td>
                            <td valign="middle" align="middle" style="width: 15%; font-weight: bold">
                                 Credit
                            </td>
                           
                            <td valign="middle" align="middle" style="width: 15%; font-weight: bold">
                                NET Total
                            </td>
                        </tr>
                    </thead>


                    <tr>
                        <td valign="middle" align="middle" style="width: 15%">
                            Total</td>
                              <td valign="middle" align="center" style="width: 15%">
                            <asp:Label ID="LabelTLF06" runat="server" class=""></asp:Label>
                        </td>
                        <td valign="middle" align="center" style="width: 15%">
                            <asp:Label ID="LabelTLF05" runat="server" class=""></asp:Label>
                        </td>
                       
                        <td valign="middle" align="center" style="width: 15%">
                            <asp:Label ID="LabelTLFTotal" runat="server" class="" oncopy="event.KeyCode=0;"></asp:Label>
                        </td>
                    </tr>
               
                    <tfoot>
                        <tr>
                            <td valign="middle" align="left" style="width: 15%">
                              
                            </td>
                            <td valign="middle" align="center" style="width: 15%">
                              
                            </td>
                            <td valign="middle" align="center" style="width: 15%">
                                
                            </td>
                            <td valign="middle" align="center" style="width: 15%">
                                &nbsp;</td>
                            <td valign="middle" align="center" style="width: 15%">
                                &nbsp;</td>
                            <td valign="middle" align="center" style="width: 15%">
                                &nbsp;</td>
                        </tr>
                        <caption>
                        </caption>
                    </tfoot>
                </table>
            </td>
        </tr>
        </asp:Panel>

        <asp:Panel ID="pnlResult_TicketEntry" runat="server" Width="100%" Visible="false">
        <tr>
            <td>
                <table border="0" cellpadding="0" cellspacing="0" class="grid_TitleBG_B">
                                    <tr>
                                        <td>
                                            Discovery Ticket Entry
                                        </td>
                                    </tr>
                                </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                <tr>
                                    <td class="tdNormal" colspan="5">
                                        <asp:GridView ID="GridView1" CssClass="gridMaster" Width="100%" runat="server" AutoGenerateColumns="False"
                                            DataKeyNames="Event_Name" AllowPaging="false" AllowSorting="True" ShowFooter="true"
                                            OnRowCommand="GridView1_RowCommand" OnRowCreated="GridView1_RowCreated"
                                            CellPadding="4" ForeColor="#333333" GridLines="None" EmptyDataText="There are no Results">
                                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Right" />
                                            <Columns>
                                                <asp:BoundField DataField="Event_Name" HeaderText="Account Name" />
                                                <asp:BoundField DataField="From_Account" HeaderText="Dr. Account" />
                                                <asp:BoundField DataField="To_Account" HeaderText="Cr. Account" />
                                                <asp:BoundField DataField="Amount" HeaderText="Amount" DataFormatString="{0:n}" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" />
                                                <asp:BoundField DataField="AMOUNT_SIGN" HeaderText="Db / Cr" />
                                                <asp:BoundField DataField="Narrative" HeaderText="Narrative" />
                                                <asp:BoundField DataField="CS_GL_Desc" HeaderText="Status" />
                                                <asp:BoundField DataField="CS_GL_Code" HeaderText="" />
                                                <asp:BoundField DataField="file_number" HeaderText="File&nbsp;Number" />
                                            </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>
                                    </td>
                                </tr>
                                <caption>
                                    &nbsp;</caption>
                            </table>
                        </td>
        </tr>
        </asp:Panel>

        <asp:Panel ID="pnlResult_VAT" runat="server" Width="100%" Visible="false">
                    <tr>
                        <td>
                           <table border="0" cellpadding="0" cellspacing="0" class="grid_TitleBG_B">
                                    <tr>
                                        <td>
                                           VAT
                                        </td>
                                    </tr>
                                </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                                <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                    <tr>
                                        <td class="tdNormal" colspan="5">
                                            <asp:GridView ID="GridView3" CssClass="gridMaster" Width="100%" runat="server" AutoGenerateColumns="False"
                                                DataKeyNames="Event_Name" AllowPaging="false" AllowSorting="True" ShowFooter="true"
                                                 OnRowCreated="GridView3_RowCreated" CellPadding="4" ForeColor="#333333" 
                                                GridLines="None" EmptyDataText="There are no Results">
                                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Right" />
                                                <Columns>
                                                    <asp:BoundField DataField="Event_Name" HeaderText="Account Name" />
                                                    <asp:BoundField DataField="From_Account" HeaderText="Dr. Account" />
                                                    <asp:BoundField DataField="To_Account" HeaderText="Cr. Account" />
                                                    <asp:BoundField DataField="Amount" DataFormatString="{0:n}" HeaderText="Amount" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" />
                                                    <asp:BoundField DataField="AMOUNT_SIGN" HeaderText="Db / Cr" />
                                                    <asp:BoundField DataField="Narrative" HeaderText="Narrative" />
                                                    <asp:BoundField DataField="CS_GL_Desc" HeaderText="Status" />
                                                    <asp:BoundField DataField="CS_GL_Code" HeaderText="" />
                                                    <asp:BoundField DataField="file_number" HeaderText="File&nbsp;Number" />
                                                </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>
                                        </td>
                                    </tr>
                                    <caption>
                                        &nbsp;</caption>
                                </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                <%--<tr>
                                    <td class="tdNormal" style="width: 80%"></td>
                                    <td class="tdNormal" style="width: 20%">
                                        <b>Difference(CR-DB) : </b>
                                    </td>
                                    <td class="tdNormal">
                                        <asp:Label ID="lbl_CR_DR_Diff" runat="server" Text="" class="fieldError"></asp:Label>
                                    </td>
                                </tr>--%>
                                <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_L_Normal1"
                                            OnClick="ButtonSubmitForApproval_Click" Width="111px" 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_L_Normal"
                                            OnClick="bttn_ApproveAndCreateGL" OnClientClick="return SaveConfirmation('Are you sure to process the GL')" />
                                        <asp:Button ID="bttn_Reject" runat="server" Text="Reject" CssClass="Btn_L_Normal1"
                                            OnClick="ButtonRejectForApproval_Click" Width="111px" OnClientClick="return SaveConfirmation('Are you sure to cancel all the entries')" />
                                        <%} %>
                                        <%} %>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="Lbl_MannualDif" runat="server" Text="" class="fieldError"></asp:Label>
                        </td>
                    </tr>
        </asp:Panel>
    </table>
</asp:Content>