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

<%@ Register src="../UserControls/DatePicker.ascx" tagname="DatePicker" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

                     <ContentTemplate>
    <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>
                                        VAT GL Summary</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">VAT File Date 
                                                </td>
                                                <td>
                                                    <uc1:DatePicker ID="dtPostDateFrom" runat="server" width="250" />
                                                </td>
                                                <td></td>
                                                <td colspan="2" class="tdNormal" style="text-align: left">
                                                    <asp:Button ID="btnGetFiles" runat="server" Text="Get Files" CssClass="Btn_L_Normal"
                                                        OnClick="btnGetFiles_Click" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="tdNormal">Response File Date
                                                </td>
                                                <td>
                                                    <uc1:DatePicker ID="dtPostDateTo" runat="server" width="250" />
                                                </td>
                                                <td></td>
                                                <td class="tdNormal">File Name</td>
                                                <td class="tdNormal">
                                                    <asp:DropDownList ID="ddlFiles" runat="server" DataTextField="Vat_Inv_File_Name"
                                                        Width="250px" DataValueField="Vat_Inv_File_Name" class="fieldNormal">
                                                    </asp:DropDownList>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="5" style="text-align: center">
                                                    <asp:Button ID="Button1" runat="server" Text="Search" CssClass="Btn_L_Normal"
                                                        OnClick="Button1_Click" />
                                                </td>
                                            </tr>
                                        </table>
                                        <br />
                                            
                                        <asp:Panel ID="pnlResult" runat="server" Width="100%" Visible="false">
                                            <fieldset id="addItem">
                                             <legend id="addItem">Summary</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="File_Date" AllowPaging="True" AllowSorting="True" 
                                                            CellPadding="4" ForeColor="#333333" GridLines="None" 
                                                            onrowcommand="GridView1_RowCommand" EmptyDataText="There are no Results" 
                                                            onrowdatabound="GridView1_RowDataBound" 
                                                            onrowcreated="GridView1_RowCreated">
                                                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Right" />
                                                            <Columns>
                                                                
                                                                <asp:BoundField DataField="File_Date" HeaderText="PostDate" />
                                                                <asp:BoundField DataField="Proc_Start_Time" HeaderText="Start Time" />
                                                                <asp:BoundField DataField="Proc_End_Time" HeaderText="End Time" />
                                                                <asp:BoundField DataField="VAT_Inv_FileName" HeaderText="VAT FileName" />
                                                                <asp:BoundField DataField="Vat_Inv_Filenumber" HeaderText="VAT File Number" />
                                                                <asp:BoundField DataField="Processing_Status" HeaderText="Processing Status" />
                                                                <asp:BoundField DataField="Records_Present" HeaderText="Records Present" />
                                                                <asp:BoundField DataField="Resp_Filenumber" HeaderText="Resp File Number"/>
                                                                <asp:BoundField DataField="Resp_Filename" HeaderText="Resp File Name"/>
                                                                <asp:BoundField DataField="Resp_Dttime" HeaderText="Resp Date"/>
                                                                <asp:BoundField DataField="Resp_Prcsd_Cnt" HeaderText="Resp Count"/>
                                                                <asp:BoundField DataField="Resp_Rej_Cnt" HeaderText="Rejected"/>
                                                                <asp:ButtonField ButtonType="Image" ItemStyle-Width="30px" ItemStyle-Height="30px" CommandName="u" Text="Upload response" ImageUrl="~/Images/upload.png" Visible=false/>
                                                                <asp:ButtonField ButtonType="Image" ItemStyle-Width="30px" CommandName="d" Text="View Rejected Trans"
                                                                     ImageUrl="~/Images/document_view.jpg" >
                                                                    <ItemStyle Width="30px" />
                                                                </asp:ButtonField>
                                                                <asp:TemplateField HeaderText="Download" Visible=false>
                                                                    <ItemTemplate>
                                                                    <asp:LinkButton ID="lnkDownload" Text="Download Vat File" CommandArgument='<%# Eval("VAT_Inv_FileName") %>' runat="server" OnClick="DownloadFile"></asp:LinkButton>
                                                                                <%--<a href='<%Eval("VAT_Inv_FileName","F:\\VATFiles\\{0}")%>'>DownLoad</a>--%>
                                                                    </ItemTemplate>
                                                             </asp:TemplateField>
                                                            </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="ddlPages" runat="server" class="fieldNormal" 
                                                            AutoPostBack="True" Width=50px onselectedindexchanged="ddlPages_SelectedIndexChanged"></asp:DropDownList></td>
                                                    <td class="tdNormal">
                                                        </td>
                                                    <td class="tdNormal"></td>
                                                    <td class="tdNormal"></td>
                                                    <td class="tdNormal"><asp:HyperLink ID="HyperLink1" runat="server" Visible=false>DownloadFile</asp:HyperLink></td>
                                                </tr>
                                            </table>
                                            
                                        </asp:Panel> 
                                             <asp:Panel ID="pnlDetails" runat="server" Width="80%" Visible="false">
                                                <fieldset id="addItem">
                                             <legend id="addItem">Transaction Details</legend>
                                            </fieldset>
                                            <table border="0" width=100% cellpadding="0" cellspacing="0" class="add_ItemTB">
                                                <tr>
                                                    <td class="tdNormal" style="width:20%">PTS Code</td>
                                                    <td class="tdNormal">
                                                    <asp:TextBox ID="txtPTSCode" runat="server" class="fieldNormal" Width=250 ></asp:TextBox>
                                                        </td>
                                                    <td class="tdNormal"></td>
                                                    <td class="tdNormal"></td>
                                                    <td class="tdNormal"> <asp:Button ID="btnSearchTran" runat="server" Text="Search" class="Btn_L_Normal" 
                                                            onclick="btnSearchTran_Click" /></td>
                                                </tr>
                                                <tr>
                                                    <td class="tdNormal" colspan=5>
                                                        <asp:GridView ID="GridView2" CssClass="gridMaster" Width ="100%" runat="server" AutoGenerateColumns="False"
                                                             DataKeyNames="Mt_Code" AllowPaging="True" AllowSorting="True" 
                                                            CellPadding="4" ForeColor="#333333" GridLines="None" 
                                                            onrowcommand="GridView1_RowCommand" EmptyDataText="There are no Results" 
                                                            onrowdatabound="GridView1_RowDataBound" 
                                                            onrowcreated="GridView1_RowCreated">
                                                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Right" />
                                                            <Columns>
                                                                <asp:BoundField DataField="GWFileName" HeaderText="GW File Name" />
                                                                <asp:BoundField DataField="Tran_Date" HeaderText="Date" />
                                                                <asp:BoundField DataField="Tran_Time" HeaderText="Time" />
                                                                <asp:BoundField DataField="Reference_number" HeaderText="RRN" />
                                                                <asp:BoundField DataField="Terminal_id" HeaderText="Term ID" />
                                                                <asp:BoundField DataField="Masked_Card_No" HeaderText="Card Number" />
                                                                <asp:BoundField DataField="Transaction_Amount" HeaderText="Amount" />
                                                                <asp:BoundField DataField="Merchant_Service_Fees" HeaderText="Fees" />
                                                                <asp:BoundField DataField="Branch_Chg" HeaderText="Branch Chg"/>
                                                                <asp:BoundField DataField="Vat_Amount" HeaderText="VAT Amount"/>
                                                                <asp:BoundField DataField="Vat_Inv_Status" HeaderText="Status"/>
                                                                <asp:BoundField DataField="TranType" HeaderText="Type"/>
                                                                <asp:BoundField DataField="financial_flag" HeaderText="Financial"/>
                                                            </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="DropDownList1" runat="server" class="fieldNormal" 
                                                            AutoPostBack="True" Width=50px onselectedindexchanged="ddlPages_SelectedIndexChanged"></asp:DropDownList></td>
                                                    <td class="tdNormal">
                                                        </td>
                                                    <td class="tdNormal"></td>
                                                    <td class="tdNormal"></td>
                                                    <td class="tdNormal"> <asp:Button ID="btnCancel" runat="server" Text="Cancel" class="Btn_L_Normal" 
                                                            onclick="btnCancel_Click" /></td>
                                                </tr>
                                            </table>
                                             </asp:Panel>
                                            <asp:Panel ID="pnlBR" runat="server" Width="80%" Visible="false">
                                                <fieldset id="addItem">
                                                <legend id="addItem">Upload Response File</legend>
                                            </fieldset>
                                            <table border="1" width="100%" 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">
                                                        <asp:Button ID="btnUpload" runat="server" Text="Upload" class="Btn_L_Normal" 
                                                            onclick="btnUpload_Click" />
                                                    </td>
                                                    <td class="tdNormal">
                                                        <asp:Button ID="btnProcess" runat="server" Text="Process" class="Btn_L_Normal" Enabled=false 
                                                            onclick="btnProcess_Click" />
                                                    </td>
                                                    <td class="tdNormal">
                                                        <asp:Button ID="Button2" runat="server" Text="Cancel" class="Btn_L_Normal" 
                                                            onclick="Button2_Click" />
                                                    </td>
                                                </tr>
                                                   
                                            </table>
                                            </asp:Panel>
                                        <!------------------------------------body End2 ----------------------------------------------->
                                        <br>
                                    </td>
                                </tr>
                            </table>
                            <!------------------------------------body End2 ----------------------------------------------->
                        </td>
                    </tr>
                </table>
                  </ContentTemplate>

</asp:Content>

