<%@ Page Language="C#" MasterPageFile="~/MasterFile/TimeCheck.master" AutoEventWireup="true"
    CodeFile="TA_UI_Transactions_ManualEntryExport.aspx.cs" Inherits="Transactions_TA_UI_Transactions_ManualEntryExport" %>

<%@ Register TagPrefix="dxGridview" Namespace="DevExpress.Web" Assembly="DevExpress.Web.v14.2" %>
<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web"
    TagPrefix="exp" %>
<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web"
    TagPrefix="dxe" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPH" runat="Server">

    <script type="text/javascript">
        if (navigator.userAgent.toLowerCase().indexOf('chrome') != -1)
            document.write('<link href="../css/safari.css" rel="stylesheet" type="text/css" />');
    </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 language="javascript" src="../js/ShiftExchange.js" type="text/javascript"></script>

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

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

    <script>

        $(function () {
            $('#ctl00_BodyContentPH_txtStartDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
        $(function () {
            $('#ctl00_BodyContentPH_txtEndDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });

    </script>

    <script type="text/javascript">
        //values for check date
        var Monthfourdigit = 'Please enter valid date as month, day, and four digit year : Format MM/dd/yyyy.';
        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 EnterDetails = "Please enter any of the above details";
        var FillFromandToDate = "Please enter both the From and To Date";
        function SetAlertMessages(FillDetails, fillFromToDate) {
            EnterDetails = FillDetails;
            FillFromandToDate = fillFromToDate;
        }
        function WeekdayValidation() {

            var weekDay = document.aspnetForm.ctl00_BodyContentPH_txtStartDate;
            var weekDay2 = document.aspnetForm.ctl00_BodyContentPH_txtEndDate;
            var DateFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;

            var rangeDemoFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;


            if ((weekDay.value == '' && weekDay2.value != '') || (weekDay.value != '' && weekDay2.value == '')) {
                alert(FillFromandToDate);
                return false;
            }
            if (weekDay.value == '' && weekDay2.value == '') {
                alert(FillFromandToDate);
                weekDay.focus();
                return false;
            }
            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)) {
                        }
                        else {
                            return false;
                        }
                    }
                }
                else {
                    return false;
                }
            }
        }
    </script>

    <div class="content-header">
        <h1 style="background-image: url('../dist/img/export-icon.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lbl_Header" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <div class="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="lblMandatoryFields" runat="server" Text="Mandatory"></asp:Label>
                                (2 No.)</span>
                        </h6>
                    </div>
                </div>
                <div class="clearfix">
                </div>
            </div>
        </div>
        <div class="emp-filter">
            <div class="form-horizontal">
                <div class="row">
                    <div class="col-md-12">
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lblTimePeriod" runat="server"></asp:Label>
                                <asp:Label ID="lblStartDate" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txtStartDate" runat="server" CssClass="form-control man-dat"
                                    EnableViewState="False" onCut="return false" onDrop="return false" MaxLength="12"></asp:TextBox>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lblEndDate" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txtEndDate" runat="server" CssClass="form-control man-dat"
                                    EnableViewState="False" onCut="return false" onDrop="return false" MaxLength="12"></asp:TextBox>
                            </div>
                        </div>
                        <div class="row  form-group" runat="server" id="trEmpName">
                            <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" ID="txt_EmpName" 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="txt_EmpName">
                                </cc1:AutoCompleteExtender>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_EmployeeId" 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="row  form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lblStatus" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddlManualEntryStatus" runat="server" CssClass="form-control select2">
                                    <asp:ListItem Text="All" Value="All"></asp:ListItem>
                                    <asp:ListItem Text="Approved" Value="Approved"></asp:ListItem>
                                    <asp:ListItem Text="Forwarded" Value="Forwarded"></asp:ListItem>
                                    <asp:ListItem Text="Pending" Value="Pending"></asp:ListItem>
                                    <asp:ListItem Text="Rejected" Value="Rejected"></asp:ListItem>
                                    <asp:ListItem Text="Deleted" Value="Deleted"></asp:ListItem>
                                </asp:DropDownList>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_ExportMode" Text="Export Mode" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <dxe:ASPxComboBox ID="ASPxCboExport" runat="server" ValueType="System.String" CssClass="form-control"
                                    ClientInstanceName="ASPxCboExport" SelectedIndex="0" Visible="false">
                                    <Items>
                                        <%-- <dxe:ListEditItem ImageUrl="../images/icn-pdf.jpg" Text="pdf" Value="pdf" />--%>
                                        <%--    <dxe:ListEditItem ImageUrl="../images/icn-excel.jpg" Text="xls" Value="xls" />--%>
                                        <%--<dxe:ListEditItem ImageUrl="../images/icn-word.jpg" Text="rtf" Value="rtf" />--%>
                                        <dxe:ListEditItem ImageUrl="../images/icn-csv.gif" Text="csv" Value="csv" />
                                    </Items>
                                </dxe:ASPxComboBox>
                                <asp:DropDownList ID="ddlExport" runat="server" CssClass="form-control select2">
                                    <asp:ListItem Text="CSV File Format" Value="csv"></asp:ListItem>
                                </asp:DropDownList>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <dxGridview:ASPxGridView ID="gvManualEntryExport" EnableCallBacks="false" runat="server"
                                    ClientInstanceName="gvManualEntryExport" AutoGenerateColumns="false" Visible="false"
                                    Width="100%">
                                    <Columns>
                                        <dxGridview:GridViewDataColumn FieldName="Si_No" Caption="Si_No" CellStyle-HorizontalAlign="Left">
                                            <HeaderStyle HorizontalAlign="Center" Font-Bold="true" />
                                            <HeaderCaptionTemplate>
                                                <span class="label">Si_No</span>
                                            </HeaderCaptionTemplate>
                                        </dxGridview:GridViewDataColumn>
                                        <dxGridview:GridViewDataColumn FieldName="ManualTimeEntry_Employee_Id" Caption="Employee_Id *"
                                            CellStyle-HorizontalAlign="Right">
                                            <HeaderStyle HorizontalAlign="Center" Font-Bold="true" />
                                            <HeaderCaptionTemplate>
                                                <span class="label">ManualTimeEntry_Employee_Id</span>
                                            </HeaderCaptionTemplate>
                                        </dxGridview:GridViewDataColumn>
                                        <dxGridview:GridViewDataColumn FieldName="ManualTimeEntry_InDate" Caption="In_Date"
                                            CellStyle-HorizontalAlign="Left">
                                            <HeaderStyle HorizontalAlign="Center" Font-Bold="true" />
                                            <HeaderCaptionTemplate>
                                                <span class="label">ManualTimeEntry_InDate</span>
                                            </HeaderCaptionTemplate>
                                        </dxGridview:GridViewDataColumn>
                                        <dxGridview:GridViewDataColumn FieldName="ManualTimeEntry_InTime" Caption="In_Time"
                                            CellStyle-HorizontalAlign="Left">
                                            <HeaderStyle HorizontalAlign="Center" Font-Bold="true" />
                                            <HeaderCaptionTemplate>
                                                <span class="label" id="lblManualTimeEntry_InTime" runat="server">ManualTimeEntry_InTime</span>
                                            </HeaderCaptionTemplate>
                                        </dxGridview:GridViewDataColumn>
                                        <dxGridview:GridViewDataColumn FieldName="ManualTimeEntry_InPunchType" Caption="In_Punch_Type"
                                            CellStyle-HorizontalAlign="Left">
                                            <HeaderStyle HorizontalAlign="Center" Font-Bold="true" />
                                            <HeaderCaptionTemplate>
                                                <span class="label">ManualTimeEntry_InPunchType</span>
                                            </HeaderCaptionTemplate>
                                        </dxGridview:GridViewDataColumn>
                                        <dxGridview:GridViewDataColumn FieldName="ManualTimeEntry_OutDate" Caption="Out_Date"
                                            CellStyle-HorizontalAlign="Left">
                                            <HeaderStyle HorizontalAlign="Center" Font-Bold="true" />
                                            <HeaderCaptionTemplate>
                                                <span class="label">ManualTimeEntry_OutDate</span>
                                            </HeaderCaptionTemplate>
                                        </dxGridview:GridViewDataColumn>
                                        <dxGridview:GridViewDataColumn FieldName="ManualTimeEntry_OutTime" Caption="Out_Time"
                                            CellStyle-HorizontalAlign="Left">
                                            <HeaderStyle HorizontalAlign="Center" Font-Bold="true" />
                                            <HeaderCaptionTemplate>
                                                <span class="label" id="lblManualTimeEntry_OutTime" runat="server">ManualTimeEntry_OutTime</span>
                                            </HeaderCaptionTemplate>
                                        </dxGridview:GridViewDataColumn>
                                        <dxGridview:GridViewDataColumn FieldName="ManualTimeEntry_OutPunchType" Caption="Out_Punch_Type"
                                            CellStyle-HorizontalAlign="Left">
                                            <HeaderStyle HorizontalAlign="Center" Font-Bold="true" />
                                            <HeaderCaptionTemplate>
                                                <span class="label">ManualTimeEntry_OutPunchType</span>
                                            </HeaderCaptionTemplate>
                                        </dxGridview:GridViewDataColumn>
                                        <dxGridview:GridViewDataColumn FieldName="ManualTimeEntry_Reason" Caption="Reason*"
                                            CellStyle-HorizontalAlign="Left">
                                            <HeaderStyle HorizontalAlign="Center" Font-Bold="true" />
                                            <HeaderCaptionTemplate>
                                                <span class="label">ManualTimeEntry_Reason</span>
                                            </HeaderCaptionTemplate>
                                        </dxGridview:GridViewDataColumn>
                                    </Columns>
                                    <Settings ShowGroupFooter="VisibleAlways" />
                                    <SettingsPager PageSize="10">
                                    </SettingsPager>
                                    <SettingsText EmptyDataRow="No Records Found" />
                                    <Settings ShowFilterRow="true" />
                                    <SettingsBehavior SortMode="Value" AllowSort="true" AllowDragDrop="true" />
                                </dxGridview:ASPxGridView>
                                <exp:ASPxGridViewExporter ID="expShiftExport" runat="server" GridViewID="gvManualEntryExport">
                                    <%--<PageFooter Center="[Page # of Pages #]">
                                </PageFooter>--%>
                                </exp:ASPxGridViewExporter>
                                <asp:HiddenField ID="Hidden1" runat="server" />
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-6">
                            </div>
                            <div class="col-md-5">
                                <div class="pull-right-button">
                                    <asp:LinkButton ID="btnExport" CssClass="btn save-btn fa-random" runat="server" OnClick="btnExport_Click"
                                        OnClientClick="return WeekdayValidation();" />
                                    <asp:LinkButton ID="btn_Cancel" CssClass="btn save-btn fa-angle-left" runat="server"
                                        OnClick="btn_Cancel_Click" Visible="false" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
