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

<%@ 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="ConYearClosureModify" 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]-->

    <script type="text/javascript" language="javascript">
        var MaximumValue = "Maximum Value is 365";
        var InvalidEntry = "Invalid entry";
        var AvailableLeave = "Available leaves should not be empty";
        var MaxLength = "Maximum length is ";
        function MaxLengthh(maxLength) {
            MaxLength = maxLength;
        }
        function SetAlertMessages(maximumValue, invalidEntry, availableLeave) {
            MaximumValue = maximumValue;
            InvalidEntry = invalidEntry;
            AvailableLeave = availableLeave;
        }
        function validate(textbox, MaximumValue, InvalidEntry, AvailableLeave) {
            var control = textbox;
            var availableleaves = control.value;
            if (availableleaves != "") {
                if (availableleaves > 365) {
                    alert(MaximumValue);
                    document.getElementById(control.id).Focus();
                    return false;
                }
                else {
                    if (availableleaves.match(/([1-3][0-6][0-5])/)) {
                        return true;
                    }
                    else {
                        if (availableleaves % 0.5 != 0) {
                            alert(InvalidEntry);
                            document.getElementById(control.id).focus();
                            return false;
                        }
                    }
                }
            }
            else {
                alert(AvailableLeave);
                document.getElementById(control.id).focus();
                return false;
            }
        }
    </script>

    <link rel="stylesheet" href="../css/ProgressBar.css" type="text/css" media="all" />
    <div class="content-header">
        <h1 style="background-image: url(../dist/img/yearend.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-2">
                </div>
                <div class="col-sm-2 col-sm-offset-8">
                    <div class="pull-right" style="height: 32px">
                        <h6></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">
                        <input id="Hidden1" type="hidden" value='<% Response.Write(Convert.ToString(Session["IDateFormat"])); %>' />
                        <div id="divEmployeeDetails" runat="server">
                            <div class="form-group">
                                <div class="col-md-2">
                                    <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" AppendDataBoundItems="true"
                                        CssClass="form-control select2">
                                        <asp:ListItem Selected="True" Value="0" 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" AppendDataBoundItems="true" CssClass="form-control select2">
                                        <asp:ListItem Selected="True" Value="0" Text="-Select-"></asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="clearfix">
                    </div>
                    <div class="row">
                        <div class="line16">
                        </div>
                    </div>
                    <div class="col-md-12">
                        <asp:PlaceHolder ID="PlaceHolderYearClosure" runat="server">
                            <uc1:TA_uc_OrgLevel_Filter ID="TA_uc_OrgLevel_Filter1" runat="server"></uc1:TA_uc_OrgLevel_Filter>
                        </asp:PlaceHolder>
                    </div>
                    <div class="col-md-5"></div>
                    <div class="col-md-6">
                        <div class="pull-right-button">
                            <asp:LinkButton ID="btn_View" runat="server" CssClass="btn save-btn fa-eye" OnClick="btn_View_Click" />
                            <asp:LinkButton ID="btn_Back" runat="server" CssClass="but" OnClick="btn_Back_Click"
                                Style="display: none" />
                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="false"
                                ShowSummary="true" />
                            <asp:Label ID="lblError" Text="" runat="server" Style="color: #ff0000"></asp:Label>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="table-responsive">
                            <div>
                                <asp:GridView ID="grv_YearClosure" runat="server" AllowPaging="True" AllowSorting="True"
                                    CssClass="table das-table1" AutoGenerateColumns="False" AutoGenerateEditButton="True"
                                    DataSourceID="ObjectDataSource1" Width="100%" OnRowUpdating="grv_YearClosure_RowUpdating"
                                    OnRowEditing="grv_YearClosure_RowEditing" PageSize="10" OnPageIndexChanging="grv_YearClosure_PageIndexChanging"
                                    OnRowCancelingEdit="grv_YearClosure_RowCancelingEdit" OnRowDataBound="grv_YearClosure_RowDataBound"
                                    Style="margin-top: 15px">
                                    <Columns>
                                        <asp:TemplateField HeaderText="YearClosureId" Visible="False" HeaderStyle-CssClass="empheader"
                                            ItemStyle-CssClass="table-icons">
                                            <ItemTemplate>
                                                <asp:Label ID="lblYearClosureId" runat="server" Text='<%# Eval("YearClosureId") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Employee Id" HeaderStyle-CssClass="empheader" ItemStyle-CssClass="table-icons">
                                            <ItemTemplate>
                                                <asp:Label ID="lblEmployee_code_Id" runat="server" Text='<%# Eval("Employee_code_Id") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Employee Name" HeaderStyle-CssClass="empheader" ItemStyle-CssClass="table-icons">
                                            <ItemTemplate>
                                                <asp:Label ID="lblEmployeeName" runat="server" Text='<%# Eval("EmployeeName") %>'>
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Leave Type" HeaderStyle-CssClass="empheader" ItemStyle-CssClass="table-icons">
                                            <ItemTemplate>
                                                <asp:Label ID="lblLeaveType" runat="server" Text='<%# Eval("LeaveType") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Carry Prev Year" HeaderStyle-CssClass="empheader"
                                            ItemStyle-CssClass="table-icons">
                                            <ItemTemplate>
                                                <asp:Label ID="lblCarry_PrevYear" runat="server" Text='<%# Eval("Carry_PrevYear") %>'></asp:Label>
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <asp:HiddenField ID="hdnCarryPrevYear" Value='<%# Eval("Carry_PrevYear") %>  ' runat="server" />
                                                <asp:TextBox onpaste="return true" ID="txt_Carry_PrevYear" runat="server" CssClass="form-control"
                                                    MaxLength="5" Text='<%# Bind("Carry_PrevYear") %>' onkeypress="return number_dot(event,this);"
                                                    onblur="return validate(this,MaximumValue,InvalidEntry,AvailableLeave);" Width="50"></asp:TextBox>
                                            </EditItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Current Quota" HeaderStyle-CssClass="empheader" ItemStyle-CssClass="table-icons">
                                            <ItemTemplate>
                                                <asp:Label ID="lblCurrent_Quota" runat="server" Text='<%# Eval("Current_Quota") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Borrow Next Year" HeaderStyle-CssClass="empheader"
                                            ItemStyle-CssClass="table-icons">
                                            <ItemTemplate>
                                                <asp:Label ID="lblBorrow_NextYear" runat="server" Text='<%# Eval("Borrow_NextYear") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Leave Taken" HeaderStyle-CssClass="empheader" ItemStyle-CssClass="table-icons">
                                            <ItemTemplate>
                                                <asp:Label ID="lblLeave_Taken" runat="server" Text='<%# Eval("Leave_Taken") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Available Leaves" HeaderStyle-CssClass="empheader"
                                            ItemStyle-CssClass="table-icons">
                                            <ItemTemplate>
                                                <asp:Label ID="lblAvailable_Leaves" runat="server" Text='<%# Eval("Available_Leaves") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Encashment" HeaderStyle-CssClass="empheader" ItemStyle-CssClass="table-icons">
                                            <ItemTemplate>
                                                <asp:Label ID="lblEncashment" runat="server" Text='<%# Eval("Encashment") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <RowStyle Height="30px" CssClass="table-bg" BorderColor="#C5DFFC" />
                                    <PagerStyle Font-Overline="False" HorizontalAlign="Right" CssClass="GridPager" />
                                    <PagerSettings FirstPageText="<<" LastPageText=">>" Mode="NumericFirstLast" NextPageText=">"
                                        PreviousPageText="<" />
                                    <AlternatingRowStyle BackColor="white" />
                                </asp:GridView>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
