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

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/GridViewPager/GridViewPager.ascx" TagName="GridViewPager" TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/Common/ScreenGroup/ScreenGroup.ascx" TagName="ScreenGroupControl" TagPrefix="ScreenGroup" %>
<%@ Register Src="~/UserControls/DatePicker/DatePickerControl.ascx" TagName="DatePickerControl" TagPrefix="Date" %>
<%@ Register Src="~/UserControls/Common/EmployeeSearch/EmployeeSearch.ascx" TagName="EmployeeSearchControl" TagPrefix="hims" %>
<%@ Register Src="~/UserControls/AutoComplete/AutoCompleteControl.ascx" TagName="AutoCompleteControl" TagPrefix="acc" %>
<%@ Register Src="~/UserControls/Common/CommonSearch/CommonSearch.ascx" TagName="CommonSearchUserControl" TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/Common/StudentSearch/StudentSearch.ascx" TagName="StudentSearch" TagPrefix="Std" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <asp:UpdatePanel ID="IncidentLogUpdatePanel" runat="server" UpdateMode="Always">
        <ContentTemplate>
            <Std:StudentSearch ID="StudentSearch" Visible="false" runat="server" />
            <uc1:CommonSearchUserControl ID="CommonSearchControl" Visible="false" runat="server" />
            <hims:EmployeeSearchControl ID="EmployeeSearch" 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="217"
                                                Visible="true" runat="server" />
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="whiteboxpaddingleft row">
                    <div class="himssuHeader2WireBox card card-box">
                        <div class="contentHolder" style="padding-top: 0px; padding-left: 0px; padding-right: 0px">
                            <div class="himssuHeader1WireBox">
                                <div class="himsBoxHeader card-head">
                                    <div class="leftdiv">
                                    </div>
                                    <div class="himsBoxTitle">
                                        <div class="headerText">
                                            <header>
                                                <i class="fas fa-list-ul"></i>
                                                <asp:Label ID="Label1" runat="server" Text="Charge Receipt"></asp:Label>
                                            </header>
                                        </div>
                                    </div>
                                    <div class="fRight mt-27 pagination display-flex ">
                                        <table>
                                            <tr>
                                                <td class="formLabel">
                                                    <div id="NumberOfRecordDiv" class="display-flex" runat="server" visible="true">
                                                        <asp:LinkButton AlternateText="First page" ToolTip="First page" ID="FirstRecordImageButton"
                                                            runat="server" CommandName="Page" CommandArgument="First"
                                                            OnClick="FirstRecordImageButton_Click" CssClass="btn btn-default gridviewpagerbuttonpadding">
					<i class="fa fa-fast-backward"></i>
                                                        </asp:LinkButton>
                                                        <asp:LinkButton AlternateText="Previous page" ToolTip="Previous page" ID="PreviousImageButton"
                                                            runat="server" CommandName="Page" CommandArgument="Prev"
                                                            OnClick="PreviousImageButton_Click" CssClass="btn btn-default gridviewpagerbuttonpadding">
					<i class="fa fa-play fa-rotate-180"></i>
                                                        </asp:LinkButton>
                                                        &nbsp;
				<asp:Label ID="LabelPage" runat="server" Text="Record " AssociatedControlID="ReCordNumber" />
                                                        <asp:Label ID="ReCordNumber" Font-Bold="true" SkinID="Dummy" runat="server"></asp:Label>
                                                        <asp:Label ID="ofLabel" Text="of" runat="server" />
                                                        <asp:Label ID="TotalRecord" runat="server" />
                                                        &nbsp;
				<asp:LinkButton AlternateText="Next page" ToolTip="Next page" ID="NextImageButtom"
                    runat="server" CssClass="btn btn-default gridviewpagerbuttonpadding" CommandName="Page" CommandArgument="Next"
                    OnClick="NextImageButton_Click">
					 <i class="fa fa-play"></i>
                </asp:LinkButton>

                                                        <asp:LinkButton AlternateText="Last page" ToolTip="Last page" ID="LastRecordImageButton"
                                                            runat="server" CssClass="btn btn-default gridviewpagerbuttonpadding" CommandName="Page" CommandArgument="Last"
                                                            OnClick="LastRecordImageButton_Click">
					  <i class="fa fa-fast-forward"></i>
                                                        </asp:LinkButton>
                                                        &nbsp;  &nbsp; &nbsp;
                                                    </div>
                                                </td>
                                                <td>
                                                    <asp:Button ID="BackButton" runat="Server" OnClick="BackButton_Click" SkinID="0" CssClass="btn btn-back fas" Text="&#xf30a;  back" />
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>
                                <div class="himsBoxContent card-body">
                                    <asp:Panel ID="DetailPanel" runat="Server">
                                        <div class="contentHolder">
                                            <asp:Panel ID="SearchCriteriaPanel" runat="Server">
                                                <div id="SUIdDiv" class="outerBox pTop5 col-md-3" runat="server" visible="false">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="SUIdLabel" runat="server" Text="SU Id"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:TextBox ID="SUIdTextBox" runat="server" SkinID="CustomWidthTextBox"
                                                            AutoPostBack="true" MaxLength="50" OnTextChanged="SUIdTextBox_TextChanged"></asp:TextBox>
                                                    </div>
                                                </div>

                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="OrganizationLabel" Text="Organization" runat="server" SkinID="MandatoryLabel"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:DropDownList ID="OrganizationDropDownList" runat="server" onmouseleave="showHideTooltip()"
                                                            onmouseenter="showHideTooltip()" AutoPostBack="true" SkinID="CustomWidthDropDownList"
                                                            class="form-control" OnSelectedIndexChanged="OrganizationDropDownList_OnSelectedIndexChanged">
                                                        </asp:DropDownList>
                                                    </div>
                                                </div>
                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="BatchLable" Text="Batch" runat="server" SkinID="MandatoryLabel"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:DropDownList ID="BatchDropDownList" runat="server" onmouseleave="showHideTooltip()"
                                                            onmouseenter="showHideTooltip()" SkinID="CustomWidthDropDownList" class="form-control">
                                                        </asp:DropDownList>
                                                    </div>
                                                </div>
                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="SourceTypeLabel" runat="server" Text="Source Type" SkinID="MandatoryLabel"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:DropDownList runat="server" ID="SourceTypeDropDownList" SkinID="CustomWidthDropDownList"
                                                            class="form-control" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                            AutoPostBack="true" OnSelectedIndexChanged="SourceTypeDropDownList_OnSelectedIndexChanged">
                                                            <asp:ListItem Text="-Select-" Value="-1"></asp:ListItem>
                                                            <asp:ListItem Text="Student" Value="2001" Selected="True"></asp:ListItem>
                                                            <asp:ListItem Text="Employee" Value="95"></asp:ListItem>
                                                            <asp:ListItem Text="Other" Value="3"></asp:ListItem>
                                                        </asp:DropDownList>
                                                        <asp:HiddenField ID="DetailHiddenField" runat="server" />
                                                        <asp:HiddenField ID="DeleteHiddenField" runat="server" />
                                                    </div>
                                                </div>

                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="SourceCodeLabel" runat="server" Text="ID No"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5  display-flex">
                                                        <asp:TextBox ID="SourceCodeTextBox" SkinID="CustomWidthTextBox" runat="server"
                                                            MaxLength="200" AutoPostBack="true" OnTextChanged="SourceCodeTextBox_TextChanged"> 
                                                        </asp:TextBox>
                                                        <asp:ImageButton SkinID="FindImage" ToolTip="ID Search" ID="SourceCodeImageButton"
                                                            runat="server" ImageUrl="../../Images/icons/icon_find.gif" />
                                                        <asp:HiddenField ID="SourceIdHiddenField" runat="server" />
                                                    </div>
                                                </div>
                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="GuestNameLabel" runat="server" Text="Name" SkinID="MandatoryLabel"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:TextBox ID="GuestNameTextBox" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                            SkinID="CustomWidthTextBox" Width="250px" runat="server" MaxLength="200"> </asp:TextBox>
                                                    </div>
                                                </div>
                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="ClassLabel" runat="server" Text="Class / Dept."></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:TextBox ID="ClassTextBox" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                            SkinID="CustomWidthTextBox" runat="server" MaxLength="200"> </asp:TextBox>
                                                    </div>
                                                </div>

                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="ReceiptBookLabel" runat="server" Text="Receipt Book" SkinID="MandatoryLabel"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:DropDownList runat="server" ID="ReceiptBookDropDownList" SkinID="CustomWidthDropDownList"
                                                            class="form-control" AutoPostBack="true" OnSelectedIndexChanged="ReceiptBookDropDownList_OnSelectedIndexChanged">
                                                        </asp:DropDownList>
                                                    </div>
                                                </div>
                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="ChargeCategoryLabel" runat="server" Text="Charge Category"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:DropDownList runat="server" ID="ChargeCategoryDropDownList" SkinID="CustomWidthDropDownList"
                                                            class="form-control" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                            AutoPostBack="true" OnSelectedIndexChanged="ChargeCategoryDropDownList_OnSelectedIndexChanged">
                                                        </asp:DropDownList>
                                                    </div>
                                                </div>

                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="ReceiptNumberLabel" runat="server" Text="Receipt Number"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <div class="fLeft pRight5">
                                                            <asp:TextBox ID="ReceiptNumberTextBox" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                                SkinID="CustomWidthTextBox" runat="server" MaxLength="9" onkeypress="javascript:return isNumberKey(this)"> </asp:TextBox>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="ReceiptDateLabel" runat="server" Text="Receipt Date" Visible="True"
                                                            SkinID="MandatoryLabel"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <Date:DatePickerControl DisplayDatePicker="true" ID="ReceiptDatePickerControl" Visible="True"
                                                            runat="server" Enabled="false" />
                                                    </div>
                                                </div>

                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="PayTypeLabel" runat="server" Text="Pay Type" SkinID="MandatoryLabel"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:DropDownList runat="server" ID="PayTypeDropDownList" SkinID="CustomWidthDropDownList"
                                                            class="form-control" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                            AutoPostBack="true" OnSelectedIndexChanged="PayTypeDropDownList_OnSelectedIndexChanged">
                                                        </asp:DropDownList>
                                                    </div>
                                                </div>
                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="ChequeNoLabel" runat="server" Text="Cheque No"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:TextBox ID="ChequeNoTextBox" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                            SkinID="CustomWidthTextBox" runat="server" MaxLength="20"> </asp:TextBox>
                                                    </div>
                                                </div>
                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="Label2" runat="server" Text="Cheque Date"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <Date:DatePickerControl ID="ChequeatePickerControl" DisplayDatePicker="true"
                                                            runat="server"></Date:DatePickerControl>
                                                    </div>
                                                </div>
                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="BankLabel" runat="server" Text="Bank Name"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5 display-flex">
                                                        <acc:AutoCompleteControl ID="BankTextBox" runat="server" MinimumPrefixLength="2"
                                                            TabIndex="1" ValidateOnTextChanged="false" ContextKey="sFinanceCommon.Bank"
                                                            DisplayLoadingStatus="true" FirstRowSelected="false" MaxLength="200" AutoPostBack="true" />
                                                        <asp:ImageButton ID="BankSearchButton" runat="server" SkinID="FindImage" ToolTip="Bank Name Search"
                                                            TabIndex="2" OnClick="BankSearchButton_OnClick" meta:resourcekey="BankSearchButtonResource1"
                                                            ImageUrl="../../Images/icons/icon_find.gif" />
                                                    </div>
                                                </div>
                                                <div class="cBoth"></div>
                                                <div class="outerBox pTop5 col-md-3">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="RemarkLabel" runat="server" Text="Remark" meta:resourcekey="CodeSearchLabelResource1"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:TextBox ID="RemarkTextBox" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                            SkinID="MultiLineTextBox" Width="300px" TextMode="MultiLine" Height="40px" runat="server"
                                                            MaxLength="200"> </asp:TextBox>
                                                    </div>
                                                </div>
                                                <div class="outerBox pTop5 col-md-3" runat="server" visible="false" id="DeleteRemarkDiv">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="DeleteRemarkLabel" runat="server" Text="Delete Remark"
                                                            meta:resourcekey="CodeSearchLabelResource1"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:TextBox ID="DeleteRemarkTextBox" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                            SkinID="MultiLineTextBox" Width="300px" TextMode="MultiLine" Height="40px" runat="server"
                                                            MaxLength="200"> </asp:TextBox>
                                                    </div>
                                                </div>
                                                <div class="outerBox pTop5 col-md-3" id="CancelRemarkDiv" runat="server" visible="false">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="CancelRemarkLabel" runat="server" Text="Cancel Remark"
                                                            meta:resourcekey="DepositedLedgerLabelResource1"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:TextBox ID="CancelRemarkTextBox" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                            SkinID="MultiLineTextBox" Width="250px" TextMode="MultiLine" Height="40px" runat="server"
                                                            MaxLength="200"> </asp:TextBox>
                                                    </div>
                                                </div>
                                                <div class="outerBox pTop5 col-md-3" visible="false" id="canceldiv" runat="server">
                                                    <div class="fLeft pRight5">
                                                        <asp:Label ID="IsRecieptCancelLabel" runat="server" Text="Cancelled" Font-Bold="true"
                                                            Font-Size="Medium" ForeColor="Red"></asp:Label>
                                                    </div>
                                                </div>
                                                <div class="cBoth pTop15"></div>

                                            </asp:Panel>

                                            <div id="Div1" class="himssuHeader6WireBox pTop5" runat="server" visible="false">
                                                <div class="himsBoxHeader" id="GridViewPagerDiv" runat="server" visible="True">
                                                    <div class="leftdiv">
                                                    </div>
                                                    <div class="himsBoxTitle">
                                                        <%-- <div class="gridHeaderText">
                                                            <header>
                                                                <asp:Label ID="GridViewLabel" Text="Available Charge Receipt Detail List" runat="server" />
                                                            </header>
                                                        </div>--%>
                                                    </div>
                                                </div>
                                                <div class="himsBoxContent box-body box-danger gridviewfont table-responsive">
                                                    <asp:GridView ID="ChargeReceiptGridView" runat="server" Width="100%" AutoGenerateColumns="False"
                                                        EmptyDataText="No Records Found !!" AllowPaging="false" ShowHeader="true" DataKeyNames="ChargeReceiptId,ChargeId,DetailRemark,ChargeAmount,Amount"
                                                        CssClass="table table-striped table-bordered table-hover" ShowFooter="true" OnRowDataBound="ChargeReceiptGridView_RowDataBound">
                                                        <Columns>
                                                            <asp:TemplateField HeaderText="Name" ItemStyle-Width="30%" ItemStyle-Wrap="true"
                                                                HeaderStyle-HorizontalAlign="Left">
                                                                <ItemTemplate>
                                                                    <asp:Label ID="NameLabel" runat="server" Text='<%# Bind("Title") %>'></asp:Label>
                                                                </ItemTemplate>
                                                                <FooterTemplate>
                                                                    <asp:Label ID="TotalLabel" runat="server" Text="Total :" Style="font-weight: bold; float: right;"></asp:Label>
                                                                </FooterTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Remark" ItemStyle-Width="33%" ItemStyle-Wrap="true"
                                                                HeaderStyle-HorizontalAlign="Left">
                                                                <ItemTemplate>
                                                                    <asp:TextBox ID="DetailRemarkTextBox" onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                                        SkinID="MultiLineTextBox" Width="300px" runat="server" MaxLength="200" Text='<%# Bind("DetailRemark") %>'> </asp:TextBox>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Amount" ItemStyle-Width="15%" ItemStyle-Wrap="true"
                                                                HeaderStyle-HorizontalAlign="Left">
                                                                <ItemTemplate>
                                                                    <asp:TextBox ID="AmountTextBox" runat="server" Width="60px" Text='<%# DataBinder.Eval(Container.DataItem,"Amount").ToString()=="0"? "0.00":Eval("Amount") %>'
                                                                        MaxLength="13" onblur="javascript:return fnValidateDecimal(this,10,2)" onKeypress="javascript:return MaskDecimal(event,10,2)" onkeyup="fCalculation()"></asp:TextBox>
                                                                </ItemTemplate>
                                                                <FooterTemplate>
                                                                    <asp:Label ID="TotalAmountLabel" runat="server" Style="font-weight: bold;"></asp:Label>
                                                                </FooterTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField ShowHeader="true" HeaderText="Delete">
                                                                <ItemTemplate>
                                                                    <asp:ImageButton SkinID="DeleteImage" ID="DeleteImageButton" runat="server" OnClick="DeleteImageButton_Click"
                                                                        ImageUrl="~/Images/icons/icon_delete.gif" ToolTip="Delete" />
                                                                </ItemTemplate>
                                                                <ItemStyle HorizontalAlign="Center" Width="7%" />
                                                            </asp:TemplateField>
                                                        </Columns>
                                                        <PagerSettings Visible="False" />
                                                    </asp:GridView>
                                                </div>
                                            </div>
                                        </div>
                                    </asp:Panel>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </ContentTemplate>
    </asp:UpdatePanel>
    <%--  <script data-main="../../JavaScript/rjs/encrypt/charge-receipt-encrypt" src="../../JavaScript/rjs/require.js"></script>--%>
    <script data-main='<%=ResolveUrl("~/JavaScript/rjs/charge-receipt")%>' src='<%=ResolveUrl("~/JavaScript/rjs/require.js")%>'></script>
    <script type="text/javascript">
        //Changes for Mantis Id:0042044
        window.name = "ChargeReceiptTab";
        window.onload = function () {
            CheckDuplicateTab();
        };

        function CheckDuplicateTab() {
            localStorage.chargereceipttab = Date.now();
            var onLocalStorageEvent = function (e) {
                if (e.key == "chargereceipttab") {
                    // Listen if anybody else opening the same page!
                    localStorage.chargereceipttab_available = Date.now();
                }
                if (e.key == "chargereceipttab_available" && window.name == "ChargeReceiptTab") {
                    alert("One more page already open");
                    window.location = '/Pages/Baseframework/MyDashBoard.aspx';
                }
            };
            window.addEventListener('storage', onLocalStorageEvent, false);
        }

        function fCalculation() {
            var table = document.getElementById('ctl00_CP_ChargeReceiptGridView');
            var sum = 0;
            for (var i = 0; i < table.rows.length - 1; i++) {
                if (!isNaN(table.rows[i].cells[2].innerText)) {
                    PayableAmount = parseFloat(table.rows[i].cells[2].childNodes[1].value);
                    if (!isNaN(PayableAmount))
                        sum = (parseFloat(sum) + PayableAmount).toString();
                }
            }

            table.rows[table.rows.length - 1].cells[1].innerText = sum;
        }
    </script>
</asp:Content>
