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

<%@ Register Src="../UserControls/DatePicker.ascx" TagName="DatePicker" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script language="javascript" type="text/javascript">
        function KeyPressFuncIsWholeNumber() {

            if (event.keyCode < 48 || event.keyCode > 58) { event.returnValue = false; }
        }
        function SaveConfirmation(Message) {
            var userSelection;

            userSelection = confirm(Message);

            if (userSelection) {
                return true;
            } else {
                return false;
            }
        }

        function scrollWin() {
            window.scrollBy(0, 500);

        }
        function scrollWinUp() {
            window.scrollBy(0, -500);
            return false;
        }

    </script>
</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>Visa Settlements
                        </td>
                    </tr>
                </table>
                <br>
                <!------------------------------------body End1 ----------------------------------------------->
                <table border="0" cellpadding="0" cellspacing="0" class="contTB">
                    <tr>
                        <td align="center">
                            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="Frow">
                                <tr>
                                    <td></td>
                                </tr>
                            </table>
                            <br />
                            <asp:Label ID="lblError" runat="server" Text="" class="fieldError"></asp:Label>
                            <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                <tr>
                                    <td class="tdNormal" style="width:10%">&nbsp;Product
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="ddlProducts" runat="server" DataTextField="PRODUCT_NAME" Width="250px"
                                            DataValueField="ID" class="fieldNormal" AutoPostBack="False">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <% if (ddlProducts.SelectedValue == "2")
                                    {  %>
                                <tr>
                                    <td class="tdNormal">Currency
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="ddlCurrency" runat="server" DataTextField="Curr_Name" Width="250px"
                                            DataValueField="CardScheme_Curr_ID" class="fieldNormal">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <%} %>
                                <tr>
                                    <td class="tdNormal">File Date
                                    </td>
                                    <td>
                                        <uc1:DatePicker ID="dt_SettleDate" runat="server" width="250" />
                                    </td>
                                </tr>
                            <td colspan="2" style="text-align: center">
                                        <asp:Button ID="Button1" runat="server" Text="Search" CssClass="Btn_L_Normal" OnClick="Button1_Click" /> &nbsp;&nbsp;
                                        <asp:Button ID="btnGenDtlReport" runat="server" Text="Detail Report" CssClass="Btn_L_Normal1"
                                            OnClientClick="" OnClick="btnGenDtlReport_Click" Width="108px" />&nbsp;&nbsp;&nbsp;&nbsp;
                                        <asp:Button ID="btnGenSumReport" runat="server" Text="Summary Report" CssClass="Btn_L_Normal1"
                                            OnClientClick="" OnClick="btnGenSumReport_Click" Width="128px" />&nbsp;&nbsp;
                                        <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>
                                        <br />
                                    </td>
                                    <tr>
                                        <td colspan="2" style="text-align: center"></td>
                                    </tr>
                    </tr>
                </table>
                <br />
                <asp:Panel ID="pnlResult" runat="server" Width="100%" Visible="false">
                    <fieldset id="addItem">
                        <legend id="addItem">Visa Settlements</legend>
                    </fieldset>
                    <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="csr_code" AllowPaging="false" AllowSorting="True" ShowFooter="true"
                                    CellPadding="4" ForeColor="#333333" GridLines="None" OnRowCommand="GridView1_RowCommand"
                                    OnRowCreated="GridView1_RowCreated" 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="Narrative" HeaderText="Narrative" />
                                        <asp:BoundField DataField="Cardscheme_Curr_Name" HeaderText="Currency" />
                                        <asp:BoundField DataField="DbAmt" DataFormatString="{0:0.00}" HeaderText="Dr. Amount" />
                                        <asp:BoundField DataField="CRAmt" DataFormatString="{0:0.00}" HeaderText="Cr. Amount" />
                                        <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:ButtonField ButtonType="Image" ItemStyle-Width="30px" CommandName="v" Text="View"
                                            ImageUrl="~/Images/document_view.jpg">
                                            <ItemStyle Width="30px" />
                                        </asp:ButtonField>
                                        <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>
                            </td>
                        </tr>
                        <caption>
                            &nbsp;</caption>
                    </table>
                    <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">
                                <asp:Label ID="lbl_CR_DR_Diff" runat="server" Text="" class="fieldError"></asp:Label>
                            </td>
                        </tr>
                         <tr>
                            <td class="tdNormal" style="width: 73%">
                             <% if (GridView1.Rows.Count >= 1)
                                { %>
                                <% if (lbl_Status.Text == "000" || lbl_Status.Text == "008")
                                   { %>
                                  <asp:Button ID="bttn_AddDiff" runat="server" Text="Add Diff Entry" CssClass="Btn_L_Normal"
                                    OnClick="bttn_AddDiff_Click" />
                                 <%}
                                } %>
                            </td>
                            <td class="tdNormal" style="width: 10%">
                            </td>
                            <td class="tdNormal">
                               
                            </td>
                        </tr>
                         
                    </table>
                     <br /> <br />
                      <asp:Label ID="Lbl_MannualDif" runat="server" Text="" class="fieldError"></asp:Label>
                <br />
                <asp:Panel ID="pnlAddMannualDiff" runat="server" Width="100%" Visible="false">
                    <fieldset id="addItem">
                        <legend id="addItem">Add New Diff. Entry
                                        <%=ddlProducts.SelectedItem.Text %></legend>
                    </fieldset>
                    <table border="0" cellpadding="0" cellspacing="0" class="add_ItemTB">
                        <tr>
                            <td class="tdNormal" style="width: 15%">Account Name
                            </td>
                            <td class="tdNormal" style="width: 20%">
                                <asp:DropDownList ID="ddl_CS_EventList" class="fieldNormal" runat="server" Width="250"
                                    DataTextField="Event_Name" DataValueField="Cs_Evnt_Code" AutoPostBack="true"
                                    OnSelectedIndexChanged="ddl_CS_EventList_SelectedIndexChanged">
                                </asp:DropDownList>
                            </td>
                            <td class="tdNormal" style="width: 15%">Amount
                            </td>
                            <td class="tdNormal" style="width: 20%">
                                <asp:TextBox ID="txtAmount" runat="server" class="fieldNormal" Width="50%"></asp:TextBox>
                                <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtAmount" Type="Double"></asp:RangeValidator>
                                <asp:DropDownList ID="ddlGLtype" runat="server" Width="30%">
                                    <asp:ListItem Value="DB">DB</asp:ListItem>
                                    <asp:ListItem Value="CR">CR</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                            <td style="width: 25%"></td>
                        </tr>
                        <tr>
                            <td class="tdNormal" style="width: 15%">Debit Account
                            </td>
                            <td class="tdNormal" style="width: 30%">
                                <asp:Label ID="lbl_FromAcct" runat="server" class="fieldNormal" Text=""></asp:Label>
                            </td>
                            <td class="tdNormal" style="width: 15%">Credit Account
                            </td>
                            <td class="tdNormal" style="width: 30%">
                                <asp:Label ID="lbl_ToAcct" runat="server" class="fieldNormal" Text=""></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td class="tdNormal" style="width: 15%">Narrative
                            </td>
                            <td class="tdNormal" style="width: 30%">
                                <asp:Label ID="lbl_Narr" runat="server" class="fieldNormal" Text=""></asp:Label>
                            </td>
                            <td class="tdNormal" style="width: 15%">Settlement Currency
                            </td>
                            <td class="tdNormal" style="width: 30%">
                                <asp:Label ID="lbl_Sett_Curr" runat="server" class="fieldNormal" Text=""></asp:Label>
                            </td>
                        </tr>
                    </table>
                    <table border="0" cellpadding="0" cellspacing="0" class="action_TB_BgaddItem">
                        <tr>
                            <td>
                                <asp:Button ID="btnCancelPost" runat="server" Text="   Cancel   " class="Btn_M_Normal"
                                    CausesValidation="False" OnClick="btnCancelPost_Click" />
                                <asp:Button ID="btnSavePost" runat="server" Text="   Save   " class="Btn_M_Normal"
                                    OnClick="btnSavePost_Click" OnClientClick="return SaveConfirmation('Ar you sure to pass mannual entry')" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <br />
                    <fieldset id="addItem">
                        <legend id="addItem">VAT</legend>
                    </fieldset>

                    <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                        <tr>
                            <td class="tdNormal" colspan="5">
                                <asp:GridView ID="GridViewVAT" CssClass="gridMaster" Width="100%" runat="server" AutoGenerateColumns="False"
                                    DataKeyNames="csr_code" AllowPaging="false" AllowSorting="True" ShowFooter="true"
                                    CellPadding="4" ForeColor="#333333" GridLines="None" OnRowCommand="GridViewVAT_RowCommand"
                                    OnRowCreated="GridViewVAT_RowCreated" 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="Narrative" HeaderText="Narrative" />
                                        <asp:BoundField DataField="Cardscheme_Curr_Name" HeaderText="Currency" />
                                        <asp:BoundField DataField="DbAmt" DataFormatString="{0:0.00}" HeaderText="Amount" />
                                        <asp:BoundField DataField="CRAmt" DataFormatString="{0:0.00}" HeaderText="Cr. Amount" Visible="false" />
                                        <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:ButtonField ButtonType="Image" ItemStyle-Width="30px" CommandName="v" Text="View"
                                            ImageUrl="~/Images/document_view.jpg">
                                            <ItemStyle Width="30px" />
                                        </asp:ButtonField>
                                        <%-- <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>
                            </td>
                        </tr>
                        <caption>
                            &nbsp;</caption>
                    </table>
                    <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="Reprocess" CssClass="Btn_L_Normal1"
                                    OnClick="btnReprocess_Click" Width="111px" OnClientClick="return SaveConfirmation('Are you sure to send all the entries for Reprocess')" />
                                <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>
                </asp:Panel>
                <br />



              
                <br />
                <asp:Panel ID="pnlBR" runat="server" Width="50%" Visible="false">
                    <fieldset id="addItem">
                        <legend id="addItem">Settlement Details:
                                        <asp:Label ID="lbl_Detail" runat="server" Text=""></asp:Label></legend>
                    </fieldset>
                    <table border="0" width="60%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                        <tr>
                            <td class="tdNormal" colspan="5">
                                <asp:GridView ID="GridView2" CssClass="gridMaster" Width="100%" runat="server" AutoGenerateColumns="False"
                                    DataKeyNames="Sre_ID" AllowPaging="True" AllowSorting="True" CellPadding="4"
                                    ForeColor="#333333" GridLines="None" OnRowCommand="GridView1_RowCommand" EmptyDataText="There are no Results">
                                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Right" />
                                    <Columns>
                                        <asp:BoundField DataField="Sre_ID" HeaderText="SRE ID" />
                                        <asp:BoundField DataField="Settl_Date" HeaderText="Settlement Date" />
                                        <%--   <asp:BoundField DataField="Cr_Amount" HeaderText="Cr Amount" />
                                                    <asp:BoundField DataField="Dr_Amount" HeaderText="Dr Amount" />--%>
                                        <asp:BoundField DataField="clrng_Amt" HeaderText="Clearing Amount" />
                                        <asp:BoundField DataField="Settl_Amt" HeaderText="Settlement Amount" />
                                        <%--  <asp:BoundField DataField="Amt_Sign" HeaderText="Sign" />--%>
                                    </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>
                        <tr>
                            <td class="tdNormal" style="width: 20%">Go To Page:
                                            <asp:DropDownList ID="ddlPages2" runat="server" class="fieldNormal" AutoPostBack="True"
                                                Width="50px" OnSelectedIndexChanged="ddlPages2_SelectedIndexChanged">
                                            </asp:DropDownList>
                            </td>
                            <td class="tdNormal"></td>
                            <td class="tdNormal"></td>
                            <td class="tdNormal"></td>
                            <td class="tdNormal"></td>
                        </tr>
                        <br />  <br />
                        <tr>
                        
                            <td class="tdNormal"></td>
                            <td class="tdNormal"></td>
                             <td class="tdNormal" style="width: 20%">
                                        <asp:Button ID="btnCancel" runat="server" Text="Close VAT & Txn. Details" class="Btn_L_Normal1"
                                    CausesValidation="False" OnClick="btnCancel_Click" />
                            </td>
                            <td class="tdNormal"></td>
                            <td class="tdNormal"></td>
                        </tr>
                    </table>
                  
                </asp:Panel>
                <!------------------------------------body End2 ----------------------------------------------->
                
            </td>
        </tr>
    </table>
    <!------------------------------------body End2 ----------------------------------------------->
    </td>
        </tr>
    </table>
</asp:Content>
