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

<%@ Register TagPrefix="dxGridview" Namespace="DevExpress.Web" Assembly="DevExpress.Web.v14.2" %>
<asp:Content ContentPlaceHolderID="BodyContentPH" ID="con_MonClosView" runat="server">

    <script type="text/javascript" language="javascript">
        var MaximumValue = "Maximum Value is 365";
        var InvalidEntry = "Invalid entry";
        var AvailableLeave = "Available leaves should not be empty";
        function SetAlertMessages(maximumValue, invalidEntry, availableLeave) {
            MaximumValue = maximumValue;
            InvalidEntry = invalidEntry;
            AvailableLeave = availableLeave;
        }
        function validate(textbox) {
            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;
            }
        }
        //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);
        }
    </script>

    <div class="content-header">
        <h1 style="background-image: url(../dist/img/month-Close.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 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: 100px">
                    <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="lbl_Mon_Individual_Reprocess" runat="server" Text="Month Closure Individual Reprocess"></asp:Label>
                        </h4>
                    </div>
                    <div class="modal-body" style="padding-top: 0px">
                        <iframe id="iframePopup" runat="server" scrolling="auto" width="100%" height="500px"
                            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 class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_LevelName1" runat="server"></asp:Label>
                                <asp:Label ID="lbl_LevelId" runat="server" Visible="False"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lbl_LevelName" runat="server" Text="Label" CssClass="form-control"></asp:Label>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Month1" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lbl_Month" runat="server" Text="Label" CssClass="form-control"></asp:Label>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Year1" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lbl_Year" runat="server" CssClass="form-control"></asp:Label>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_StartDate1" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lbl_StartDate" runat="server" Text="Label" CssClass="form-control"></asp:Label>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_EndDate1" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lbl_EndDate" runat="server" Text="Label" CssClass="form-control"></asp:Label>
                            </div>
                        </div>
                        <div class="row" style="display: none;">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_ClosedDate1" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:Label ID="lbl_ClosedDate" runat="server" Text="Label" CssClass="form-control"></asp:Label>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <asp:Label ID="lblMessage" runat="server" ForeColor="red"></asp:Label>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-12">
                                <asp:LinkButton ID="btn_Save" CssClass="btn save-btn fa-angle-double-right" runat="server"
                                    OnClick="btn_Save_Click" />
                                <asp:LinkButton ID="btn_LevelwiseReprocess" CssClass="btn save-btn fa-angle-double-right"
                                    runat="server" OnClick="btn_Reprocess_Click" />
                                <asp:LinkButton ID="btn_IndividualReprocess" runat="server" Text="Button" CssClass="btn save-btn fa-angle-double-right"
                                    OnClick="btn_IndividualReprocess_Click" data-toggle="modal" data-target="#myModal" />
                                <asp:LinkButton ID="btnPreview" CssClass="btn save-btn fa-eye" runat="server" OnClick="btnPreview_Click" />
                                <asp:LinkButton ID="btn_View" CssClass="btn save-btn fa-eye" runat="server" OnClick="btn_View_Click" />
                                <asp:LinkButton ID="btn_Delete" CssClass="btn save-btn fa-trash-o" runat="server"
                                    CausesValidation="False" OnClick="btn_Delete_Click" />
                                <asp:LinkButton ID="btnExport" CommandName="excel" ToolTip="Export to Excel" runat="server" CssClass="btn del-btn fa-file-excel-o" OnClick="btnExport_Click">
                                </asp:LinkButton>
                                <asp:LinkButton ID="btnExportPdf" CommandName="pdf" ToolTip="Export to Pdf" runat="server" CssClass="btn del-btn fa-file-pdf-o" OnClick="btnExport_Click">
                                </asp:LinkButton>
                                <asp:LinkButton ID="btn_Cancel" CssClass="btn save-btn fa-angle-left" runat="server"
                                    OnClick="btn_Cancel_Click" />

                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                <asp:LinkButton ID="btnCustWindow" runat="server" CssClass="btn save-btn fa-folder-open-o"
                                    Text="&nbsp;&nbsp;Field Lists" OnClientClick="ShowHideCustomizationWindow();"></asp:LinkButton>
                            </div>
                        </div>
                        <div class="row" style="overflow: auto;">
                            <div class="col-md-12" style="padding-top: 15px; padding-bottom: 10px">
                                <div class="col-md-12" style="padding-top: 20px; display: none" id="legends" runat="server">
                                    <div class="row form-group">
                                        <div class="col-md-3">
                                            <asp:Label ID="lbl_PresentDays" runat="server" Text="P - Present Days" CssClass="form-control"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:Label ID="lbl_AbsentDays" runat="server" Text="A - Absent Days" CssClass="form-control"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:Label ID="lbl_LeaveDays" runat="server" Text="L - Leave Days" CssClass="form-control"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:Label ID="lbl_WeeklyOffDays" runat="server" Text="Off - Weekly Off Days" CssClass="form-control"></asp:Label>
                                        </div>

                                        <div class="col-md-3">
                                            <asp:Label ID="lbl_LOPDays" runat="server" Text="LOP - LOP Days" CssClass="form-control"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:Label ID="lbl_Holidays" runat="server" Text="H - Holidays" CssClass="form-control"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:Label ID="lbl_HoursWorked" runat="server" Text="HW - Hours Worked" CssClass="form-control"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:Label ID="lbl_ExtraHours" runat="server" Text="EH - Extra Hours" CssClass="form-control"></asp:Label>
                                        </div>

                                        <div class="col-md-3">
                                            <asp:Label ID="lbl_LessHoursWorked" runat="server" Text="LH - Less Hours Worked" CssClass="form-control"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:Label ID="lbl_NormalOT" runat="server" Text="NOT - Normal OT" CssClass="form-control"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:Label ID="lbl_WeeklyOffOT" runat="server" Text="WOT - Weekly Off OT" CssClass="form-control"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:Label ID="lbl_HolidayOT" runat="server" Text="HOT - Holiday OT" CssClass="form-control"></asp:Label>
                                        </div>

                                        <div class="col-md-3">
                                            <asp:Label ID="lbl_PermissionHours" runat="server" Text="PH - Permission Hours" CssClass="form-control"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:Label ID="lbl_LateInHours" runat="server" Text="LIH - Late In Hours" CssClass="form-control"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:Label ID="lbl_EarlyOutHours" runat="server" Text="EOH - Early Out Hours" CssClass="form-control"></asp:Label>
                                        </div>
                                        <%--<div class="col-md-3">
                                            <asp:Label ID="lblNSOT1" runat="server" Text="N-SOT1 - Normal Special OT1" CssClass="form-control"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:Label ID="Label1" runat="server" Text="N-SOT2 - Normal Special OT2" CssClass="form-control"></asp:Label>
                                        </div>                                        
                                        <div class="col-md-3">
                                            <asp:Label ID="Label4" runat="server" Text="H-SOT1 - Holiday Special OT1" CssClass="form-control"></asp:Label>
                                        </div>
                                        <div class="col-md-3">
                                            <asp:Label ID="Label5" runat="server" Text="H-SOT1 - Holiday Special OT1" CssClass="form-control"></asp:Label>
                                        </div>--%>
                                        <div class="col-md-3">
                                            <asp:Label ID="Label2" runat="server" Text="WO- Weekly Off" CssClass="form-control"></asp:Label>
                                        </div>
                                    </div>
                                </div>
                                <dxGridview:ASPxGridView ID="grv_MonthClosure" runat="server" ClientInstanceName="grv_MonthClosure"
                                    EnableCallBacks="false" AutoGenerateColumns="false" Width="1000px">
                                    <Columns>
                                        <dxGridview:GridViewDataTextColumn FieldName="Employee_Id" VisibleIndex="0" Width="100px">
                                            <DataItemTemplate>
                                                <asp:Label ID="lblEmployeecodeId" runat="server" Text='<%# Eval("Employee_Id") %>'
                                                    Style="overflow-y: auto; overflow-x: auto; word-break: break-all; width: 50px; word-wrap: break-word; display: inline-block;"></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="EmployeeName" VisibleIndex="1" Width="300px">
                                            <DataItemTemplate>
                                                <asp:Label ID="lblEmployeeName" 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" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="PresentDays" VisibleIndex="2">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblPresentDays" runat="server" Text='<%# Eval("PresentDays") %>'></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="AbsentDays" VisibleIndex="3">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblAbsentDays" runat="server" Text='<%# Eval("AbsentDays") %>'></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="LeaveDays" VisibleIndex="4">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblLeaveDays" runat="server" Text='<%# Eval("LeaveDays") %>'></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="WeekOffDays" VisibleIndex="5">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblWeekOffDays" runat="server" Text='<%# Eval("WeekOffDays") %>'></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="LOPDays" VisibleIndex="6">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblLopDays" runat="server" Text='<%# Eval("LOPDays") %>'></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="Holidays" VisibleIndex="7">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblHolidays" runat="server" Text='<%# Eval("Holidays") %>'></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn Caption="" FieldName="HrsWork" VisibleIndex="8">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblHrsWork" Text='<%# Eval("HrsWork") %>' runat="server"></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn Visible="false" Caption="" FieldName="HrsExtra" VisibleIndex="9">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblHrsExtra" Text='<%# Eval("HrsExtra") %>' runat="server"></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn Visible="false" Caption="" FieldName="HrsLess" VisibleIndex="10">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblHrsLess" Text='<%# Eval("HrsLess") %>' runat="server"></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn Visible="false" FieldName="NormOT" VisibleIndex="11">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblNormOT" Text='<%# Eval("NormOT") %>' runat="server"></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn Visible="false" FieldName="OffOT" VisibleIndex="12">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblOffOT" Text='<%# Eval("OffOT") %>' runat="server"></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn Visible="false" FieldName="HolOT" VisibleIndex="13">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblHolOT" Text='<%# Eval("HolOT") %>' runat="server"></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn Visible="false" FieldName="TotalPermissionHours" VisibleIndex="14">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblTotalPermissionHours" Text='<%# Eval("TotalPermissionHours") %>'
                                                    runat="server"></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="LateIn" VisibleIndex="15">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblLateIn" Text='<%# Eval("LateIn") %>' runat="server"></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="EarlyOut" VisibleIndex="16">
                                            <Settings AllowAutoFilter="false" />
                                            <DataItemTemplate>
                                                <asp:Label ID="lblEarlyOut" Text='<%# Eval("EarlyOut") %>' runat="server" align="center"></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                        <dxGridview:GridViewDataTextColumn FieldName="MonthClosure_Id" VisibleIndex="17"
                                            Visible="false">
                                            <DataItemTemplate>
                                                <asp:Label ID="lblMonthClosureId" runat="server" Text='<%# Eval("MonthClosure_Id") %>'></asp:Label>
                                            </DataItemTemplate>
                                            <HeaderStyle HorizontalAlign="center" Wrap="true" />
                                        </dxGridview:GridViewDataTextColumn>
                                    </Columns>
                                    <ClientSideEvents CustomizationWindowCloseUp="function(s, e) { UpdateCustomizationWindowValue(); }" />
                                    <SettingsPager PageSize="30">
                                        <PageSizeItemSettings Visible="true" ShowAllItem="true" Items="100,200,500,1000,2000" />
                                    </SettingsPager>
                                    <Settings ShowFilterRow="true" ShowFilterRowMenu="true" ShowGroupPanel="true" VerticalScrollBarMode="Hidden" VerticalScrollableHeight="400" />
                                    <SettingsText EmptyDataRow="No Records Found" />
                                    <SettingsCustomizationWindow Enabled="True" />
                                    <SettingsBehavior AutoExpandAllGroups="false" ColumnResizeMode="Control" />
                                    <Styles AlternatingRow-CssClass="table-bg">
                                    </Styles>
                                    <SettingsBehavior AllowDragDrop="true" />
                                </dxGridview:ASPxGridView>
                                <dxGridview:ASPxGridViewExporter ID="ASPxGridViewExporter1" runat="server">
                                    <PageFooter Right="[Page # of Pages #]">
                                    </PageFooter>
                                </dxGridview:ASPxGridViewExporter>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script 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);
        }
        function UpdateCustomizationWindowValue() {
            var element = document.getElementById("btnCustWindow");
            if (element == null) return;
            element.value = (grv_MonthClosure.IsCustomizationWindowVisible() ? "Hide" : "Show") + " Customization Window";
        }
        function ShowHideCustomizationWindow() {
            if (grv_MonthClosure.IsCustomizationWindowVisible())
                grv_MonthClosure.HideCustomizationWindow();
            else grv_MonthClosure.ShowCustomizationWindow();
            UpdateCustomizationWindowValue();
        }
    </script>

</asp:Content>
