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

<%@ Register Src="../UserControls/TA_uc_OrgLevelFilter_Updated.ascx" TagName="TA_uc_OrgLevel_Filter"
    TagPrefix="uc1" %>
<%@ 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/anytimeIE.css" />
			<link rel="stylesheet" type="text/css" href="../css/ProgressforIE.css" />

 <![endif]-->
    <link rel="stylesheet" href="../css/ProgressBar.css" type="text/css" media="all" />

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

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

        $(function () {
            $('#ctl00_BodyContentPH_txtFromDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
        $(function () {
            $('#ctl00_BodyContentPH_txtToDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
    </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 MaxLength = "Maximum length is ";
       
        function MaxLengthh(maxLength) {
            MaxLength = maxLength;
        }
        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;
        }
        var gg = "gg";
        var ToDate = "To Date should be greater than From Date";
        var EnterToDate = "Enter To Date.";
        var EnterFromDate = "Enter From Date.";
        var EnterValidFromDate = "Enter Valid From Date";
        function SetAlertMessages(Gg, toDate, enterToDate, enterFromDate, enterValidFromDate) {
            //gg = Gg;
            ToDate = toDate;
            EnterToDate = enterToDate;
            EnterFromDate = enterFromDate;
            EnterValidFromDate = enterValidFromDate;
        }
        function checkMonth(MonthName) {
            if (MonthName == 'Jan')
                return 1;
            if (MonthName == 'Feb')
                return 2;
            if (MonthName == 'Mar')
                return 3;
            if (MonthName == 'Apr')
                return 4;
            if (MonthName == 'May')
                return 5;
            if (MonthName == 'Jun')
                return 6;
            if (MonthName == 'Jul')
                return 7;
            if (MonthName == 'Aug')
                return 8;
            if (MonthName == 'Sep')
                return 9;
            if (MonthName == 'Oct')
                return 10;
            if (MonthName == 'Nov')
                return 11;
            if (MonthName == 'Dec')
                return 12;
        }
        function OpenSwipesHandlingWindow(clkEmpID, clkDate) {
            if (WeekdayValidation() == true) {
                var Employeeid = document.getElementById('<%=txtEmployeeId.ClientID %>').value;
            var EmployeeName = document.getElementById('<%=txtEmployeeName.ClientID %>').value;
            var EmpCategory = document.getElementById('<%=ddlEmpCatagory.ClientID %>').value;
            var EmpType = document.getElementById('<%=ddlEmpType.ClientID %>').value;
            var FromDate = document.getElementById('<%=txtFromDate.ClientID %>').value;
            var ToDate = document.getElementById('<%=txtToDate.ClientID %>').value;
            var SwipesType = document.getElementById('<%=ddlSwipesType.ClientID %>').value;
            var VoidUnVoid = document.getElementById('<%=ddlVoidUnVoid.ClientID %>').value;
            var SwipeCard = document.getElementById('<%=txtSwipeCard.ClientID %>').value;
            document.getElementById('ctl00_BodyContentPH_iframePopup').src = 'TA_UI_Transactions_SwipesHandling.aspx?EmpId=' + Employeeid + '&EmpName=' + EmployeeName + '&EmpCategory=' + EmpCategory + '&EmpType=' + EmpType + '&FromDate=' + FromDate + '&ToDate=' + ToDate + '&SwipesType=' + SwipesType + '&VoidUnVoid=' + VoidUnVoid + '&SwipeCard=' + SwipeCard + '', '';
            $(document).ready(function () {
                $("#myModal").modal('show');
            });
            //popupwindow('TA_UI_Transactions_SwipesHandling.aspx?EmpId='+Employeeid+'&EmpName='+EmployeeName +'&EmpCategory='+EmpCategory +'&EmpType='+EmpType+'&FromDate='+FromDate+'&ToDate='+ToDate+'&SwipesType='+SwipesType+'&VoidUnVoid='+VoidUnVoid+ '&SwipeCard=' + SwipeCard + '','',900,500);
            //window.open('TA_UI_Transactions_SwipesHandling.aspx?EmpId='+Employeeid+'&EmpName='+EmployeeName +'&EmpCategory='+EmpCategory +'&EmpType='+EmpType+'&FromDate='+FromDate+'&ToDate='+ToDate+'&SwipesType='+SwipesType+'&VoidUnVoid='+VoidUnVoid+ '&SwipeCard=' + SwipeCard + '','','left=70px, top=100px, width=900px, height=500px, scrollbars=yes, status=yes, resizable=no,menubar=no');
            return false;
        }
        else {
            // alert(gg);
            return false;
        }        //window.open('TA_UI_Transaction_SwipesHandling.aspx?clkDate=' + clkDate + '&clkEmpId=' + clkEmpID + '','','left=100px, top=100px, width=870px, height=370px, scrollbars=yes, status=no, resizable=no');
        //return false;    
    }
    //On Center Screen
    function popupwindow(url, title, w, h) {
        var left = (screen.width / 2) - (w / 2);
        var top = (screen.height / 2) - (h / 2);
        return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
    }
    function WeekdayValidation() {

        var weekDay = document.aspnetForm.ctl00_BodyContentPH_txtFromDate;
        var weekDay2 = document.aspnetForm.ctl00_BodyContentPH_txtToDate;
        var DateFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
        if (weekDay.value != '') {
            if (checkDate(weekDay, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)) {
                if (weekDay2.value != '') {
                    if (checkDate(weekDay2, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)) {
                        //validation for MM/dd/YYYY format
                        if (document.getElementById('ctl00_BodyContentPH_Hidden1').value == 'MM/DD/YYYY') {
                            var date1 = document.getElementById("<%= txtFromDate.ClientID%>").value;
                            var date1Month = date1.substring(0, 2);
                            var date1Date = date1.substring(3, 5);
                            var date1Year = date1.substring(6, date1.length);
                            var date2 = document.getElementById("<%= txtToDate.ClientID%>").value;
                            var date2Month = date2.substring(0, 2);
                            var date2Date = date2.substring(3, 5);
                            var date2Year = date2.substring(6, date2.length);
                        }
                        //validation for dd/MM/YYYY format
                        if (document.getElementById('ctl00_BodyContentPH_Hidden1').value == 'DD/MM/YYYY') {
                            var date1 = document.getElementById("<%= txtFromDate.ClientID%>").value;
                            var date1Month = date1.substring(3, 5);
                            var date1Date = date1.substring(0, 2);
                            var date1Year = date1.substring(6, date1.length);
                            var date2 = document.getElementById("<%= txtToDate.ClientID%>").value;
                            var date2Month = date2.substring(3, 5);
                            var date2Date = date2.substring(0, 2);
                            var date2Year = date2.substring(6, date2.length);
                        }
                        //validation for dd-MMM-YYYY format
                        if (document.getElementById('ctl00_BodyContentPH_Hidden1').value == 'DD-MMM-YYYY') {
                            var date1 = document.getElementById("<%= txtFromDate.ClientID%>").value;
                            var mon = date1.substring(3, 6);
                            //                               var date1Month = Month(mon);
                            var date1Month = checkMonth(mon);
                            var date1Date = date1.substring(0, 2);
                            var date1Year = date1.substring(7, date1.length);
                            var date2 = document.getElementById("<%= txtToDate.ClientID%>").value;
                            var mon1 = date2.substring(3, 6);
                            //                               var date2Month = Month(mon1); 
                            var date2Month = checkMonth(mon1);
                            var date2Date = date2.substring(0, 2);
                            var date2Year = date2.substring(7, date2.length);
                        }
                        if (date1Year >= date2Year) {
                            if (date1Year > date2Year) {
                                alert(ToDate);
                                document.getElementById("<%= txtToDate.ClientID%>").focus();
                                return false;
                            }
                            if (date1Year == date2Year) {
                                if (date1Month >= date2Month) {
                                    if (date1Month > date2Month) {
                                        alert(ToDate);
                                        document.getElementById("<%= txtToDate.ClientID%>").focus();
                                        return false;
                                    }
                                    if (date1Month == date2Month) {
                                        if (date1Date > date2Date) {
                                            alert(ToDate);
                                            document.getElementById("<%= txtToDate.ClientID%>").focus();
                                            return false;
                                        }
                                        else {
                                        }
                                    }
                                }
                                else {
                                }
                            }
                        }
                        else {
                        }
                    }
                    else {
                        //Commented by manjula.P on 11-Feb-2014
                        document.aspnetForm.ctl00_BodyContentPH_txtToDate.focus();
                        return false;
                    }
                }
                else {
                    alert(EnterToDate);
                    document.aspnetForm.ctl00_BodyContentPH_txtToDate.focus();
                    return false;
                }
            }
            else {
                //Commented by manjula.P on 11-Feb-2014
                alert(EnterValidFromDate);
                document.aspnetForm.ctl00_BodyContentPH_txtFromDate.focus();
                return false;
            }
        }
        else {
            alert(EnterFromDate);
            document.aspnetForm.ctl00_BodyContentPH_txtFromDate.focus();
            return false;
        }
        //       
        return true;
    }
    </script>

    <div class="content-header">
        <h1 style="background-image: url('../dist/img/all-swipes.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lblDiscrepancyReport" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <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>
                                (3 No.)</span>
                        </h6>
                    </div>
                </div>
                <div class="clearfix">
                </div>
            </div>
        </div>
        <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" class="close" data-dismiss="modal" style="border-radius: 50px;">
                            &times;</button>
                        <h4 class="modal-title" style="padding-bottom: 10px">
                            <asp:Label ID="lblDataView" runat="server" Text="Data View"></asp:Label>

                        </h4>
                    </div>
                    <div class="modal-body" style="padding-top: 0px">
                        <iframe id="iframePopup" runat="server" scrolling="auto" width="100%" height="750px"
                            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="emp-filter">
            <div class="form-horizontal">
                <div class="row">
                    <div class="col-md-12">
                        <div id="divEmployeeDetails" runat="server">
                            <div class="form-group" style="display: none;">
                                <div class="col-md-2">
                                    <asp:HiddenField ID="Hidden1" runat="server" />
                                    <asp:HiddenField ID="hiddenTime" runat="Server" />
                                    <asp:Label ID="lblEmpSwipe" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:TextBox onpaste="return true" ID="txtSwipeCard" MaxLength="20" runat="server"
                                        CssClass="form-control" onkeypress="return acceptCharsNum_MaxLength(event,this,20,MaxLength);"></asp:TextBox>
                                    <cc1:AutoCompleteExtender ID="acSwipeCardNo" runat="server" CompletionSetCount="10"
                                        CompletionListItemCssClass="item" CompletionListHighlightedItemCssClass="AutocompleteCSS"
                                        CompletionInterval="10" Enabled="true" MinimumPrefixLength="1" TargetControlID="txtSwipeCard"
                                        ServicePath="../WebServices/AutoCompleteExtender.asmx" ServiceMethod="GetCardNo"
                                        CompletionListCssClass="autocomplete_completionListElement" FirstRowSelected="true">
                                    </cc1:AutoCompleteExtender>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-2">
                                    <asp:Label ID="lblEmployeeName" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:TextBox onpaste="return true" ID="txtEmployeeName" runat="server" CssClass="form-control"
                                        MaxLength="50" onkeypress="return employeename_singlequotes_maxlength(event,this,50,MaxLength);"></asp:TextBox>
                                    <cc1:AutoCompleteExtender ID="acEmpName" runat="server" CompletionInterval="10" CompletionSetCount="10"
                                        CompletionListItemCssClass="item" CompletionListHighlightedItemCssClass="AutocompleteCSS"
                                        Enabled="true" FirstRowSelected="true" MinimumPrefixLength="1" ServicePath="../WebServices/AutoCompleteExtender.asmx"
                                        ServiceMethod="GetEmployeeName" CompletionListCssClass="autocomplete_completionListElement"
                                        TargetControlID="txtEmployeeName">
                                    </cc1:AutoCompleteExtender>
                                </div>
                                <div class="col-md-1">
                                </div>
                                <div class="col-md-2">
                                    <asp:Label ID="lblEmployeeId" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:TextBox onpaste="return true" ID="txtEmployeeId" runat="server" CssClass="form-control"
                                        MaxLength="15" onkeypress="return acceptCharsNum_MaxLength(event,this,15,MaxLength);"></asp:TextBox>
                                    <cc1:AutoCompleteExtender ID="acEmployeeId" runat="server" CompletionSetCount="10"
                                        CompletionListItemCssClass="item" CompletionListHighlightedItemCssClass="AutocompleteCSS"
                                        CompletionInterval="10" Enabled="true" MinimumPrefixLength="1" TargetControlID="txtEmployeeId"
                                        ServicePath="../WebServices/AutoCompleteExtender.asmx" ServiceMethod="GetEmployeeId"
                                        CompletionListCssClass="autocomplete_completionListElement" FirstRowSelected="true">
                                    </cc1:AutoCompleteExtender>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-2">
                                    <asp:Label ID="lblEmpCategory" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:DropDownList ID="ddlEmpCatagory" runat="server" CssClass="form-control select2" AppendDataBoundItems="true">
                                        <asp:ListItem Value="0" Selected="True" Text="-Select-"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                                <div class="col-md-1">
                                </div>
                                <div class="col-md-2">
                                    <asp:Label ID="lblEmpType" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:DropDownList ID="ddlEmpType" runat="server" CssClass="form-control select2" AppendDataBoundItems="true">
                                        <asp:ListItem Value="0" Selected="True" Text="-Select-"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-2" style="display:none">
                                    <asp:Label ID="lblSwipesType" Text="Type of Swipes" runat="server"></asp:Label>
                                </div>
                                <div class="col-md-3"  style="display:none">
                                    <asp:DropDownList ID="ddlSwipesType" runat="server" CssClass="form-control select2" AppendDataBoundItems="true">
                                        <asp:ListItem Text="ALL" Value="ALL"></asp:ListItem>
                                        <asp:ListItem Text="Mapped" Value="Mapped"></asp:ListItem>
                                        <asp:ListItem Text="UnMapped" Value="UnMapped"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                                <div class="col-md-1"  style="display:none">
                                </div>
                                <div class="col-md-2"
                                    <asp:Label ID="lblVoidUnVoid" runat="server" Text="Ignore/Include"></asp:Label>
                                </div>
                                <div class="col-md-3">
                                    <asp:DropDownList ID="ddlVoidUnVoid" runat="server" CssClass="form-control select2" AppendDataBoundItems="true">
                                        <asp:ListItem Text="ALL" Value="ALL"></asp:ListItem>
                                        <asp:ListItem Value="Void" Text="Ignored Punches"></asp:ListItem>
                                        <asp:ListItem Value="Un-Void" Text="Included Punches"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lblTimePeriod" runat="server"></asp:Label>
                                -
                                <asp:Label ID="lblFrom" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txtFromDate" runat="server" CssClass="form-control man-dat"
                                    onCut="return false" onDrop="return false" MaxLength="11"></asp:TextBox>
                                <asp:CustomValidator ID="cus_FromDate" runat="server" EnableClientScript="False"
                                    OnServerValidate="ValidateFromDate" ErrorMessage="Select valid From Date" Display="None"></asp:CustomValidator>
                                <asp:RequiredFieldValidator ID="reqFromDate" runat="server" ControlToValidate="txtFromDate"
                                    Display="None" EnableClientScript="False" ErrorMessage="Please select FromDate"></asp:RequiredFieldValidator>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lblTo" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txtToDate" runat="server" CssClass="form-control man-dat"
                                    onCut="return false" onDrop="return false" MaxLength="11"></asp:TextBox>
                                <asp:CustomValidator ID="cus_ToDate" OnServerValidate="ValidateToDate" runat="server"
                                    EnableClientScript="False" ErrorMessage="Select valid To Date" Display="None"></asp:CustomValidator>
                                <asp:CustomValidator ID="cus_ComToDate" runat="server" EnableClientScript="False"
                                    OnServerValidate="CompareDate" ErrorMessage="Todate Should be greater than  Fromdate"
                                    Display="None"></asp:CustomValidator>
                                <asp:RequiredFieldValidator ID="reqToDate" runat="server" ControlToValidate="txtToDate"
                                    Display="None" EnableClientScript="False" ErrorMessage="Please select ToDate"></asp:RequiredFieldValidator>
                            </div>
                        </div>
                    </div>
                    <div class="clearfix">
                    </div>
                    <div class="row">
                        <div class="line16">
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="row">
                            <div class="col-md-12">
                                <asp:PlaceHolder ID="PlaceHolderDiscrepancy" runat="server">
                                    <uc1:TA_uc_OrgLevel_Filter ID="TA_uc_OrgLevel_Filter1" runat="server" />
                                </asp:PlaceHolder>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                    </div>
                    <div class="col-md-5">
                        <div class="pull-right-button">
                            <asp:LinkButton ID="btn_View" CssClass="btn view-btn fa-eye" runat="server" OnClientClick="return OpenSwipesHandlingWindow();" />
                            <asp:ValidationSummary ID="ValidationSummary1" ShowMessageBox="false" ShowSummary="true"
                                runat="server" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
