<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="DocumentHistory2.aspx.vb" Inherits="FinIQWebApp.DocumentHistory2" MasterPageFile="~/FiniqAppMasterPage.Master" EnableEventValidation="false" EnableViewState="true" ViewStateEncryptionMode="Always" ValidateRequest="false" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="../FinIQ_User_Controls/DateControl.ascx" TagName="DateControl" TagPrefix="uc1" %>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="MainContent">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <script>
                function allowOnlyNumber(evt) {
                    var charCode = (evt.which) ? evt.which : evt.keyCode
                    if (charCode > 31 && (charCode < 48 || charCode > 57))
                        return false;
                    return true;
                }

                function runScript(evt) {
                    var charCode = (evt.which) ? evt.which : evt.keyCode
                    if (charCode == 13) {
                        document.getElementById('ctl00_MainContent_btnLoad').click();
                        return false;
                    }
                        
                }

                function FireEnterAction(evt) {
                    var code = (evt.which) ? evt.which : evt.keyCode;

                    if (code == 13) {
                        __doPostBack('<%=txtSearch.ClientID%>', 'TextChanged');
                    }
                }
                
            </script>
            <script src="../FinIQJS/SortFilter_Grid.js"></script>
            <%--  FINNELPINT-300|| Header Freezing changes by ShraddhaD || 24-Aug-2020 --%>
            <script src="../FinIQJS/FreezeGrid.js"></script>
            <link href="../FinIQJS/FreezeGrid.css" rel="stylesheet" type="text/css" />
            <style>
                /*MASCLI- 851 || changes by MohiniM || 9-Jul-2021*/
                .ui-widget.ui-widget-content:not(.ui-datepicker, .ui-spinner) {
                    z-index: 99912 !important; /* don't change without shekhar permission */
                    box-shadow: 0 0 10px #000000;
                    padding: 0px;
                    max-width: none !important;
                    overflow: hidden;
                    top: 100px;
                    left: 100px ;
                }

                .ui-resizable-handle.ui-resizable-e {
                    border-right: 1px solid #ddd !important;
                    box-shadow: 2px 2px 2px 2px #dddd;
                }

                .ui-dialog .ui-dialog-titlebar, .ui-dialog .ui-dialog-titlebar .ui-widget {
                    background-image: none !important;
                    background-color: #fff !important;
                    color: #000000 !important;
                    border: none;
                    margin: unset !important;
                    box-shadow: unset !important;
                }

                .ui-selectmenu-button, .ui-widget, .ui-state-default, .ui-corner-all {
                    border-radius: 8px !important;
                }

                .ui-dialog .ui-dialog-titlebar {
                    opacity: unset !important;
                    z-index: unset !important;
                }

                .ui-dialog-content {
                    top: unset !important;
                }

                .ui-widget-overlay {
                    background: #000 !important;
                    opacity: .3 !important;
                }

                .ui-dialog .ui-dialog-titlebar-close span {
                    background-color: #fff !important;
                    color: #000000 !important;
                }

                iframe {
                    width: 100% !important;
                    height: 100% !important;
                    border: none !important;
                    margin-left: 5px;
                }

                .UserGrpPopup {
                    z-index: 9999 !important;
                }

                .overlaySearch {
                    background-color: #000000; /* Black background with opacity */
                    opacity: 0.3;
                }

                .centered {
                    position: fixed;
                    top: 35%;
                    left: 40%;
                }

                .ontop {
                    z-index: 999;
                    width: 100%;
                    height: 100%;
                    top: 0;
                    left: 0;
                    position: absolute;
                    background-color: #cccccc;
                    color: #aaaaaa;
                    opacity: .4;
                    filter: alpha(opacity = 50);
                }
                /*MASCLI-768 || 3-July-2021 -Start*/
                .iframe {
                    visibility: visible;
                    /*width: 1022px;
                    height: 420px;*/
                    width: 100%;
                    height: 100%;
                    top: 280px;
                    position: fixed;
                    left: 51px;
                }

                .btnclose {
                    position: fixed;
                    left: 1077px;
                    top: 280px;
                }

                .widthtwo {
                    position: absolute;
                    display: inline;
                    background-color: white;
                }

                #ModalDialog1 {
                    width: 100%;
                    height: 100%;
                }

                /*MASCLI-768 || 3-July-2021 -End*/
            </style>
			     <script>
                function button_click(objBtnID) {
                    if (window.event.keyCode == 13) {
                        document.getElementById(objBtnID).focus();
                        document.getElementById(objBtnID).click();
                    }

                }
            </script>
            <table style="width: 90%;">
                <tr>
                    <td>
                        <asp:Label ID="lblSuccessMessge" runat="server" ForeColor="Green"></asp:Label>
                        <asp:Label ID="lblErrorMessage" runat="server" ForeColor="Red"></asp:Label>
                        <asp:Label ID="lblWarningMessage" runat="server" ForeColor="Blue"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Panel ID="Pnlone" runat="server" Height="75px" BorderColor="LightGray" BorderWidth="1px" Width="100%" BorderStyle="None">

                            <table style="margin-top: 2px; margin-bottom: 2px;">
                                <tr>
                                    <td>
                                        <asp:Label ID="LblEntityFilter" runat="server" CssClass="lbl" Text="Entity" Width="50px"></asp:Label>
                                    </td>
                                    <td style="padding-right: 30px; padding-left: 10px;">
                                        <asp:DropDownList ID="ddlEntityFilter" runat="server" CssClass="ddl" AutoPostBack="false" Width="200px" AppendDataBoundItems="true">
                                            <asp:ListItem Text="All" Value="0" />
                                        </asp:DropDownList>
                                    </td>
                                    <td>
                                        <asp:Label ID="LblEventFilter" runat="server" CssClass="lbl" Text="Event"></asp:Label>
                                    </td>
                                    <td style="padding-right: 30px; padding-left: 20px;">
                                        <asp:DropDownList ID="ddlEventFilter" runat="server" CssClass="ddl ddlDataBaseShowAllTag" AutoPostBack="false" Width="233px" AppendDataBoundItems="true">
                                            <asp:ListItem Text="All" Value="0" />

                                        </asp:DropDownList>
                                    </td>
                                    <%--Added by Prasad P on 28 April 2021 for Mashreq || START --%>
                                    <td>
                                        <asp:Label ID="LblEDMSYN" runat="server" CssClass="lbl" Text="EDMS(Y/N/D)"></asp:Label>
                                    </td>
                                    <td style="padding-left: 10px;">
                                        <asp:DropDownList ID="ddlEDMSYN" runat="server" CssClass="ddl ddlDataBaseShowAllTag" Width="200px">
                                            <asp:ListItem Text="All" Value="ALL" />
                                            <asp:ListItem Text="Y" Value="Y" />
                                            <asp:ListItem Text="N" Value="N" />
                                            <asp:ListItem Text="D" Value="D" />
                                        </asp:DropDownList>
                                    </td>
                                    <%--Added by Prasad P on 28 April 2021 for Mashreq || END --%>
                                    <%-- <td>
                                        <asp:Label ID="LblProductFilter" runat="server" CssClass="lbl" Text="Product" ></asp:Label>
                                    </td>--%>
                                    <td style="padding-right: 30px;  visibility: hidden">
                                        <asp:DropDownList ID="ddlProductFilter" runat="server" CssClass="ddl ddlDataBaseShowAllTag" AutoPostBack="false" Width="252px" AppendDataBoundItems="true" Visible="false">
                                            <asp:ListItem Text="All" Value="0"></asp:ListItem>
                                        </asp:DropDownList>
                                    </td>
                                    <%-- <td>
                                        <asp:Label ID="LblTemplateFilter" runat="server" CssClass="lbl" Text="Template"></asp:Label>
                                    </td>--%>
                                    <td style="padding-right: 30px; padding-left: 10px; visibility: hidden">
                                        <asp:DropDownList ID="ddlTemplateFilter" runat="server" CssClass="ddl ddlDataBaseShowAllTag" AutoPostBack="false" Width="200px" AppendDataBoundItems="true" Visible="false">
                                            <asp:ListItem Text="All" Value="0"></asp:ListItem>
                                        </asp:DropDownList>
                                    </td>


                                    <td>
                                        <asp:Label runat="server" ID="lblPageSize" CssClass="lbl" Text="Record(s) per page"></asp:Label>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtRecordCount" runat="server" CssClass="txt" Style="text-align: right" Height="20px" AutoPostBack="True" onkeypress="return allowOnlyNumber(event);" MaxLength="3" Width="40px" Text="99"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                            <table style="margin-top: 2px; margin-bottom: 2px;">
                                <tr style="vertical-align: middle;">

                                    <td>
                                        <asp:Label ID="lblSearch" runat="server" Text="Search" CssClass="lbl" Width="50px"></asp:Label></td>
                                    <td style="padding-right: 30px; padding-left: 10px;">
                                        <asp:TextBox ID="txtSearch" runat="server" AutoPostBack="false" Width="193px" CssClass="txt" AutoComplete="off" Style="width: 200px !important;" onkeydown = "FireEnterAction(event)"></asp:TextBox>

                                    </td>
                                    <td>
                                        <asp:Label ID="FromDate" runat="server" CssClass="lbl" Text="From"></asp:Label>
                                    </td>
                                    <td style="padding-right: 5px; padding-left: 22px;">
                                        <uc1:DateControl ID="txtFromDate" ControlWidth="85" runat="server" CalenderCss="btn1" TextBoxCss="txt" />
                                    </td>
                                    <td>
                                        <asp:Label ID="ToDate" runat="server" CssClass="lbl" Text="To"></asp:Label>
                                    </td>
                                    <td style="padding-right: 0px; padding-left: 10px;">
                                        <uc1:DateControl ID="txtToDate" runat="server" ControlWidth="85" CalenderCss="btn1" TextBoxCss="txt" />
                                    </td>

                                    <td colspan="3" style="padding-left: 95px;">
                                        <asp:Button ID="btnLoad" runat="server" Text="Load" Width="95px" CssClass="btn" />
                                    </td>
                                    <td>
                                        <asp:Button ID="btnDelete" runat="server" CssClass="btn" Text="Delete" Width="100px" Visible="false" />
                                    </td>
                                    <td>
                                        <asp:Button ID="btnArchive" runat="server" CssClass="btn" Text="Archive" Width="95px" />
                                    </td>
                                    <td style="padding-left: 70px;">
                                        <asp:CheckBox ID="ChkShowAllColumns" runat="server" Text="Detailed View" AutoPostBack="true" CssClass="RadioBtn" />

                                    </td>
                                    <td>
                                        <asp:CheckBox ID="chkMaturedDeals" runat="server" Text="Matured Deals" AutoPostBack="false" CssClass="RadioBtn" Visible="false" />

                                    </td>
                                    <td>
                                        <%--<asp:CheckBox ID="chkArchive" runat="server" Text="Archive Database" AutoPostBack="true" CssClass="RadioBtn" />--%>
                                         <asp:CheckBox ID="chkArchive" runat="server" Text="Archived Files" AutoPostBack="true" CssClass="RadioBtn" />
                                    </td>
                                    <td style="width:50px;">

                                    </td>
              
                                    <td>
                                        <asp:Label ID="lblTotalRecods" runat="server" Text="Total record(s): " CssClass="lbl"></asp:Label><asp:Label ID="lblTotalRecordsVal" runat="server" Text="" CssClass="lbl"></asp:Label>
                                    </td>                                   
                                </tr>

                            </table>
                        </asp:Panel>
                    </td>
                </tr>
                <tr style="height:10px;">
                    <td></td>
                </tr>
                <tr>
                    <td>
                        <%--  <asp:Panel ID="pnlTwo" runat="server" GroupingText="Show Document History" >--%>
                        <asp:GridView ID="grdHistory" runat="server" ShowHeaderWhenEmpty="true" EmptyDataText="No Records Found" AutoGenerateColumns="False" CssClass="Grid" AllowPaging="True" OnRowDataBound="grdHistory_RowDataBound">
                            <SelectedRowStyle CssClass="GridItemSelect" />
                            <RowStyle CssClass="GridItem" />
                            <HeaderStyle CssClass="GridHeader" />
                            <FooterStyle CssClass="GridFooter" />
                            <%--  FINNELPINT-288|| Added pagersettings for paging || ShraddhaD || 12-Aug-2020 --%>
                            <PagerSettings Mode="NumericFirstLast"
                                FirstPageText="First"
                                LastPageText="Last"
                                Position="Bottom" />
                            <PagerStyle CssClass="GridPager" />
                            <Columns>

                                <asp:TemplateField>
                                    <HeaderStyle Wrap="true" HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" />
                                    <HeaderTemplate>
                                        <asp:CheckBox ID="chkAll" runat="server" AutoPostBack="false" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="chkSingle" runat="server" AutoPostBack="false" />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Actions" ItemStyle-HorizontalAlign="Center">
                                    <HeaderStyle Width="140" />
                                    <ItemStyle Width="140" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="btnViewDocument" CommandName="ViwedGeneratedDoc" runat="server"
                                            CommandArgument='<%# CType(Container, GridViewRow).RowIndex%>' Visible='<%# If(Eval("DocumentExportYN").ToString() = "N", "TRUE", "FALSE") %>'
                                            Text='View Template' CausesValidation="False" ItemStyle-HorizontalAlign="Right"
                                            Width="100">Local View</asp:LinkButton>
                                        <%--Button Added by Prasad P on 11 Feb 2021 to upload the document on EDMS as discussed with Pari sir || START--%>
                                        <div style="margin-top: 20px; margin-bottom: 20px;">
                                            <asp:LinkButton ID="btnDocumentUpload" CommandName="UploadGeneratedDOC" runat="server"
                                                CommandArgument='<%# CType(Container, GridViewRow).RowIndex%>' Visible='<%# If(Eval("DocumentExportYN").ToString() = "N", "TRUE", "FALSE") %>'
                                                CausesValidation="False" ItemStyle-HorizontalAlign="Right"
                                                Width="100">EDMS-Upload</asp:LinkButton>
                                        </div>

                                        <div style="margin-top: 20px; margin-bottom: 20px;">
                                            <%--Button Added by Prasad P on 11 Feb 2021 to upload the document on EDMS as discussed with Pari sir || END--%>
                                            <%--Button Added by Prasad P on 11 Feb 2021 to upload the document on EDMS as discussed with Pari sir || START--%>
                                            <%-- <asp:LinkButton ID="btnEDMSSearch" CommandName="SearchAPIEDMS"  runat="server"   
                                            CommandArgument='<%# CType(Container, GridViewRow).RowIndex%>'
                                            CausesValidation="False" ItemStyle-HorizontalAlign="Right" margin-bottom="100px" Visible='<%# If(Eval("DocumentExportYN").ToString() = "Y", "TRUE", "FALSE") %>'
                                            Width="100">EDMS Search</asp:LinkButton>
                                         </div>--%>
                                            <div style="margin-bottom: 20px;">
                                                <%--Button Added by Prasad P on 11 Feb 2021 to upload the document on EDMS as discussed with Pari sir || END--%>
                                                <%--Button Added by Prasad P on 11 Feb 2021 to upload the document on EDMS as discussed with Pari sir || START--%>
                                                <asp:LinkButton ID="btnEDMSDownload" CommandName="DownloadAPIEDMS" runat="server"
                                                    CommandArgument='<%# CType(Container, GridViewRow).RowIndex%>'
                                                    CausesValidation="False" ItemStyle-HorizontalAlign="Right" Visible='<%# If(Eval("DocumentExportYN").ToString() = "Y", "TRUE", "FALSE") %>'
                                                    Width="120">EDMS Download</asp:LinkButton>
                                            </div>
                                            <div style="margin-bottom: 20px;">
                                                <%--Button Added by Prasad P on 11 Feb 2021 to upload the document on EDMS as discussed with Pari sir || END--%>
                                                <%--Button Added by Prasad P on 11 Feb 2021 to upload the document on EDMS as discussed with Pari sir || START--%>
                                                <asp:LinkButton ID="btnEDMSDelete" CommandName="DeleteAPIEDMS" runat="server"
                                                    CommandArgument='<%# CType(Container, GridViewRow).RowIndex%>'
                                                    CausesValidation="False" ItemStyle-HorizontalAlign="Right" Visible='<%# If(Eval("DocumentExportYN").ToString() = "Y", "TRUE", "FALSE") %>'
                                                    Width="100">EDMS Delete</asp:LinkButton>
                                            </div>
                                            <%--Button Added by Prasad P on 11 Feb 2021 to upload the document on EDMS as discussed with Pari sir || END--%>
                                    </ItemTemplate>
                                </asp:TemplateField>


                                <asp:TemplateField HeaderText="Sr No" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" Visible="false">
                                    <HeaderStyle Width="50" CssClass="pinned" />
                                    <ItemStyle Width="50" CssClass="pinned" />
                                    <ItemTemplate>
                                        <asp:Label ID="LblSrNo" Width="50px" runat="server" Text='<%# Eval("SrNo")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Reference Number" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle">
                                    <HeaderStyle Width="80" />
                                    <ItemStyle Width="80" HorizontalAlign="Left" />
                                    <ItemTemplate>
                                        <asp:Label ID="LblPrimaryTransactionNo" Width="80px" runat="server" Text='<%# Eval("PrimaryTransactionNo")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>


                                <%--<asp:TemplateField HeaderText="Entity Name" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Middle">
                                    <HeaderStyle Width="100" />
                                    <ItemStyle Width="100" />
                                    <ItemTemplate>
                                        <div style="word-break: break-all">
                                            <asp:Label ID="LblEntityName" Width="100px" runat="server" Text='<%# Eval("EntityName")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>--%>

                                <%-- <asp:TemplateField HeaderText="Template Name" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Middle">
                                    <HeaderStyle Width="100" />
                                    <ItemStyle Width="100" />
                                    <ItemTemplate>
                                        <div style="word-break: break-all">
                                            <asp:Label ID="LblTemplateName" Width="100px" runat="server" Text='<%# Eval("TemplateName")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>--%>

                                <asp:TemplateField HeaderText="Product Name" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Middle">
                                    <HeaderStyle Width="100" />
                                    <ItemStyle Width="100" />
                                    <ItemTemplate>
                                        <div style="word-break: break-all">
                                            <asp:Label ID="LblProductName" Width="100px" runat="server" Text='<%# Eval("ProductName")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Event" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Middle" ControlStyle-Width="100">
                                    <HeaderStyle Width="100" />
                                    <ItemStyle Width="100" />
                                    <ItemTemplate>
                                        <div style="word-break: break-all">
                                            <asp:Label ID="LblEventCode" Width="100px" runat="server" Text='<%# Eval("EventCode")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Transaction Type" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Middle">
                                    <HeaderStyle Width="60" />
                                    <ItemStyle Width="60" />
                                    <ItemTemplate>
                                        <asp:Label ID="LblTransactiontype" Width="60px" runat="server" Text='<%# Eval("Transactiontype")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <%--  FINNELPINT-288|| changed width || ShraddhaD || 12-Aug-2020 --%>
                                <asp:TemplateField HeaderText="Attached/ Generated" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Middle">
                                    <HeaderStyle Width="70" />
                                    <ItemStyle Width="70" />
                                    <ItemTemplate>
                                        <div style="word-break: break-all">
                                            <asp:Label ID="LblAttachedOrGenerated" Width="70px" runat="server" Text='<%# Eval("AttachedOrGenerated")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Version" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" Visible="true">
                                    <HeaderStyle Width="30" />
                                    <ItemStyle Width="30" />
                                    <ItemTemplate>
                                        <div style="word-break: break-all">
                                            <asp:Label ID="lblVersion" Width="30px" runat="server" Text='<%# Eval("Version")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Age" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" Visible="true">
                                    <HeaderStyle Width="100" />
                                    <ItemStyle Width="100" />
                                    <ItemTemplate>
                                        <div style="word-break: break-word">
                                            <asp:Label ID="lblAgeing" Width="100px" runat="server" Text='<%# Eval("Ageing")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <%-- Added by Prasad P on 17 Feb 2021 for EDMS API UPload || START--%>
                                <asp:TemplateField HeaderText="Document Export to EDMS (Y/N/D)" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle">
                                    <HeaderStyle Width="100" />
                                    <ItemStyle Width="100" />
                                    <ItemTemplate>
                                        <div style="word-break: break-word">
                                            <asp:Label ID="lblDocumentExport" Width="100px" runat="server" Text='<%# Eval("DocumentExportYN") %>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                    <%-- Added by Prasad P on 17 Feb 2021 for EDMS API UPload || END--%>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Attached/Generated Document Name" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Middle">
                                    <HeaderStyle Width="100" />
                                    <ItemStyle Width="100" />
                                    <ItemTemplate>
                                        <div style="word-break: break-word">
                                            <asp:Label ID="LblDocumentOutputPath" Width="100px" runat="server" Text='<%# Eval("DocumentOutputPath")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="GeneratedAt/ AttachedAt" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle">
                                    <HeaderStyle Width="80" />
                                    <ItemStyle Width="80" HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="LblGeneratedOrAttachedAt" Width="80px" runat="server" Text='<%#FinIQWebApp.FinIQApp_Date.FinIQDateTime(Convert.ToString(Eval("GeneratedOrAttachedAt")))%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="GeneratedBy/ AttachedBy" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle">
                                    <HeaderStyle Width="80" />
                                    <ItemStyle Width="80" />
                                    <ItemTemplate>
                                        <asp:Label ID="LblGeneratedOrAttachedby" Width="80px" runat="server" Text='<%# Eval("GeneratedOrAttachedby")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>



                                <asp:TemplateField HeaderText="Generated Document Location" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" Visible="false">
                                    <HeaderStyle Width="100" />
                                    <ItemStyle Width="100" />
                                    <ItemTemplate>
                                        <div style="word-break: break-all">
                                            <asp:Label ID="LblGeneratedDocLocation" Width="100px" runat="server" Text='<%# Eval("GeneratedDocLocation")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="GeneratedBy Application" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" Visible="false">
                                    <HeaderStyle Width="80" />
                                    <ItemStyle Width="80" />
                                    <ItemTemplate>
                                        <div style="word-break: break-all">
                                            <asp:Label ID="LblDGT_GeneratedByApplication" Width="80px" runat="server" Text='<%# Eval("DGT_GeneratedByApplication")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Generation System" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" Visible="false">
                                    <HeaderStyle Width="100" />
                                    <ItemStyle Width="100" />
                                    <ItemTemplate>
                                        <div style="word-break: break-all">
                                            <asp:Label ID="LblDocumentGenerationSystem" Width="100px" runat="server" Text='<%# Eval("DocumentGenerationSystem")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Secondary Transaction Number" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" Visible="false">
                                    <HeaderStyle Width="80" />
                                    <ItemStyle Width="80" />
                                    <ItemTemplate>
                                        <div style="word-break: break-all">
                                            <asp:Label ID="LblSecondaryTransactionNo" Width="80px" runat="server" Text='<%# Eval("SecondaryTransactionNo")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>


                                <asp:TemplateField HeaderText="Tertiary Transaction Number" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" Visible="false">
                                    <HeaderStyle Width="80" />
                                    <ItemStyle Width="80" />
                                    <ItemTemplate>
                                        <div style="word-break: break-all">
                                            <asp:Label ID="LblTertiaryTransactionNo" Width="80px" runat="server" Text='<%# Eval("TertiaryTransactionNo")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Generated Document Id" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" Visible="false">
                                    <HeaderStyle Width="40" />
                                    <ItemStyle Width="40" />
                                    <ItemTemplate>
                                        <div style="word-break: break-all">
                                            <asp:Label ID="LblDGT_Id" Width="40px" runat="server" Text='<%# Eval("DGT_Id")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Generated Document Image Id" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" Visible="false">
                                    <HeaderStyle Width="40" />
                                    <ItemStyle Width="40" />
                                    <ItemTemplate>
                                        <div style="word-break: break-all">
                                            <asp:Label ID="lblDGI_ID" Width="40px" runat="server" Text='<%# Eval("DGI_Id")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Document Full Path" ItemStyle-HorizontalAlign="left"
                                    ItemStyle-VerticalAlign="Middle" Visible="false">
                                    <HeaderStyle Width="40" />
                                    <ItemStyle Width="40" />
                                    <ItemTemplate>
                                        <div style="word-break: break-all">
                                            <asp:Label ID="lblDocumentFullPath" Width="40px" runat="server" Text='<%# Eval("DocumentFullPath")%>'></asp:Label>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                        <%--</asp:Panel>--%>
                    </td>
                </tr>
            </table>

            <table>
                <asp:Panel ID="panelDocViewer" runat="server" Visible="false" CssClass="widthtwo">
                    <table>
                        <tr>
                            <td>
                                <div id="diviframe" draggable="true">
                                    <iframe runat="server" id="iframe" type="application/pdf" class="iframe"></iframe>
                                </div>
                            </td>
                            <td style="vertical-align: top">
                                <asp:Button ID="btnCloseviewer" runat="server" Text="X" CssClass="btn btnClose" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </table>
            <asp:HiddenField ID="hdndocwidth" runat="server" Value="1200" />
            <asp:HiddenField ID="hdndocheight" runat="server" Value="600" />
            <asp:HiddenField ID="HdnEnableViewDocument" runat="server" />
            <asp:HiddenField ID="hdnVirtualDocPath" runat="server" />
            <asp:HiddenField ID="hdnVirtualDocAlias" runat="server" />
            <asp:HiddenField ID="hdnviewedFile" runat="server" />
            <asp:button ID="hdndeleteviewedDoc" runat="server" style="visibility:hidden"/>
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="grdHistory" />
            <asp:AsyncPostBackTrigger ControlID="btnLoad" />
        </Triggers>
    </asp:UpdatePanel>

    <asp:UpdatePanel ID="updatepnl2" runat="server">
        <ContentTemplate>
            <div id="divWF_Seq_Settings" runat="server">
                <asp:Panel ID="pnlfour" runat="server" Height="100px" Visible="false" BackColor="white" BorderStyle="Solid" BorderColor="lightgray" Style="z-index: 99999; width: 300px;" CssClass="centered">
                    <asp:Label runat="server" Style="text-align: center; font-weight: bold" Width="300px" Height="21px" BackColor="lightgray ">
                        <asp:Image runat="server" ID="imgload" ImageUrl="~/App_Resources/ajax-loader5.gif" ImageAlign="Left" Height="20px" Style="display: none"></asp:Image>
                        <asp:ImageButton runat="server" ID="btnClose" ImageUrl="~/App_Resources/DELETE.BMP" ImageAlign="Right" />
                    </asp:Label>

                    <table style="padding-top: 10px; margin-left: 50px">
                        <tr>
                            <asp:Label ID="lblremark" runat="server" Text="Are you sure you want to archive record(s) ?" CssClass="lbl" Style="margin-left: 25px"></asp:Label>
                        </tr>
                        <tr style="padding-bottom: 5px">

                            <td style="padding-right: 10px">
                                <asp:Button ID="btnYes" runat="server" Text="Yes" Width="80px" CssClass="btn" />
                            </td>
                            <td>
                                <asp:Button ID="btnNo" runat="server" Text="No" Width="80px" CssClass="btn" />
                            </td>
                        </tr>
                    </table>

                </asp:Panel>
            </div>
            <div id="overlayDiv" class="overlaySearch"></div>
        </ContentTemplate>
    </asp:UpdatePanel>

    <script type="text/javascript">
        function CheckBoxInGrid() {
            try {
                $('.GridHeader input[type="checkbox"]').change(function () {
                    $('.GridHeader input[type="checkbox"]').prop("checked") == true ? $('.GridItem input[type="checkbox"]').prop("checked", true).attr("checked", "checked") : $('.GridItem input[type="checkbox"]').prop("checked", false).removeAttr("checked");
                });
                $('.GridItem  input[type="checkbox"]').change(function () {
                    if ($('.GridItem input[type="checkbox"]:checked').length == $('.GridItem   input[type="checkbox"]').length) {
                        $('.GridHeader input[type="checkbox"]').prop("checked", true).attr("checked", "checked");


                    } else {
                        $('.GridHeader   input[type="checkbox"]').prop("checked", false).removeAttr("checked");

                    }
                });
            } catch (er) { console.log(er.message); }
            Sys.WebForms.PageRequestManager.getInstance().remove_endRequest();
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function () { CheckBoxInGrid() });
        }
        $(document).ready(function () {
            CheckBoxInGrid();
        });

        function OpenOpacity() {
            document.getElementById("overlayDiv").style.display = "block";
        }
        function CloseOpacity() {
            document.getElementById("overlayDiv").style.display = "none";
        }

        function isDigit(evt, txt) {
            var charCode = (evt.which) ? evt.which : event.keyCode

            var c = String.fromCharCode(charCode);

            if (txt.indexOf(c) > 0 && charCode == 46) {
                return false;
            }
            else if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
                return false;
            }

            return true;
        }
        //MASCLI-2203 || Mohini||23-Nov-2021
        //MASCLI- 851 || changes by MohiniM || 9-Jul-2021 
        //function ShowDocument(DocumentSrc, height, width) {
        //    debugger;
        //    //document.getElementById("ctl00_MainContent_iframe").appendTo("body").dialog({class="iframe"
        //    iframe = $('<iframe id="#ModalDialog1"  src=' + DocumentSrc + '></iframe>');
        //    //iframe = $("ctl00_MainContent_iframe");
        //    //iframe = $('<iframe id="#ModalDialog1" src=' + DocumentSrc + '&Master_Popup=POPUP"OpenPopup", status="no", resizable="yes", toolbar="no", scrollbars="no", menubar="no", frameborder="0", marginwidth="0", marginheight="0"></iframe>');
        //    height = Number(height) + Number("50");
        //    width = Number(width) + Number("50");

        //    $("<div id='ModalBoxInside113'></div>").append(iframe).appendTo("body").dialog({
        //        height: height,
        //        width: width,
        //        modal: true,
        //        resizable: true,
        //        draggable: true,
        //        autoOpen: true,
        //        bgiframe: true,
        //        top: "100",
        //        left: "100",
        //        close: function () { $('html').find('#collDialog').html(); },
        //        open: function () { $('html').find('#collDialog').html(''); }
        //    });
        //}
        function ShowDocument(DocumentSrc, height, width, sourcepath) {
            height = $('#ctl00_MainContent_hdndocheight').val()
            width = $('#ctl00_MainContent_hdndocwidth').val()
            virtualDirectoryAlias = $('#ctl00_MainContent_hdnVirtualDocAlias').val()
            var top1 = (screen.height) / 4
            var left1 = (screen.width) / 3
            var ViewDocumentpopup = window.open(window.top.location.origin + '/' + virtualDirectoryAlias + '/' + DocumentSrc + '?height=' + height + '&width=' + width + '&Master_Popup=POPUP', 'QuickOrderEntry', 'top=' + top1 + 'px,left=' + left1
                + 'px,status= no, resizable=yes, scrollbars=yes, toolbar=no,width=' + width + ',height=' + height, "ViewDocumentpopup");
            ViewDocumentpopup.onload = function () {
                ViewDocumentpopup.onunload = function () {
                    $('[id$="hdndeleteviewedDoc"]').click();
                };
            }
        }

    </script>
</asp:Content>
