<%@ page title="" language="C#" masterpagefile="~/Pages/Common/MasterPages/MainMasterPage_new.master" autoeventwireup="true" inherits="Pages_Assessment_VoucherEntry, App_Web_vqct5ff5" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Src="~/UserControls/GridViewPager/GridViewPager.ascx" TagName="GridViewPager" TagPrefix="uc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/Common/ScreenGroup/ScreenGroup.ascx" TagName="ScreenGroupControl" TagPrefix="ScreenGroup" %>
<%@ Register Src="~/UserControls/DatePicker/DatePickerControl.ascx" TagName="DatePickerControl" TagPrefix="Date" %>
<%@ Register Src="~/UserControls/AutoComplete/AutoCompleteTextBoxForGridView.ascx" TagName="AutoCompleteTextBoxForGridView" TagPrefix="acc" %>
<%@ Register Src="~/UserControls/Common/CommonSearch/CommonSearch.ascx" TagName="CommonSearchUserControl" TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/Common/Account/AccountDetailBoxControl.ascx" TagName="AccountControl" TagPrefix="Acnt" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">    
    <asp:UpdatePanel ID="OTQueueListingUpdatePanel" runat="server">
        <ContentTemplate>
            <uc1:CommonSearchUserControl ID="CommonSearchControl" Visible="false" runat="server" />
            <div id="divContentPage" class="divcontentpagemargin">
                <div class="dashBoardLeftCont">
                    <div class="himssuHeader3WireBox">
                        <table>
                            <tr>
                                <td>
                                    <div class="himsBoxContent">
                                        <div class="leftUlMenu">
                                            <ScreenGroup:ScreenGroupControl EnableViewState="true" ID="ScreenGroupControl" ScreenGroupId="148"
                                                Visible="true" runat="server" />
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="whiteboxpaddingleft row">
                    <div class="himssuHeader1WireBox card card-box">
                        <cc1:TabContainer Width="100%" ID="VoucherTabContainer" runat="server" CssClass="ajax__myTab nav nav-tabs tabs-style-iconbox"
                            AutoPostBack="true" meta:resourcekey="VoucherTabContainerResource1" ActiveTabIndex="0" OnActiveTabChanged="VoucherTabContainer_ActiveTabChanged">
                            <cc1:TabPanel Width="100%" ID="VoucherTabPanel" runat="server" HeaderText="Voucher">
                                <HeaderTemplate>
                                    <ul class="nav nav-tabs tabs-style-iconboxinner ajaxnavtabs">
                                        <li class="fancyTab">
                                            <a href="#"><i class="fas fa-tasks"></i>&nbsp;Insert
                                            </a>
                                        </li>
                                    </ul>
                                </HeaderTemplate>
                                <ContentTemplate>
                                    <div class="whiteboxpaddingleft row">
                                        <Acnt:AccountControl ID="AccountUserControl" runat="server" />
                                        <div class="himssuHeader5WireBox card card-box">
                                            <div class="himsBoxHeader card-head">

                                                <div class="himsBoxTitle">
                                                    <div class="headerText">
                                                        <header></header>
                                                        <i class="fas fa-list-ul"></i>
                                                        <asp:Label ID="Label1" runat="server" Text="Voucher Entry"></asp:Label>
                                                    </div>
                                                </div>
                                                <div class="fRight mt-27">
                                                    <asp:Button ID="BackButton" runat="server" OnClick="BackButton_Click" SkinID="0" class="btn btn-back fas" Text=" Back" />
                                                </div>
                                            </div>
                                            <div class="himsBoxContent card-body">
                                                <asp:Panel ID="DetailPanel" runat="server">
                                                    <div class="contentHolder">
                                                        <div class="outerBox pTop5 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="VoucherTypeLabel" runat="server" Text="Voucher Type" SkinID="MandatoryLabel"></asp:Label>
                                                            </div>
                                                            <div class="fLeft pRight5">
                                                                <asp:DropDownList runat="server" ID="VoucherTypeDropDownList" SkinID="CustomWidthDropDownList"
                                                                    onmouseleave="showHideTooltip()" CssClass="form-control" onmouseenter="showHideTooltip()"
                                                                    AutoPostBack="True"
                                                                    OnSelectedIndexChanged="VoucherTypeDropDownList_SelectedIndexChanged">
                                                                </asp:DropDownList>
                                                            </div>
                                                        </div>
                                                        <div class="outerBox pTop5 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="VoucerEnteryDate" runat="server" Text="Voucher Date" SkinID="MandatoryLabel"></asp:Label>
                                                            </div>
                                                            <div class="fLeft pRight5">
                                                                <Date:DatePickerControl DisplayDatePicker="true" ID="VoucherDatePickerControl" Text='<%# Bind("TransactionDate") %>' runat="server"></Date:DatePickerControl>
                                                            </div>
                                                        </div>
                                                        <div class="outerBox pTop5 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="VoucherNoLabel" Text="Voucher No" runat="server" SkinID="MandatoryLabel"></asp:Label>
                                                            </div>
                                                            <div class="fLeft pRight5">
                                                                <asp:TextBox ID="VoucherNoTextBox" runat="server" onmouseleave="showHideTooltip()" SkinID="CustomWidthTextBox"
                                                                    onmouseenter="showHideTooltip()" MaxLength="100"></asp:TextBox>
                                                            </div>
                                                        </div>
                                                             <div class="outerBox pTop5 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="NarrationLabel" Text="Narration" runat="server"></asp:Label>
                                                            </div>
                                                            <div class="fLeft pRight5">
                                                                <asp:TextBox ID="NarrationTextBox" TextMode="MultiLine" Rows="3" runat="server" onmouseleave="showHideTooltip()" SkinID="CustomWidthTextBox"
                                                                    onmouseenter="showHideTooltip()" MaxLength="1000"></asp:TextBox><%--Added by dhananjay from mantis - 0035082--%>
                                                            </div>
                                                        </div>
                                                        <div class="outerBox pTop5 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="ChequeNoLabel" Text="Cheque No" runat="server"></asp:Label>
                                                            </div>
                                                            <div class="fLeft pRight5">
                                                                <asp:TextBox ID="ChequeNoTextBox" runat="server" onmouseleave="showHideTooltip()" SkinID="CustomWidthTextBox"
                                                                    onmouseenter="showHideTooltip()" MaxLength="100" Style="height: auto;"></asp:TextBox>
                                                            </div>
                                                        </div>
                                                        <div class="outerBox pTop5 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="BankNameLabel" Text="Bank Name" runat="server" Visible="False"></asp:Label>
                                                            </div>
                                                            <div class="fLeft pRight5">
                                                                <asp:TextBox ID="BankNameTextBox" runat="server" onmouseleave="showHideTooltip()" SkinID="CustomWidthTextBox"
                                                                    onmouseenter="showHideTooltip()" MaxLength="100" Style="height: auto;" Visible="False"></asp:TextBox>
                                                            </div>
                                                        </div>
                                                        <div class="cBoth"></div>
                                                        <div class="outerBox pTop5 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="ChequeDateLabel" runat="server" Text="Cheque Date" SkinID="MandatoryLabel"></asp:Label>
                                                            </div>
                                                            <div class="fLeft pRight5">
                                                                <Date:DatePickerControl DisplayDatePicker="true" ID="ChequeDatePickerControl" Text='<%# Bind("ChequeDate") %>' runat="server"></Date:DatePickerControl>
                                                            </div>
                                                        </div>
                                                        <div class="outerBox pTop15 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="MultiVoucherLabel" runat="server"></asp:Label>
                                                                <asp:CheckBox ID="MultiVoucherCheckBox" AutoPostBack="True" Text="Multi Voucher" runat="server"
                                                                    OnCheckedChanged="MultiVoucherCheckBox_Checked" class="pRight5" />
                                                            </div>
                                                        </div>
                                                        <div class="outerBox pTop5 col-md-3">
                                                            <div class="fLeft pRight5">
                                                                <asp:HiddenField ID="DetailHiddenField" runat="server" />
                                                            </div>
                                                        </div>
                                                         <div id="Div1" class="himssuHeader7WireBox col-md-12" runat="server">
                                                          <div class="himsBoxHeader" id="GridViewPagerDiv" runat="server">
                                                                <div class="leftdiv">
                                                                </div>
                                                                <div class="himsBoxTitle">
                                                                    <div class="headerText">
                                                                        <asp:Label ID="Label4" runat="server"></asp:Label>
                                                                    </div>
                                                                </div>
                                                                <div class="fRight display-flex mt-27">
                                                                    <asp:DropDownList runat="server" Visible="False" ID="LedgerTypeAddDropDownList" SkinID="CustomWidthDropDownList"
                                                                        CssClass="form-control" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                                        DataValueField="LedgerTypeId" AutoPostBack="True">
                                                                    </asp:DropDownList>
                                                                    &nbsp; &nbsp;
                                                            <asp:Button ID="AddVoucherDetailButton" runat="server" class="btn btn-add fas" SkinID="0" OnClick="AddVoucherDetailButton_Click" Text=" Add" Visible="False" />

                                                                </div>
                                                            </div>
                                                            <div class="himsBoxContent card-body table-responsive">
                                                                <asp:GridView ID="VoucherGridView" runat="server" AutoGenerateColumns="False"
                                                                    EmptyDataText="No Records Found !!" CssClass="table table-striped table-bordered table-hover" OnRowDataBound="VoucherEntrySearchGridView_RowDataBound"
                                                                    DataKeyNames="TransactionDetailId">
                                                                    <Columns>
                                                                        <asp:BoundField DataField="TransactionDetailId" HeaderText="Id" Visible="False"></asp:BoundField>
                                                                        <asp:TemplateField HeaderText="To/By">
                                                                            <ItemTemplate>
                                                                                <asp:DropDownList runat="server" Enabled="false" ID="LedgerTypeDropDownList" SkinID="CustomWidthDropDownList"
                                                                                    CssClass="form-control" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                                                    DataValueField="LedgerTypeId" AutoPostBack="True"
                                                                                    OnSelectedIndexChanged="LedgerTypeDropDownList_SelectedIndexChanged">
                                                                                </asp:DropDownList>
                                                                            </ItemTemplate>
                                                                            <HeaderStyle HorizontalAlign="Left" />
                                                                            <ItemStyle Width="10%" Wrap="True" />
                                                                        </asp:TemplateField>
                                                                        <asp:TemplateField HeaderText="Ledger">
                                                                            <ItemTemplate>
                                                                                <asp:DropDownList runat="server" ID="LedgerDropDownList" SkinID="CustomWidthDropDownList"
                                                                                    CssClass="form-control" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                                                    DataValueField="LedgerId" AutoPostBack="True"
                                                                                    OnSelectedIndexChanged="LedgerDropDownList_SelectedIndexChanged">
                                                                                </asp:DropDownList>
                                                                            </ItemTemplate>
                                                                            <HeaderStyle HorizontalAlign="Left" />
                                                                            <ItemStyle Width="20%" Wrap="True" />
                                                                        </asp:TemplateField>
                                                                        <asp:TemplateField HeaderText="Balance">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="OpBalanceLabel" runat="server" Text="" Font-Bold="true"></asp:Label>
                                                                            </ItemTemplate>
                                                                            <HeaderStyle HorizontalAlign="Left" />
                                                                            <ItemStyle Width="10%" Wrap="True" />
                                                                        </asp:TemplateField>
                                                                       <%--Removed code for mantis : 32211 by Nilesh--%>
                                                                        <asp:TemplateField HeaderText="Credit">
                                                                            <ItemTemplate>
                                                                                <asp:TextBox ID="CreditTextBox" SkinID="CustomWidthTextBox" runat="server" Width="150px" MaxLength="200"                                
                                                                                    Text='<%# Eval("Credit") %>'
                                                                                    AutoPostBack="true" OnTextChanged="DebitTextBox_TextChanged"></asp:TextBox>
                                                                            </ItemTemplate>
                                                                            <HeaderStyle HorizontalAlign="Left" />
                                                                            <ItemStyle Width="20%" Wrap="True" />
                                                                        </asp:TemplateField>
                                                                        <%--Removed code for mantis : 32211 by Nilesh--%>
                                                                        <asp:TemplateField HeaderText="Debit">
                                                                            <ItemTemplate>
                                                                                <asp:TextBox ID="DebitTextBox" SkinID="CustomWidthTextBox" runat="server" Width="150px" MaxLength="200"
                                                                                 Text='<%# Eval("Debit") %>'
                                                                                 AutoPostBack="True" OnTextChanged="DebitTextBox_TextChanged"></asp:TextBox>
                                                                            </ItemTemplate>
                                                                            <HeaderStyle HorizontalAlign="Left" />
                                                                            <ItemStyle Width="20%" Wrap="True" />
                                                                        </asp:TemplateField>
                                                                    </Columns>
                                                                    <PagerSettings Visible="False" />
                                                                </asp:GridView>
                                                            </div>
                                                        </div>
                                                    </div>

                                                </asp:Panel>
                                            </div>
                                        </div>
                                    </div>
                                </ContentTemplate>
                            </cc1:TabPanel>
                            <cc1:TabPanel Width="100%" ID="BulkInsertTabPanel" runat="server" HeaderText="Bulk Insert">
                                <HeaderTemplate>
                                    <ul class="nav nav-tabs tabs-style-iconboxinner ajaxnavtabs">
                                        <li class="fancyTab">
                                            <a href="#"><i class="fas fa-tasks"></i>&nbsp;Bulk Insert
                                            </a>
                                        </li>
                                    </ul>
                                </HeaderTemplate>
                                <ContentTemplate>
                                <div class="whiteboxpaddingleft row">
                                       <div class="cBoth">
                                       </div>
                                 <div class="outerBox pTop5 col-md-3">
                                    <div class="controlLabelWidth">
                                        <asp:HyperLink ID="DownloadVoucherNameTemplateHyperLink" runat="server" Text="&#xf101; Download Template"
                                            NavigateUrl="~/ContentTemplates/Import/VoucherImport.xls" Visible="True" CssClass="pointer fas"></asp:HyperLink>
                                    </div>
                              </div>
                                    <asp:Label ID="VoucherUploadlabel" runat="server" Text="" Style="padding-left: 10px; font-size: medium;"></asp:Label>
                                     <div class=" col-md-9 pTop10 pb5">
                                    <div class="controlLabelWidth">
                                        <a href="javascript:;" onclick="OpenFileUpload();" class="btn btn-browser">
                                            <i class="fa fa-arrow-down"></i>Browse</a>
                                        <asp:FileUpload ID="VoucherFileupload" runat="server" onChange="readURL(this);" ClientIDMode="Static" Style="display:none;" />
                                        <asp:Button ID="VouchervalidateButton" runat="server" Text="&#xf00c; Validate" SkinID="0" CssClass="btn btn-validate fas" OnClick="ValidateButton_Click" />
                                        <asp:Button ID="VoucherImportFromExcelButton" runat="server" Text="&#xf019; Import From Excel" meta:resourcekey="ImportButtonResource1"
                                        SkinID="0" CssClass="btn btn-examcommon fas" OnClick="ImportFromExcelButton_Click" />
                                        <asp:Button ID="ClearButton" runat="server" Text="&#xf12d; Clear" OnClick="ClearButton_Click1"
                                            SkinID="0" class="fas btn btn-clear " Font-Bold="true" CommandName="Clear" />
                                        </div>
                                         </div>
                                    </div>
                                    <div id="HtmlDiv" runat="server" visible="true" class="himssuHeader7WireBox table-responsive" style="width: 99%; height: 400px; overflow: scroll;">
                                     <div class="himsBoxContent box-body box-solid table-hover" style="font-size: smaller !important;">
                                    <asp:Label ID="HtmlStringLabel" runat="server" Text=""></asp:Label>
                                </div>
                            </div>
                        </ContentTemplate>
                         </cc1:TabPanel>
                        </cc1:TabContainer>
                    </div>
                </div>
                    </div>
             </ContentTemplate>
    </asp:UpdatePanel>
    <%--<script data-main="../../../JavaScript/rjs/encrypt/voucher-entry-encrypt" src="../../../JavaScript/rjs/require.js"></script>--%>
    <script data-main='<%=ResolveUrl("~/JavaScript/rjs/voucher-entry")%>' src='<%=ResolveUrl("~/JavaScript/rjs/require.js")%>'></script>
    <%--Added for mantis : 32211 by Nilesh--%>
  <%--  <script type="text/javascript">
        function LimitDecimalPlaces(textBox, decimalPlaces) {
            var value = textBox.value;
            value = value.replace(/[^0-9.]/g, '');
            var decimalIndex = value.indexOf('.');
            if (decimalIndex !== -1) {
                if (value.substring(decimalIndex + 1).length > decimalPlaces) {
                    value = value.slice(0, decimalIndex + decimalPlaces + 1);
                }
            }
            textBox.value = value;
        }
    </script>--%>
 </asp:Content>
