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

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web" TagPrefix="dxw" %>

<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 type="text/javascript" src="../bootstrap/js/1.4.3/jquery.min.js"></script>

    <script src="../bootstrap/js/1.8.5/jquery-ui.min.js" type="text/javascript"></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>

    <link id="stylebootstrap" rel="stylesheet" runat="server" type="text/css" />

    <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 getVerify() {
            debugger;
            var txt_EmployeeId = document.getElementById('ctl00_BodyContentPH_txt_EmployeeId');

            if (txt_EmployeeId.value.length == 0) {
                alert(EntertheEmployeeID);
                document.getElementById('ctl00_BodyContentPH_txt_EmployeeId').focus();
                return false;
            }

        }

        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 rbtBox1() {
            debugger;
            if (document.aspnetForm.ctl00_BodyContentPH_rbnOut.checked == true) {

                //document.getElementById("DivMultipleManualDiv").style.display = "block";
                document.getElementById("DivMultipleInout").style.display = "block";
                document.getElementById("DivMultipleOutPunch").style.display = "block";
                document.getElementById("DivMultipleINPunch").style.display = "none";
                document.aspnetForm.ctl00_BodyContentPH_rbnIn.checked = false;
                document.aspnetForm.ctl00_BodyContentPH_rbnOut.checked = true;

            }
            else {
                //document.getElementById("DivMultipleManualDiv").style.display = "none";
                document.getElementById("DivMultipleOutPunch").style.display = "none";
                document.getElementById("DivMultipleInout").style.display = "block";
                document.getElementById("DivMultipleINPunch").style.display = "block";

                document.aspnetForm.ctl00_BodyContentPH_rbnOut.checked = false;
                document.aspnetForm.ctl00_BodyContentPH_rbnIn.checked = true;

            }
        }

        function rbtBox() {
            debugger;
            if (document.aspnetForm.ctl00_BodyContentPH_rbtMultipleEntry.checked == true) {

                //document.getElementById("DivMultipleManualDiv").style.display = "block";
                document.getElementById("divMultipleManualEntry").style.display = "block";
                document.getElementById("divSingleManualEntry").style.display = "none";
                document.aspnetForm.ctl00_BodyContentPH_rbtSingleEntry.checked = false;
                document.aspnetForm.ctl00_BodyContentPH_rbtMultipleEntry.checked = true;

            }
            else {
                //document.getElementById("DivMultipleManualDiv").style.display = "none";
                document.getElementById("divMultipleManualEntry").style.display = "none";
                document.getElementById("divSingleManualEntry").style.display = "block";
                document.aspnetForm.ctl00_BodyContentPH_rbtMultipleEntry.checked = false;
                document.aspnetForm.ctl00_BodyContentPH_rbtSingleEntry.checked = true;

            }
        }

        //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 FillMultipleInPunchTypeHidden() {
            var InPunchType;
            var InPunchTypeSelectedIndex = document.aspnetForm.ctl00_BodyContentPH_ddlINpunch.selectedIndex;
            InPunchType = document.aspnetForm.ctl00_BodyContentPH_ddlINpunch.options[InPunchTypeSelectedIndex].value;
            document.aspnetForm.ctl00_BodyContentPH_hdn_InPunchType.value = InPunchType;
        }
        function FillMultipleOutPunchTypeHidden() {
            var OutPunchType;
            var OutPunchTypeSelectedIndex = document.aspnetForm.ctl00_BodyContentPH_ddlOutpunch.selectedIndex;
            OutPunchType = document.aspnetForm.ctl00_BodyContentPH_ddlOutpunch.options[OutPunchTypeSelectedIndex].value;
            document.aspnetForm.ctl00_BodyContentPH_hdn_OutPunchType.value = OutPunchType;
        }

        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 (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="row col-md-12" style="padding-top: 40px;">
                                <div class="row form-group">
                                    <div class="col-md-3" style="padding-left:40px">
                                        <asp:Label ID="lblPunch" runat="server" Text="Punch Type"></asp:Label>
                                    </div>
                                    <div class="col-md-5">

                                        <div class="col-md-2">
                                            <asp:RadioButton ID="rbnIn" CssClass="radioLeave radioLeave-primary" runat="server"
                                                Text=" IN" GroupName="B" onclick="rbtBox1();" />
                                        </div>
                                        <div class="col-md-3">
                                            <asp:RadioButton ID="rbnOut" CssClass="radioLeave radioLeave-primary" runat="server"
                                                Text=" OUT" GroupName="B" onclick="rbtBox1();" />

                                        </div>
                                    </div>

                                </div>

                                <div class="row form-group">
                                    <div class="col-md-2" style="padding-left:40px">
                                        <asp:Label ID="lbl_ManualTimeEntryDate" runat="server" Text="Entry Date"></asp:Label>
                                    </div>
                                    <div class="col-md-3" style="width:320px">
                                        <asp:Label ID="lbl_EntryDate" runat="server" CssClass="form-control"></asp:Label>
                                    </div>
                                </div>

                            </div>

                     <div class="row form-group">

                            <div class="col-md-2" style="padding-left:40px" >
                                <asp:Label ID="lbl_Reason" runat="server" Text="Reason"></asp:Label>
                            </div>
                            <div class="col-md-3 offset-8">
                                <asp:TextBox onpaste="return true" ID="txt_Reason" runat="server" CssClass="form-control man-dat"
                                    MaxLength="250" onCut="return false" onDrop="return false" onkeypress="return chkMaxLen(event,this,250,MaxLength);"
                                    TextMode="MultiLine"></asp:TextBox>
                            </div>
                        </div>


                    <div id="DivMultipleInout" style="display: none">

                        <asp:HiddenField ID="Hidden1" runat="server" />
                        <asp:HiddenField ID="Hidden2" runat="server" />
                        <asp:HiddenField ID="hiddenTime" runat="server" />
                        <input id="hdn_InPunchType" type="hidden" runat="server" />
                        <input id="hdn_OutPunchType" type="hidden" runat="server" />
                        <div id="DivMultipleINPunch" style="display: block">

                            <div class="col-md-12">
                                <div class="row form-group">
                                    <div class="col-md-2" style="padding-left:25px">
                                        <asp:Label ID="lblPunchTypes" runat="server" Text="In Punch Type"></asp:Label>
                                    </div>
                                    <div class="col-md-3" style="padding-left:5px">
                                        <asp:DropDownList ID="ddlINpunch" runat="server" CssClass="form-control man-dat" onchange="javascript:FillMultipleInPunchTypeHidden();"
                                            AppendDataBoundItems="true">
                                            <asp:ListItem Text="-Select-" Value="0"></asp:ListItem>
                                        </asp:DropDownList>

                                    </div>

                                    <div class="col-md-1">
                                        <asp:LinkButton ID="btn_ShiftIN" CssClass="btn save-btn" runat="server"
                                            Text="Shift IN" CausesValidation="False" OnClick="btn_ShiftIN_Click" />
                                    </div>
                                    <div class="col-md-2">
                                        <asp:LinkButton ID="btn_BreakIN" CssClass="btn save-btn" runat="server"
                                            Text="Break IN" CausesValidation="False" OnClick="btn_BreakIN_Click" />
                                    </div>
                                </div>


                            </div>

                        </div>

                        <div id="DivMultipleOutPunch" style="display: none">

                            <div class="col-md-12">
                                <div class="row form-group">
                                    <div class="col-md-2" style="padding-left:25px">
                                        <asp:Label ID="lblPunchOuts" runat="server" Text="Out Punch Type"></asp:Label>
                                    </div>
                                    <div class="col-md-3" style="padding-left:5px">
                                        <asp:DropDownList ID="ddlOutpunch" runat="server" CssClass="form-control man-dat" onchange="javascript:FillMultipleOutPunchTypeHidden();"
                                            AppendDataBoundItems="true">
                                            <asp:ListItem Text="-Select-" Value="0"></asp:ListItem>
                                        </asp:DropDownList>

                                    </div>


                                    <div class="col-md-1">
                                        <asp:LinkButton ID="btn_BreakOut" CssClass="btn save-btn" runat="server"
                                            Text="Break Out" CausesValidation="False" OnClick="btn_BreakOut_Click" />
                                    </div>
                                    <div class="col-md-2">
                                        <asp:LinkButton ID="btn_ShiftOut" CssClass="btn save-btn" runat="server"
                                            Text="Shift Out" CausesValidation="False" OnClick="btn_ShiftOut_Click" />
                                    </div>

                                </div>
                            </div>

                        </div>

                    </div>


                    



                
                    <div id="divMultipleManualEntry" style="display: none">


                        <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" 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" 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>


                </div>



            </div>
        </div>

    </div>


</asp:Content>
