<%@ page autoeventwireup="true" enableeventvalidation="false" inherits="Transactions_TA_UI_Transactions_ManualTimeEntryAdd, App_Web_wkbzzo43" language="C#" masterpagefile="~/MasterFile/TimeCheck.master" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPH" runat="server">
    <!--[if gt IE 5.5]>
	<link rel="stylesheet" type="text/css" href="../css/ProgressforIE.css" />
	<link rel="stylesheet" type="text/css" href="../css/anytimeIE.css" />
<![endif]-->

    <script src="../plugins/datepicker/jquery-1.11.1.min.js"></script>

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

    <script src="../plugins/datepicker/bootstrap-datepicker.js"></script>

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

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

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

    <script>
        $(function () {
            $('#ctl00_BodyContentPH_txt_InDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
        $(function () {
            $('#ctl00_BodyContentPH_txt_OutDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
        $(function () {
            $('#ctl00_BodyContentPH_txt_ShiftIn').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden2').value }
            );
        });
        $(function () {
            $('#ctl00_BodyContentPH_txt_ShiftOut').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden2').value }
            );
        });
    </script>

    <script type="text/javascript">
        function LoadDate(ID) {
            $(document).ready(function () {
                $(ID).datepicker({
                    // your options...
                }).datepicker("show");
            });
        }
    </script>

    <script type="text/javascript" language="javascript">
        //values for check date
        var Monthfourdigit = 'Please enter valid date as month, day, and four digit year : Format MM/dd/yyyy.';
        //Adding this line var Datefourdigit='Please enter valid date with correct format dd/MM/yyyy'; as newly
        var Datefourdigit = 'Please enter valid date with correct format dd/MM/yyyy';
        var Invalidyearentry = 'Invalid year entry';
        var Invalidmonthentry = 'Invalid month entry';
        var Invaliddateentry = 'Invalid date entry';
        var DateformatDDMONYYYY = 'Incorrect date format. Enter as DD-MON-YYYY';
        var Entertime = 'Enter time';
        var Valueforhours = 'Invalid value for hours:';
        var Invalidvalueforminutes = 'Invalid value for minutes:';
        var Invalidtimeformat = 'Invalid time format:';
        var EntervalidDateandTime = 'Please enter valid Date and Time';
        var ValiddatemonthMMDDYYHHMM = 'Please enter valid Date and Time MM/dd/yyyy HH:mm';
        var ValiddatemonthMMDDYYHHMMTT = 'Please enter valid Date and Time MM/dd/yyyy hh:mm tt';
        var EntervalidDateandTime = 'Please enter valid Date and Time';
        var Invalidvalueforhours = 'Invalid value for hours:';
        var Invalidvalueforminites = 'Invalid value for minutes:';
        var InvalidTime = "Invalid time.";
        var InvalidTimeFormat = "Invalid Time Format";
        var InValidHour = "Invalid time. Hours can not be more than 24.";
        var Invalidtime = "Invalid time. Minute can not be more than 59.";
        var SelTerminal = "Select In Terminal";
        var SelPunchTypes = "Select In PunchTypes";
        var FillIndate = "Fill In Date";
        var FillInTime = "Fill In Time";
        var SelOutTerminal = "Select Out Terminal";
        var RouteName = "Select Route Name";
        var InTimeCorrectFormat = "Enter InTime in correct Format";
        var OutTimeFormat = "Enter valid time format";
        var ConfirmSave = "Are you sure to, Save?";
        var FillOutDate = "Fill Out Date";
        var FillOutTime = "Fill Out Time";
        var SelectInDate = "Select InDate";
        var SelecttheRouteName = "Select the Route Name";
        var NoRecords = "No Records";
        var Errorinretrivingdetails = "Error in retriving details";
        var SelectEntranceID = "Select Entrance ID";
        var SelectOutPunchType = "Select Out Punch Type";
        var MaxLength = "Maximum length is ";
        var Select = "-Select-";
        var ValidateInOutDate = "Enter Either InDate and InTime (or) OutDate and OutTime (or) Both";
        var EntertheEmployeeID = "Enter the Employee ID";
        var SelectEntranceName = "Select Entrance Name";
        var EnterReason = "Enter Reason";
        function MaxLengthh(maxLength, select) {
            MaxLength = maxLength;
            Select = select;
        }
        function SetAlertCheckDate(monthfourdigit, datefourdigit, invalidyearentry, invalidmonthentry, invaliddateentry, dateformatDDMONYYYY, entertime, valueforhours, invalidvalueforminutes, invalidtimeformat, entervalidDateandTime, validdatemonthMMDDYYHHMM, validdatemonthMMDDYYHHMMTT, entervalidDateandTime, invalidvalueforhours, invalidvalueforminites) {
            Monthfourdigit = monthfourdigit;
            Datefourdigit = datefourdigit;
            Invalidyearentry = invalidyearentry;
            Invalidmonthentry = invalidmonthentry;
            Invaliddateentry = invaliddateentry;
            DateformatDDMONYYYY = dateformatDDMONYYYY;
            Entertime = Entertime;
            Valueforhours = valueforhours;
            Invalidvalueforminutes = invalidvalueforminutes;
            Invalidtimeformat = invalidtimeformat;
            EntervalidDateandTime = entervalidDateandTime;
            ValiddatemonthMMDDYYHHMM = validdatemonthMMDDYYHHMM;
            ValiddatemonthMMDDYYHHMMTT = validdatemonthMMDDYYHHMMTT;
            EntervalidDateandTime = entervalidDateandTime;
            Invalidvalueforhours = invalidvalueforhours;
            Invalidvalueforminites = invalidvalueforminites;
        }
        function SetAlertMessages(invalidTime, TimeFormat, HourInvalid, timeInvalid, Terminal, PunchTypes, InDate, InTime, OutTerminal, Route, CorrectFormat, TimeFormat, SaveConfirm, OutDate, OutTime, selectInDate, selecttheRouteName, noRecords, errorinretrivingdetails, selectEntranceID, selectOutPunchType, entertheEmployeeID, selectEntranceName, enterReason) {
            InvalidTime = invalidTime;
            InvalidTimeFormat = TimeFormat;
            InValidHour = HourInvalid;
            Invalidtime = timeInvalid;
            SelTerminal = Terminal;
            SelPunchTypes = PunchTypes;
            FillIndate = InDate;
            FillInTime = InTime;
            SelOutTerminal = OutTerminal;
            RouteName = Route;
            InTimeCorrectFormat = CorrectFormat;
            FormatTime = TimeFormat;
            ConfirmSave = SaveConfirm;
            FillOutDate = OutDate;
            FillOutTime = OutTime;
            SelectInDate = selectInDate;
            SelecttheRouteName = selecttheRouteName;
            NoRecords = noRecords;
            Errorinretrivingdetails = errorinretrivingdetails;
            SelectEntranceID = selectEntranceID;
            SelectOutPunchType = selectOutPunchType;
            EntertheEmployeeID = entertheEmployeeID;
            SelectEntranceName = selectEntranceName;
            EnterReason = enterReason;
        }
        function ValidateTime(inIntime) {
            var keyValue;
            if (window.event) {
                keyValue = window.event.keyCode;
            }
            else if (inIntime) {
                keyValue = inIntime.which
            }
            else {
                return true;
            }
            if ((keyValue > 47 && keyValue < 58) || (keyValue >= 96 && keyValue <= 105) || (keyValue >= 32 && keyValue <= 40) || (keyValue >= 16 && keyValue <= 20) || (keyValue == 8) || (keyValue == 0) || (keyValue == 46)) {
                var InTime;
                var val = inIntime.value;
                if ((keyValue > 47 && keyValue < 58) || (keyValue >= 96 && keyValue <= 105)) {
                    if (val.length >= 2 && val.length < 5) {
                        if (val.search(":") == -1) {
                            InTime = val.substring(0, 2) + ":" + val.substring(2, 5);
                            inIntime.value = InTime;
                            return (inIntime.value);
                        }
                    }
                    if (val.length > 5) {
                        alert(InvalidTime);
                        insertAtCursor(inIntime, "0", "min");
                        return false;
                    }
                }
                if (keyValue == 0) {
                    if (val.length < 5) {
                        if (val.length == 4) {
                            if (val.search(":") == -1) {
                                InTime = val.substring(0, 2) + ":" + val.substring(2, 5);
                                inIntime.value = InTime;
                                return (inIntime.value);
                            }
                            else {
                                insertAtCursor(inIntime, "0", "first");
                                alert(InvalidTimeFormat);
                                return false;
                            }
                        }
                        else {
                            insertAtCursor(inIntime, "0", "first");
                            alert(InvalidTimeFormat);
                            return false;
                        }
                    }
                    if (val.length >= 2) {
                        var Hourval = val.substring(0, 2);
                        if (Hourval > 24) {
                            alert(InValidHour);
                            insertAtCursor(inIntime, "0", "hrs");
                            return false;
                        }
                        if (val.substring(0, 2) == "24") {
                            inIntime.value = "00" + val.substring(2, 5);
                        }
                        if (val.search(":") == -1) {
                            InTime = val.substring(0, 2) + ":" + val.substring(2, 5);
                            inIntime.value = InTime;
                            return (inIntime.value);
                        }
                    }
                    if (val.length == 5) {
                        var Minuteval = val.substring(3, 5);
                        if (parseFloat(Minuteval) > 59) {
                            alert(Invalidtime);
                            insertAtCursor(inIntime, "0", "min");
                            return false;
                        }
                    }
                }
                if (val.length == 2) {
                    if (val.substring(0, 1) == ":") {
                        InTime = val.substring(1, 2) + ":";
                        inIntime.value = InTime;
                        return (inIntime.value);
                    }
                    else if (val.substring(1, 2) == ":") {
                        InTime = val.substring(0, 1) + ":";
                        inIntime.value = InTime;
                        return (inIntime.value);
                    }
                }
                else {
                    return (inIntime.value);
                }
            }
            else {
                inIntime.value = "";
                return (inIntime.value);
            }
        }
        function insertAtCursor(myField, myValue, myType) {
            //IE support
            if (document.selection) {
                myField.focus();
                sel = document.selection.createRange();
            }
                //MOZILLA/NETSCAPE support
            else if (myField.selectionStart || myField.selectionStart == '0') {
                var startPos = myField.selectionStart;
                var endPos = myField.selectionEnd;
                myField.value = myField.value.substring(0, startPos)
                + myField.value.substring(endPos, myField.value.length);
            }
            else {
                myField.value += myValue;
            }
            if (myType == "hrs") {
                setCaretPosition(myField, 2);
            }
            if (myType == "min") {
                setCaretPosition(myField, 3);
            }
            if (myType == "first") {
                setCaretPosition(myField, 0);
            }
        }
        function setCaretPosition(ctrl, pos) {
            if (ctrl.setSelectionRange) {
                ctrl.focus();
                ctrl.setSelectionRange(pos, pos);
            }
            else if (ctrl.createTextRange) {
                var range = ctrl.createTextRange();
                range.collapse(true);
                range.moveEnd('character', pos);
                range.moveStart('character', pos);
                range.select();
            }
        }
        function show() {
            if (document.aspnetForm.ctl00_BodyContentPH_rbtSingle.checked == true) {
                document.getElementById("div_Employee").style.display = "block";
                document.getElementById("div_Route").style.display = "none";
                document.getElementById("divGroupEntryType").style.display = "none";
                document.getElementById("divEmployees").style.display = "none";
                document.getElementById("divGroupEmployees").style.display = "none";
                document.aspnetForm.ctl00_BodyContentPH_txt_EmployeeId.focus();
            }
            else if (document.aspnetForm.ctl00_BodyContentPH_rbtGroup.checked == true) {
                document.getElementById("divGroupEntryType").style.display = "block";
                document.getElementById("div_Employee").style.display = "none";
                if (document.aspnetForm.ctl00_BodyContentPH_rbtBusLate.checked == true) {
                    document.getElementById("div_Route").style.display = "block";
                    document.getElementById("divEmployees").style.display = "none";
                }
            }
        }
        function show1() {
            if (document.aspnetForm.ctl00_BodyContentPH_rbtGroup.checked == true) {
                document.getElementById("divGroupEntryType").style.display = "block";
                document.aspnetForm.ctl00_BodyContentPH_rbtBusLate.checked = true;
                document.getElementById("div_Route").style.display = "block";
                document.getElementById("divEmployees").style.display = "none";
                document.getElementById("div_Employee").style.display = "none";
            }
        }
        function showGroupEntry() {
            if (document.aspnetForm.ctl00_BodyContentPH_rbtGroup.checked == true) {
                document.getElementById("divGroupEmployees").style.display = "block";
                document.getElementById("divEmployees").style.display = "none";
                document.getElementById("div_Employee").style.display = "none";
                document.getElementById("divGroupEntryType").style.display = "none";
                document.getElementById("ctl00_BodyContentPH_GroupEmployeeGrid").style.display = "block";
            }
            else {
                document.getElementById("divGroupEmployees").style.display = "none";
                document.getElementById("divEmployees").style.display = "none";
                document.getElementById("div_Employee").style.display = "block";
                if (document.getElementById("ctl00_BodyContentPH_grv_EmployeesGroup") != null) {
                    document.getElementById("ctl00_BodyContentPH_grv_EmployeesGroup").outerHTML = "";
                }
                document.getElementById("divGroupEntryType").style.display = "none";
                document.getElementById("ctl00_BodyContentPH_GroupEmployeeGrid").style.display = "none";
            }
        }
        function FillInPunchTypeHidden() {
            var InPunchType;
            var InPunchTypeSelectedIndex = document.aspnetForm.ctl00_BodyContentPH_ddlInPunchTypes.selectedIndex;
            InPunchType = document.aspnetForm.ctl00_BodyContentPH_ddlInPunchTypes.options[InPunchTypeSelectedIndex].value;
            document.aspnetForm.ctl00_BodyContentPH_hdn_InPunchType.value = InPunchType;
        }
        function FillOutPunchTypeHidden() {
            var OutPunchType;
            var OutPunchTypeSelectedIndex = document.aspnetForm.ctl00_BodyContentPH_ddlOutPunchTypes.selectedIndex;
            OutPunchType = document.aspnetForm.ctl00_BodyContentPH_ddlOutPunchTypes.options[OutPunchTypeSelectedIndex].value;
            document.aspnetForm.ctl00_BodyContentPH_hdn_OutPunchType.value = OutPunchType;
        }
        function ClearInDate() {
            document.aspnetForm.ctl00_BodyContentPH_txt_InDate.value = "";
            return false;
        }
        function ClearInTime() {
            document.aspnetForm.ctl00_BodyContentPH_txt_ShiftIn.value = "";
            return false;
        }
        function ClearOutDate() {
            document.aspnetForm.ctl00_BodyContentPH_txt_OutDate.value = "";
            return false;
        }
        function ClearOutTime() {
            document.aspnetForm.ctl00_BodyContentPH_txt_ShiftOut.value = "";
            return false;
        }
        function ManualEntryValidation() {
            var ShiftIn = document.aspnetForm.ctl00_BodyContentPH_txt_ShiftIn.value;
            var InDate = document.aspnetForm.ctl00_BodyContentPH_txt_InDate.value;
            var InTerminals = document.aspnetForm.ctl00_BodyContentPH_ddlInTerminals.selectedIndex;
            var InPunchTypes = document.aspnetForm.ctl00_BodyContentPH_ddlInPunchTypes.selectedIndex;
            var weekDay = document.aspnetForm.ctl00_BodyContentPH_txt_InDate;
            var weekDay2 = document.aspnetForm.ctl00_BodyContentPH_txt_OutDate;
            var DateFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
            var txt_EmployeeId = document.getElementById('ctl00_BodyContentPH_txt_EmployeeId');
            var ddlEntranceName = document.getElementById('ctl00_BodyContentPH_ddlEntranceName');
            var txt_Reason = document.getElementById('ctl00_BodyContentPH_txt_Reason');
            var rangeDemoFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
            if (rangeDemoFormat == 'DD-MMM-YYYY') {
                var Earlier = "01-Jan-1900"; var Final = "31-Dec-9999";
            }
            else {
                var Earlier = "01/01/1900"; var Final = "12/31/9999";
            }
            var rangeDemoFormats = document.getElementById('ctl00_BodyContentPH_hiddenTime').value;
            if (document.getElementById('ctl00_BodyContentPH_rbtSingle').checked == true) {
                if (txt_EmployeeId.value.length == 0) {
                    alert(EntertheEmployeeID);
                    document.getElementById('ctl00_BodyContentPH_txt_EmployeeId').focus();
                    return false;
                }
            }
            if (document.getElementById('ctl00_BodyContentPH_txt_InDate').value == "" && document.getElementById('ctl00_BodyContentPH_txt_ShiftIn').value == "" && document.getElementById('ctl00_BodyContentPH_txt_OutDate').value == "" && document.getElementById('ctl00_BodyContentPH_txt_ShiftOut').value == "") {
                alert(ValidateInOutDate);
                document.getElementById('ctl00_BodyContentPH_txt_InDate').focus();
                return false;
            }
            if (ddlEntranceName.options[ddlEntranceName.selectedIndex].value == "-Select-") {
                alert(SelectEntranceName);
                return false;
            }
            if (ShiftIn != "" || InDate != "") {
                if (InPunchTypes == 0) {
                    alert(SelPunchTypes);
                    document.aspnetForm.ctl00_BodyContentPH_ddlInPunchTypes.focus();
                    return false;
                }
                if (ShiftIn != "") {
                    if (InDate == "") {
                        alert(FillIndate);
                        document.aspnetForm.ctl00_BodyContentPH_txt_InDate.focus();
                        return false;
                    }
                    else {
                        if (checkDate(weekDay, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)) {
                        }
                        else {
                            return false;
                        }
                    }
                }
                if (InDate != "") {
                    if (ShiftIn == "") {
                        alert(FillInTime);
                        document.aspnetForm.ctl00_BodyContentPH_txt_ShiftIn.focus();
                        return false;
                    }
                }
                if (weekDay2.value != '') {
                    if (checkDate(weekDay2, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)) {
                    }
                    else {
                        return false;
                    }
                }
            }
            var ShiftOut = document.aspnetForm.ctl00_BodyContentPH_txt_ShiftOut.value;
            var OutDate = document.aspnetForm.ctl00_BodyContentPH_txt_OutDate.value;
            var OutTerminals = document.aspnetForm.ctl00_BodyContentPH_ddlOutTerminals.selectedIndex;
            var OutPunchTypes = document.aspnetForm.ctl00_BodyContentPH_ddlOutPunchTypes.selectedIndex;
            if (ShiftOut != "" || OutDate != "") {
                if (OutPunchTypes == 0) {
                    alert(SelectOutPunchType);
                    document.aspnetForm.ctl00_BodyContentPH_ddlOutPunchTypes.focus();
                    return false;
                }
                if (ShiftOut != "") {
                    if (OutDate == "") {
                        alert(FillOutDate);
                        document.aspnetForm.ctl00_BodyContentPH_txt_OutDate.focus();
                        return false;
                    }
                }
                if (OutDate != "") {
                    if (ShiftOut == "") {
                        alert(FillOutTime);
                        document.aspnetForm.ctl00_BodyContentPH_txt_ShiftOut.focus();
                        return false;
                    }
                }
            }
            if (txt_Reason.value.length == 0) {
                alert(EnterReason);
                document.getElementById('ctl00_BodyContentPH_txt_Reason').focus();
                return false;
            }
            if (txt_Reason.value.trim() == 0) {
                alert(EnterReason);
                document.getElementById('ctl00_BodyContentPH_txt_Reason').focus();
                return false;
            }
            if (document.aspnetForm.ctl00_BodyContentPH_rbtGroup.checked == true && document.aspnetForm.ctl00_BodyContentPH_rbtBusLate.checked == true) {
                var RouteName = document.aspnetForm.ctl00_BodyContentPH_ddlRouteName.selectedIndex;
                if (RouteName == 0) {
                    alert(SelecttheRouteName);
                    return false;
                }
            }
            var regExp = "^((([0]?[1-9]|1[0-2])(:|\.)[0-5][0-9]((:|\.)[0-5][0-9])?( )?(AM|am|aM|Am|PM|pm|pM|Pm))|(([0]?[0-9]|1[0-9]|2[0-3])(:|\.)[0-5][0-9]((:|\.)[0-5][0-9])?))$";
            var TimeFormat = document.getElementById('ctl00_BodyContentPH_Hidden2').value;
            var length = 0;
            if (TimeFormat != "LT") {
                length = 8;
                regExp = /^(0[1-9]|1[0-9]|2[0-3]):([0-5]\d):([0-5]\d)$/;
            }
            else {
                length = 8;
                regExp = /^(0[1-9]|1[012]):([0-5]\d)\s?(?:AM|PM)?$/i;
            }
            //            if (document.getElementById("<%=txt_ShiftIn.ClientID%>").value != "") {
            //                if (parseInt(document.getElementById("<%=txt_ShiftIn.ClientID%>").value.length) != length) {
            //                    document.getElementById("<%=txt_ShiftIn.ClientID%>").focus();
            //                    alert(InTimeCorrectFormat);
            //                    return false;
            //                }
            //                if (document.getElementById("<%=txt_ShiftIn.ClientID%>").value.search(regExp) == -1) {
            //                    document.getElementById("<%=txt_ShiftIn.ClientID%>").focus();
            //                    alert(InTimeCorrectFormat);
            //                    return false;
            //                }
            //            }
            //            if (document.getElementById("<%=txt_ShiftOut.ClientID%>").value != "") {
            //                if (parseInt(document.getElementById("<%=txt_ShiftOut.ClientID%>").value.length) != length) {
            //                document.getElementById("<%=txt_ShiftOut.ClientID%>").focus();
            //                    alert(OutTimeFormat);
            //                    return false;
            //                }
            //                if (document.getElementById("<%=txt_ShiftOut.ClientID%>").value.search(regExp) == -1) {
            //                document.getElementById("<%=txt_ShiftOut.ClientID%>").focus();
            //                    alert(OutTimeFormat);
            //                    return false;
            //                }
            //            }
            if (confirm(ConfirmSave) == true) {
                return true;
            }
            else {
                return false;
            }
        }
        function FillReason() {
            if (document.aspnetForm.ctl00_BodyContentPH_ddl_Reason.selectedIndex == 9) {
                document.aspnetForm.ctl00_BodyContentPH_txt_Reason.style.display = 'block';
                document.aspnetForm.ctl00_BodyContentPH_txt_Reason.style.visibility = 'visible';
               
            }
            else {
                document.aspnetForm.ctl00_BodyContentPH_txt_Reason.style.display = 'none';
                document.aspnetForm.ctl00_BodyContentPH_txt_Reason.style.visibility = 'hidden';
            }
            var txt_Reason = document.aspnetForm.ctl00_BodyContentPH_txt_Reason;
            txt_Reason.value = '';
            txt_Reason.value = (document.aspnetForm.ctl00_BodyContentPH_ddl_Reason.selectedIndex != 0) ?
                (document.aspnetForm.ctl00_BodyContentPH_ddl_Reason.selectedIndex == 9 ? document.aspnetForm.ctl00_BodyContentPH_ddl_Reason.value + ' - ' : document.aspnetForm.ctl00_BodyContentPH_ddl_Reason.value) : '';
            document.aspnetForm.ctl00_BodyContentPH_txt_Reason.focus();
        }
    </script>
    <div class="content-header">
        <h1 style="background-image: url('../dist/img/Att-code.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">
        <asp:UpdatePanel ID="upLeave" runat="server">
            <ContentTemplate>
                <asp:Panel ID="pnlProgress" runat="server" Style="display: none;">
                    <asp:Panel ID="pnlLoading" runat="server" HorizontalAlign="center">
                        <div class="InsideProgressBar">
                            <div class="row" style="margin-top: 10px">
                                <img src="../dist/img/logo-Progress.png" />
                            </div>
                            <div class="row" style="min-width: 280px">
                                <img src="../dist/img/default.gif" style="width: 100px" />
                            </div>
                            <div class="row" style="margin-bottom: 10px">
                                <asp:Label ID="lblLoading" runat="server" ForeColor="black" Style="text-align: center"
                                    Font-Bold="true" Font-Size="12px" Font-Italic="true" Font-Family="Arial" Text="Please Wait..."></asp:Label>
                            </div>
                            <div class="clear clearfix">
                            </div>
                        </div>
                    </asp:Panel>
                </asp:Panel>
                <asp:HiddenField ID="hdnProgress" runat="server" />
                <cc1:ModalPopupExtender ID="popupProgress" runat="server" TargetControlID="hdnProgress"
                    BackgroundCssClass="ModalPopup" PopupControlID="pnlProgress" BehaviorID="popupProgress">
                </cc1:ModalPopupExtender>
            </ContentTemplate>
        </asp:UpdatePanel>
        <div id="myModal" class="modal modal-default fade" role="dialog">
            <div class="modal-dialog" style="min-width: 85%;">
                <!-- Modal content-->
                <div class="modal-content" style="margin-top: 50px">
                    <div class="modal-header">
                        <button type="button" id="closemodal" class="close" data-dismiss="modal" style="border-radius: 50px;">
                            &times;</button>
                        <h4 class="modal-title">
                            <asp:Label ID="lblSelectEmployee" runat="server" Text="Select Employee"></asp:Label></h4>
                    </div>
                    <div class="modal-body">
                        <iframe id="iframePopup" runat="server" scrolling="auto" width="100%" height="700px"
                            style="border-style: none"></iframe>
                    </div>
                    <div class="modal-footer" style="display: none">
                        <button type="button" class="btn btn-primary pull-right" data-dismiss="modal">
                            Close</button>
                    </div>
                </div>
            </div>
        </div>
        <div class="inr-ftr">
            <div class="row">
                <div class="col-sm-12">
                    <div class="inr-fil-text pull-left">
                        <asp:Label ID="lblFilter" runat="server" Text="Filter"></asp:Label>
                    </div>
                    <div class="pull-right">
                        <h6>
                            <span style="color: Red">|</span><span style="padding-left: 10px; padding-right: 10px"><asp:Label
                                ID="lbl_IndicatesMandatoryFields" runat="server"></asp:Label>
                                (2 No.)</span>
                        </h6>
                    </div>
                    <div class="clearfix">
                    </div>
                </div>
            </div>
        </div>
        <div class="emp-filter">
            <div class="col-md-12" style="color: Red; display: none">
                <asp:Label ID="lbl_Error" runat="server" ForeColor="Red"></asp:Label>
            </div>
            <div class="form-horizontal">
                <div class="row">
                    <div class="col-md-12">
                        <div class="row" style="display: none">
                            <div class="col-md-12">
                                <asp:Label ID="lbl_TypeOfManualEntry" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-12">
                                <asp:RadioButton ID="rbtSingle" runat="server" GroupName="EntryType" onclick="showGroupEntry();"
                                    TabIndex="1" />
                                <asp:RadioButton ID="rbtGroup" runat="server" GroupName="EntryType" onclick="showGroupEntry();"
                                    Style="display: none" />
                            </div>
                        </div>
                        <div class="row" id="GroupEmployeeGrid" runat="server">
                            <div class="col-md-12">
                                <asp:GridView ID="grv_EmployeesGroup" CssClass="table table-responsive table-bordered"
                                    runat="server" AutoGenerateColumns="False" Width="100%" AllowPaging="true" PageSize="10"
                                    CellPadding="4" AutoGenerateDeleteButton="True" OnPageIndexChanging="grv_Employees_PageIndexChanging"
                                    OnRowDeleting="grv_Employees_RowDeleting">
                                    <Columns>
                                        <asp:TemplateField HeaderText="EmpId" Visible="false">
                                            <ItemTemplate>
                                                <itemstyle horizontalalign="Center" />
                                                <headerstyle horizontalalign="Center" />
                                                <asp:Label ID="lbl_EmpAutoId" Text='<%# Eval("EmpId")%>' runat="server"></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Employee Id">
                                            <ItemTemplate>
                                                <itemstyle horizontalalign="Center" />
                                                <headerstyle horizontalalign="Center" />
                                                <asp:Label ID="lbl_EmpId" Text='<%# Eval("EmployeeId")%>' runat="server"></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Employee Name">
                                            <ItemTemplate>
                                                <asp:Label ID="lbl_EmpName" Text='<%# Eval("EmployeeName")%>' runat="server"></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="LoginEmployeeId" Visible="false">
                                            <ItemTemplate>
                                                <itemstyle horizontalalign="Center" />
                                                <headerstyle horizontalalign="Center" />
                                                <asp:Label ID="lbl_LoginEmployeeId" Text='<%# Eval("LoginEmployeeId")%>' runat="server"></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>
                            </div>
                        </div>
                        <div id="divGroupEntryType" style="display: none">
                            <div class="row">
                                <div class="col-md-12">
                                    <asp:Label ID="lbl_GroupEntryType" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-12">
                                    <asp:RadioButton ID="rbtBusLate" runat="server" GroupName="GroupEntryType" onclick="show();"
                                        Checked="True" />
                                    <asp:RadioButton ID="rbtOnDuty" Visible="false" runat="server" GroupName="GroupEntryType"
                                        onclick="show();" />
                                </div>
                            </div>
                        </div>
                        <div id="divGroupEmployees" style="display: none">
                            <div class="row">
                                <div class="col-md-12">
                                    <asp:Label ID="lblGroupEntryEmployees" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-12">
                                    <asp:Button ID="btnGroupEmployees" CssClass="btn btn-primary" runat="server" OnClientClick="return OpenWindowGroupEntry();" />
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div id="div_Employee" style="display: none">
                                <div class="col-md-2">
                                    <asp:Label ID="lbl_EmployeeId" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <div class="input-group input-group-sm">
                                        <asp:TextBox onpaste="return true" ID="txt_EmployeeId" runat="server" CssClass="form-control man-dat"
                                            MaxLength="15" onblur="EmpName('ManualTimeEntry');" onkeypress="return acceptCharsNum_MaxLength(event,this,15,MaxLength);"></asp:TextBox>
                                        <span class="input-group-btn">
                                            <asp:LinkButton ID="btn_Search" data-toggle="modal" data-target="#myModal" CssClass="btn save-btn btn-flat fa fa-search"
                                                runat="server" OnClientClick="return OpenWindowShiftExchange('txt_EmployeeId','ManualTimeEntry');" />
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div id="div_Employeenew" style="display: none">
                                <div class="col-md-2">
                                    <asp:Label ID="Label1" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <div class="input-group input-group-sm">
                                        <asp:TextBox onpaste="return true" ID="TextBox1" runat="server" CssClass="form-control man-dat"
                                            MaxLength="15" onblur="EmpName('ManualTimeEntry');" onkeypress="return acceptCharsNum_MaxLength(event,this,15,MaxLength);"></asp:TextBox>
                                        <span class="input-group-btn">
                                            <asp:LinkButton ID="LinkButton1" data-toggle="modal" data-target="#myModal" CssClass="btn save-btn btn-flat fa fa-search"
                                                runat="server" OnClientClick="return OpenWindowShiftExchange('txt_EmployeeId','ManualTimeEntry');" />
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_EmployeeName" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" CssClass="form-control" ID="txt_Name" runat="server"
                                    ReadOnly="True"></asp:TextBox>
                            </div>
                        </div>
                        <div id="divEmployees" style="display: none">
                            <div class="row">
                                <div class="col-md-12">
                                    <asp:Label ID="lbl_Employees" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-12">
                                    <asp:Button ID="btn_ViewEmployees" CssClass="btn btn-primary" runat="server" OnClientClick="return OpenWindow();" />
                                    <br />
                                    <br />
                                    <asp:GridView ID="grvEmployees" CssClass="table table-responsive table-bordered"
                                        runat="server" AutoGenerateColumns="False" Width="100%" AllowPaging="true" PageSize="10"
                                        OnPageIndexChanging="grvEmployees_PageIndexChanging" CellPadding="4" AutoGenerateDeleteButton="True"
                                        OnRowDeleting="grvEmployees_RowDeleting" OnRowDataBound="grvEmployees_RowDataBound">
                                        <Columns>
                                            <asp:TemplateField HeaderText="EmpId" Visible="false">
                                                <ItemTemplate>
                                                    <itemstyle horizontalalign="Center" />
                                                    <headerstyle horizontalalign="Center" />
                                                    <asp:Label ID="lbl_EmpAutoId" Text='<%# Eval("EmpId")%>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="LoginEmployeeId" Visible="false">
                                                <ItemTemplate>
                                                    <itemstyle horizontalalign="Center" />
                                                    <headerstyle horizontalalign="Center" />
                                                    <asp:Label ID="lbl_LoginEmployeeId" Text='<%# Eval("LoginEmployeeId")%>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Employee Id">
                                                <ItemTemplate>
                                                    <itemstyle horizontalalign="Center" />
                                                    <headerstyle horizontalalign="Center" />
                                                    <asp:Label ID="lbl_EmpId" Text='<%# Eval("EmployeeId")%>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Employee Name">
                                                <ItemTemplate>
                                                    <asp:Label ID="lbl_EmpName" Text='<%# Eval("EmployeeName")%>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                    </asp:GridView>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12">
                                    <asp:RadioButton ID="rbExcludingWeeklyOff" Checked="true" runat="server" GroupName="Weekly Off" />
                                    <asp:RadioButton ID="rbIncludingWeeklyOff" runat="server" GroupName="Weekly Off"
                                        Visible="false" />
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_ManualTimeEntryDate" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lbl_EntryDate" runat="server" CssClass="form-control"></asp:Label>
                            </div>
                        </div>
                        <div class="row" style="display: none">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_EntranceName" runat="server"></asp:Label>
                                <font color="#ff0000">*</font>
                            </div>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddlEntranceName" runat="server" AppendDataBoundItems="True"
                                    CssClass="form-control select2" onchange="return ManualTimeEntryTerminals(SelectEntranceID,NoRecords,Errorinretrivingdetails,Select);">
                                    <asp:ListItem Text="-Select-" Value="-Select-"></asp:ListItem>
                                </asp:DropDownList>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_InDate" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_InDate" runat="server" onCut="return false"
                                    CssClass="form-control" onDrop="return false"></asp:TextBox>
                                <asp:CustomValidator ID="CustomValidator1" runat="server" EnableClientScript="False"
                                    OnServerValidate="CheckInDate" SetFocusOnError="True" ControlToValidate="txt_InDate"
                                    Display="None"></asp:CustomValidator>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_InTime" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_ShiftIn" runat="server" MaxLength="12"
                                    CssClass="form-control" onCut="return false" onDrop="return false"></asp:TextBox>
                            </div>
                        </div>
                        <div class="row" style="display: none">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_InTerminal" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddlInTerminals" runat="server" CssClass="form-control select2">
                                </asp:DropDownList><input id="hdn_InTerminal" type="hidden" runat="server" />
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_InPunchType" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddlInPunchTypes" runat="server" CssClass="form-control select2" onchange="javascript:FillInPunchTypeHidden();"
                                    AppendDataBoundItems="true">
                                    <asp:ListItem Text="-Select-" Value="0"></asp:ListItem>
                                </asp:DropDownList>
                                <input id="hdn_InPunchType" type="hidden" runat="server" />
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_OutDate" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_OutDate" runat="server" CssClass="form-control"
                                    onCut="return false" onDrop="return false"></asp:TextBox>
                                <asp:CustomValidator ID="CustomValidator3" runat="server" Display="None" EnableClientScript="False"
                                    OnServerValidate="CheckOutDate" SetFocusOnError="True" ControlToValidate="txt_OutDate"></asp:CustomValidator>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_OutTime" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_ShiftOut" runat="server" CssClass="form-control"
                                    MaxLength="12" onCut="return false" onDrop="return false"></asp:TextBox>
                            </div>
                        </div>
                        <div class="row" style="display: none">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_OutTerminal" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddlOutTerminals" runat="server" CssClass="form-control select2" onchange="return ManualTimeEntry_OutPunchTypes(SelOutTerminal,NoRecords,Errorinretrivingdetails,Select);">
                                </asp:DropDownList><input id="hdn_OutTerminal" type="hidden" runat="server" />
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_OutPunchType" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:HiddenField ID="Hidden1" runat="server" />
                                <asp:HiddenField ID="Hidden2" runat="server" />
                                <asp:HiddenField ID="hiddenTime" runat="server" />
                                <asp:DropDownList ID="ddlOutPunchTypes" runat="server" CssClass="form-control select2" AppendDataBoundItems="true"
                                    onchange="javascript:FillOutPunchTypeHidden();">
                                    <asp:ListItem Text="-Select-" Value="0"></asp:ListItem>
                                </asp:DropDownList>
                                <input id="hdn_OutPunchType" type="hidden" runat="server" />
                            </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">
                                <div>
                                    <asp:DropDownList ID="ddl_Reason" runat="server" CssClass="form-control select2" AppendDataBoundItems="true" onchange="javascript:FillReason();">
                                        <asp:ListItem Text="Select" Value="0">
                                            <%--"Select", "MT_Reason_Missed_Swipe_In", "MT_Reason_Missed_Swipe_Out", 
                                                "MT_Reason_Missed_In_Out", "MT_Reason_Damaged_Card",
                                                 "MT_Reason_Left_Early", "MT_Reason_Others"--%>
                                        </asp:ListItem>
                                        <asp:ListItem Text="Damaged Card" Value="Damaged Card"></asp:ListItem>
                                        <asp:ListItem Text="Device Not Working" Value="Device Not Working"></asp:ListItem>
                                        <asp:ListItem Text="Department Training" Value="Department Training"></asp:ListItem>
                                        <asp:ListItem Text="Finger Print Problem" Value="Finger Print Problem"></asp:ListItem>
                                        <asp:ListItem Text="Forgot Swipe In" Value="Forgot Swipe In"></asp:ListItem>
                                        <asp:ListItem Text="Forgot Swipe Out" Value="Forgot Swipe Out"></asp:ListItem>
                                        <asp:ListItem Text="Forgot In and Out" Value="Forgot Swipe In and Out"></asp:ListItem>
                                        <asp:ListItem Text="Left Early" Value="Left Early"></asp:ListItem>
                                        <asp:ListItem Text="Others" Value="Others"></asp:ListItem>
                                        <asp:ListItem Text="Que at Device" Value="Que at Device"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-8">
                            </div>
                            <div class="col-md-3 offset-8">
                                <asp:TextBox onpaste="return true" ID="txt_Reason" runat="server" CssClass="form-control man-dat"
                                    Style="resize: none; margin-left: 3px; display: none; visibility: hidden;"
                                    MaxLength="250" onCut="return false" onDrop="return false" onkeypress="return chkMaxLen(event,this,250,MaxLength);"
                                    TextMode="MultiLine"></asp:TextBox>
                            </div>
                        </div>
                        <div id="div_Route" style="display: none;">
                            <div class="row">
                                <div class="col-md-3">
                                    <asp:Label ID="lbl_RouteName" runat="server"></asp:Label>
                                    <span style="color: #ff0000">*</span>
                                </div>
                                <div class="col-md-3">
                                    <asp:DropDownList ID="ddlRouteName" runat="server" AppendDataBoundItems="True" CssClass="form-control select2">
                                        <asp:ListItem Text="-Select-" Value="-Select-"></asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:Button ID="btn_View" runat="server" CausesValidation="False" OnClientClick="return Manual_OpenWindow(SelectInDate,SelecttheRouteName);"
                                        CssClass="btn btn-primary" />
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="clearfix">
                    </div>
                    <div class="col-md-12">
                    </div>
                    <div class="col-md-5">
                    </div>
                    <div class="col-md-6">
                        <div class="pull-right-button">
                            <asp:LinkButton ID="btn_Add" CssClass="btn save-btn fa-floppy-o" runat="server" CausesValidation="true"
                                OnClick="btn_Add_Click" OnClientClick="if(ManualEntryValidation()) $find('popupProgress').show();else return false;" />
                            <asp:LinkButton ID="btn_Cancel" CssClass="btn save-btn fa-angle-left" runat="server"
                                CausesValidation="False" OnClick="btn_Cancel_Click" />
                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
                                ShowSummary="False" />
                            <asp:Label ID="lblname" runat="server">
                            </asp:Label>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</asp:Content>
