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

<%@ Register TagPrefix="dxGridview" Namespace="DevExpress.Web" Assembly="DevExpress.Web.v14.2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="conEncashment" 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 href="../css/ProgressBar.css" rel="stylesheet" type="text/css" />

    <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_txtEncashmentStartDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
        $(function () {
            $('#ctl00_BodyContentPH_txtEncashmentEndDate').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value }
            );
        });
    </script>

    <div class="content-header">
        <h1 style="background-image: url('../dist/img/encashment.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lbl_Header" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <!--FILTERS-->
        <div class="inr-ftr">
            <div class="row">
                <div class="col-sm-2">
                    <div class="inr-fil-text">
                        <asp:Label ID="lblFilter" runat="server" Text="Filter"></asp:Label>
                    </div>
                </div>
            </div>
        </div>
        <div class="emp-filter">
            <div class="row">
                <div class="form-horizontal">
                    <div class="col-md-12">
                        <%--Add Search text box and other search control here--%>
                        <div class="row" style="display: none;">
                            <div class="col-md-6">
                                <asp:Label ID="lblEmpSwipe" runat="server"></asp:Label>
                                <asp:HiddenField ID="Hidden1" runat="server" />
                            </div>
                            <div class="col-md-6">
                                <asp:TextBox onpaste="return true" ID="txtSwipeCard" MaxLength="20" runat="server"
                                    CssClass="textbox_4" 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="row form-group">
                            <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 chkMaxLen(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 chkMaxLen(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="lblTimePeriod" runat="server"></asp:Label>
                                <asp:Label ID="lblEncashmentStartDate" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txtEncashmentStartDate" runat="server" CssClass="form-control"
                                    EnableViewState="False" onCut="return false" onDrop="return false"></asp:TextBox>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lblEncashmentEndDate" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txtEncashmentEndDate" runat="server" CssClass="form-control"
                                    EnableViewState="False" onCut="return false" onDrop="return false"></asp:TextBox>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-5">
                            </div>
                            <div class="col-md-6">
                                <div class="pull-right-button">
                                    <%--Add serach button here--%>
                                    <asp:Label ID="lbl_Error" runat="server" ForeColor="Red"></asp:Label>
                                    <asp:LinkButton ID="btn_Search" CssClass="btn save-btn fa-search" runat="server"
                                        OnClick="btn_Search_Click" OnClientClick="return DateEntryValidation()" />
                                    <asp:LinkButton ID="btn_Clear" CssClass="btn save-btn fa-refresh" runat="server"
                                        OnClick="btn_Clear_Click" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--RES TABLE-->
        <div class="border-table new-space">
            <div class="table-responsive" style="padding-bottom: 10px">
                <%--Grid Add Here--%>
                <asp:HiddenField ID="hdnSelectRow" runat="server" />
                <asp:HiddenField ID="hdnGetAllid" runat="server" />
                <dxGridview:ASPxGridView ID="grv_EncashmentApplication" runat="server" ClientInstanceName="grv_EncashmentApplication"
                    KeyFieldName="EncashmentId" AutoGenerateColumns="false" Width="100%" DataSourceID="ObjectDataSource1"
                    OnHtmlRowCreated="grv_EncashmentApplication_HtmlRowCreated">
                    <Columns>
                        <dxGridview:GridViewDataTextColumn FieldName="EncashmentId" VisibleIndex="0" Visible="false">
                            <DataItemTemplate>
                                <asp:Label ID="AppDate" runat="server" Text='<%# Eval("EncashmentId") %>'></asp:Label>
                            </DataItemTemplate>
                            <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                        </dxGridview:GridViewDataTextColumn>
                        <dxGridview:GridViewDataTextColumn Caption="Employee Id" FieldName="Employee_Code_Id"
                            Width="75px" VisibleIndex="1">
                            <DataItemTemplate>
                                <asp:Label ID="Label3" runat="server" Text='<%# Eval("Employee_Code_Id") %>' Style="text-align: left"></asp:Label>
                            </DataItemTemplate>
                            <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                        </dxGridview:GridViewDataTextColumn>
                        <dxGridview:GridViewDataTextColumn FieldName="DateOfEncashment" VisibleIndex="2"
                            Width="120px">
                            <DataItemTemplate>
                                <asp:Label ID="AppDate1" runat="server" Text='<%# Eval("DateOfEncashment") %>' Style="text-align: left"></asp:Label>
                            </DataItemTemplate>
                            <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                        </dxGridview:GridViewDataTextColumn>
                        <dxGridview:GridViewDataTextColumn FieldName="EmployeeName" VisibleIndex="3" Width="180px">
                            <DataItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Eval("EmployeeName") %>' Style="overflow-y: auto; overflow-x: auto; word-break: break-all; word-wrap: break-word; display: inline-block;"></asp:Label>
                            </DataItemTemplate>
                            <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                        </dxGridview:GridViewDataTextColumn>
                        <dxGridview:GridViewDataTextColumn FieldName="name" VisibleIndex="4" Width="150px">
                            <DataItemTemplate>
                                <asp:Label ID="Label2" runat="server" Text='<%# Eval("name") %>' Style="text-align: left; overflow-y: auto; overflow-x: auto; word-break: break-all; word-wrap: break-word; display: inline-block;"></asp:Label>
                            </DataItemTemplate>
                            <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                        </dxGridview:GridViewDataTextColumn>
                        <dxGridview:GridViewDataTextColumn FieldName="LeaveType" VisibleIndex="5" Width="90px">
                            <DataItemTemplate>
                                <asp:Label ID="lbl_LeaveType" runat="server" Text='<%# Eval("LeaveType") %>' Style="text-align: left; overflow-y: auto; overflow-x: auto; word-break: break-all; word-wrap: break-word; display: inline-block;"></asp:Label>
                            </DataItemTemplate>
                            <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                        </dxGridview:GridViewDataTextColumn>
                        <dxGridview:GridViewDataTextColumn FieldName="NumberOfDays" VisibleIndex="6" Width="80px">
                            <DataItemTemplate>
                                <asp:Label ID="lbl_Status" runat="server" Text='<%# Eval("NumberOfDays") %>' Style="text-align: center;"></asp:Label>
                            </DataItemTemplate>
                            <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                            <CellStyle HorizontalAlign="Center">
                            </CellStyle>
                        </dxGridview:GridViewDataTextColumn>
                        <dxGridview:GridViewDataTextColumn FieldName="Reason" VisibleIndex="7" Width="170px">
                            <DataItemTemplate>
                                <asp:Label ID="lbl_Remarks" runat="server" Text='<%# Eval("Reason") %>' Style="text-align: left; overflow-y: auto; overflow-x: auto; word-break: break-all; width: 110px; word-wrap: break-word; display: inline-block;"></asp:Label>
                            </DataItemTemplate>
                            <HeaderStyle HorizontalAlign="center" Wrap="true" CssClass="empheader" />
                        </dxGridview:GridViewDataTextColumn>
                        <dxGridview:GridViewDataColumn HeaderStyle-VerticalAlign="Middle" HeaderStyle-HorizontalAlign="Center"
                            CellStyle-VerticalAlign="Middle" CellStyle-HorizontalAlign="Center" Width="40px">
                            <Settings AllowAutoFilter="false" />
                            <DataItemTemplate>
                                <a title="Edit" href="TA_UI_Transaction_EncashmentModify.aspx?EncashmentId=<%# Eval("EncashmentId") %>&LeaveTypeId=<%# Eval("LeaveTypeId") %>&LeaveTypeName=<%# Eval("LeaveType") %>&EmployeeId=<%# Eval("EmployeeId") %>&NoOfDays=<%# Eval("NumberOfDays") %>&EmployeeCodeId=<%# Eval("Employee_Code_Id") %>&EmployeeName=<%# Eval("EmployeeName") %>&Reason=<%# Eval("Reason") %>"
                                    data-toggle="tooltip" data-placement="top"><span class="btn btn-defalut edit-icons"
                                        style="color: Green"></span></a>
                            </DataItemTemplate>
                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                        </dxGridview:GridViewDataColumn>
                    </Columns>
                    <SettingsPager PageSize="10">
                    </SettingsPager>
                    <SettingsText EmptyDataRow="No Records Found" />
                    <Settings ShowFilterRow="true" />
                    <SettingsBehavior SortMode="Value" AllowSort="true" AllowDragDrop="false" />
                    <Styles AlternatingRow-CssClass="table-bg">
                    </Styles>
                </dxGridview:ASPxGridView>
                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="SelectEncashmentDetails"
                    TypeName="EncashmentEventData">
                    <SelectParameters>
                        <asp:SessionParameter Name="Employee_Id" SessionField="EmpAutoId" Type="Int32" />
                        <asp:SessionParameter Name="GradeLevel" SessionField="GradeLevel" Type="String" />
                        <asp:SessionParameter Name="LevelRights" SessionField="LevelRights" Type="String" />
                        <asp:SessionParameter Name="UserGroupName" SessionField="UserGroupName" Type="string" />
                        <asp:SessionParameter Name="parentLevelId" SessionField="parentLevelId" Type="Int32" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="SelectEncashmentDetailsSuperAdmin"
                    TypeName="EncashmentEventData">
                    <SelectParameters>
                        <asp:SessionParameter Name="Employee_Id" SessionField="EmpAutoId" Type="Int32" />
                        <asp:SessionParameter Name="LevelRights" SessionField="LevelRights" Type="String" />
                        <asp:ControlParameter ControlID="txtEmployeeId" Type="string" Name="EmpCodeId" PropertyName="Text" />
                        <asp:ControlParameter ControlID="txt_EmpName" Type="string" Name="EmpFirstName" PropertyName="Text" />
                        <asp:ControlParameter ControlID="txtEncashmentStartDate" DefaultValue="01/01/1900"
                            Type="string" Name="StartDate" />
                        <asp:ControlParameter ControlID="txtEncashmentEndDate" DefaultValue="01/01/1900"
                            Type="string" Name="EndDate" />
                        <asp:ControlParameter ControlID="txtSwipeCard" Type="string" Name="strSwipeCard"
                            PropertyName="Text" />
                        <asp:SessionParameter Name="UserGroupName" SessionField="UserGroupName" Type="string" />
                        <asp:SessionParameter Name="parentLevelId" SessionField="parentLevelId" Type="Int32" />
                    </SelectParameters>
                </asp:ObjectDataSource>
            </div>
            <div class="clearfix">
            </div>
            <div class="row" style="margin-top: 15px">
                <div class="col-md-6">
                </div>
                <div class="col-md-6 page-button">
                    <%--Add Cancel button Add button here--%>
                    <asp:LinkButton ID="btn_Add" runat="server" CssClass="btn save-btn fa-plus" OnClick="btn_Add_Click" />
                </div>
            </div>
        </div>
        <!--RES TABLE-->
    </div>

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

        function OnInit(s, e) {

            AdjustSize();
        }
        function OnEndCallback(s, e) {
            AdjustSize();
        }

        function AdjustSize() {

            var height = Math.max(0, document.documentElement.clientHeight);
            var width = Math.max(0, document.documentElement.clientWidth);
            grid.SetHeight(height);
        }

        //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;
        }
        function DateEntryValidation() {
            if (document.aspnetForm.ctl00_CP_Transaction_txtEncashmentStartDate.value != '') {
                var weekDay = document.aspnetForm.ctl00_CP_Transaction_txtEncashmentStartDate;
                var DateFormat = document.getElementById('ctl00_CP_Transaction_Hidden1').value;

                if (checkDate(weekDay, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)
         ) {
                }
                else {
                    return false;
                }
            }

            if (document.aspnetForm.ctl00_CP_Transaction_txtEncashmentEndDate.value != '') {
                var weekDay = document.aspnetForm.ctl00_CP_Transaction_txtEncashmentEndDate;
                var DateFormat = document.getElementById('ctl00_CP_Transaction_Hidden1').value;

                if (checkDate(weekDay, DateFormat, Monthfourdigit, Datefourdigit, Invalidyearentry, Invalidmonthentry, Invaliddateentry, DateformatDDMONYYYY, Entertime, Valueforhours, Invalidvalueforminutes, Invalidtimeformat, EntervalidDateandTime, ValiddatemonthMMDDYYHHMM, ValiddatemonthMMDDYYHHMMTT, EntervalidDateandTime, Invalidvalueforhours, Invalidvalueforminites)
         ) {
                }
                else {
                    return false;
                }
            }
        }

    </script>

    </div>
</asp:Content>
