<%@ page language="C#" masterpagefile="~/MasterFile/TimeCheck.master" autoeventwireup="true" inherits="Transactions_TA_UI_Transaction_EncashmentModify, App_Web_pqycbfjj" %>

<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPH" runat="Server">

    <script language="javascript" type="text/javascript" src="../js/EmployeeEncashment.js"></script>

    <script language="javascript" type="text/javascript">

        var NoofDaysApply = "Number Of Days Applied Should Not be Empty";
        var ReasonNotEmpty = "Reason Should Not be Empty";
        var NoofDaysShouldNot = "Number Of Days Applied Should be lesser than Remaining number of Days";
        var Confirm = "Are you sure to, Save?";
        var Invalid = "Number Of Days entered is not valid";
        var MaxLength = "Maximum length is ";


        function MaxLengthh(maxLength) {

            MaxLength = maxLength;
        }
        function SetAlertMessages(NoofDaysapply, reasonNotEmpty, noofDaysShouldNot, confirm, invalid) {


            NoofDaysApply = NoofDaysapply;
            ReasonNotEmpty = reasonNotEmpty;
            NoofDaysShouldNot = noofDaysShouldNot;
            Confirm = confirm;
            Invalid = invalid;

        }
        function encashmentValidation() {

            if (document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value == "") {
                alert(NoofDaysApply);
                return false;
            }
            else if (document.getElementById('ctl00_BodyContentPH_txtReason').value == "") {
                alert(ReasonNotEmpty);
                return false;
            }
            else {
                if (document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value != "") {
                    var vNoOfDays = document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value % 0.5;
                    if (vNoOfDays == 0) {
                        if (parseFloat(document.getElementById('ctl00_BodyContentPH_txt_Numberofdays').value) > parseFloat(document.getElementById('ctl00_BodyContentPH_hdnRemainingNoOfDays').value)) {
                            alert(NoofDaysShouldNot);
                            return false;
                        }
                        else {
                            return confirm(Confirm);
                        }
                    }
                    else {
                        alert(Invalid);
                        return false;
                    }
                }

            }
        }

    </script>

    <div class="content-header">
        <h1 style="background-image: url('../dist/img/encashment.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lbl_Header" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <div class="exda-table">
            <h6>
                <span style="color: Red">|</span><asp:Label ID="lbl_IndicatesMandatoryFields" runat="server"></asp:Label>(2 No.)</h6>
            <asp:Label ID="lbl_Error" runat="server" Style="color: #ff0000"></asp:Label>
            <input id="Hidden1" type="hidden" value='<% Response.Write(Convert.ToString(Session["IDateFormat"])); %>' />
        </div>
        <div class="emp-filter">
            <div class="row">
                <div class="form-horizontal">
                    <input id="hdnRemainingNoOfDays" runat="server" type="hidden" />
                    <input id="hdnNumberOfDays" runat="server" type="hidden" />
                    <div class="col-md-12">
                        <div class="row form-group" id="divEmployees" runat="server">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Code" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lbl_EmpCode" runat="server" CssClass="form-control"></asp:Label>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Name" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lbl_EmpName" runat="server" CssClass="form-control"></asp:Label>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_LeaveType" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lblLeaveTypeData" runat="server" CssClass="form-control"></asp:Label>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Nodays" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lblRemainingNoOfDaysData" runat="server" CssClass="form-control"></asp:Label>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Numberofdaysapp" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox ID="txt_Numberofdays" runat="server" CssClass="form-control mandatory"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txt_Numberofdays"
                                    SetFocusOnError="True" ErrorMessage="Enter Number of Days applied" Display="none">*</asp:RequiredFieldValidator>
                                <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txt_Numberofdays"
                                    ErrorMessage="Number of Days should between 1 and 365" MaximumValue="365" MinimumValue="0.5"
                                    SetFocusOnError="True" Type="Double">*</asp:RangeValidator>
                            </div>


                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Reason" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txtReason" runat="server" CssClass="form-control mandatory" style="resize:none"
                                    onkeypress="return chkMaxLen(event,this,50,MaxLength);" MaxLength="50" TextMode="MultiLine"></asp:TextBox>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-2">
                            </div>
                            <div class="col-md-9">
                                <div class="pull-right-button">
                                    <asp:LinkButton ID="btn_Save" runat="server" CssClass="btn save-btn fa-floppy-o" OnClientClick="if(Page_ClientValidate()) return encashmentValidation();return false;"
                                        OnClick="btn_Save_Click" />
                                    <asp:LinkButton ID="btn_Back" runat="server" CausesValidation="False" CssClass="btn save-btn fa-angle-left"
                                        OnClick="btn_Back_Click" />
                                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
                                        ShowSummary="False" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


</asp:Content>
