<%@ page language="C#" autoeventwireup="true" inherits="Forms_NearingMaintenance, App_Web_azu0ludn" enableeventvalidation="false" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/New_Header.ascx" TagName="Header" TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/New_Footer.ascx" TagName="Footer" TagPrefix="uc2" %>
<%--<%@ Register Assembly="DevExpress.Web.ASPxTreeList.v8.2, Version=8.2.10.0, Culture=neutral, PublicKeyToken=9b171c9fd64da1d1"
    Namespace="DevExpress.Web.ASPxTreeList" TagPrefix="dxwtl" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v8.2" Namespace="DevExpress.Web.ASPxGridView"
    TagPrefix="dxgv" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v8.2, Version=8.2.10.0, Culture=neutral, PublicKeyToken=9b171c9fd64da1d1"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v8.2" Namespace="DevExpress.Web.ASPxEditors"
    TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v8.2.Export" Namespace="DevExpress.Web.ASPxGridView.Export"
    TagPrefix="exp" %>--%>
<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web" TagPrefix="dxw" %>
<!DOCTYPE html>
<html lang="en">
<head id="Head1" runat="server">
    <title>tSense-IoT Maintenance</title>
    <meta content="charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <%--<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Page-Enter" content="blendTrans(Duration=0)" />
    <meta http-equiv="Page-Exit" content="blendTrans(Duration=0)" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />--%>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link href="../css/CustomeAlert/demos.css" rel="stylesheet" type="text/css" />
    <link href="../css/CustomeAlert/themes/jquery.ui.all.css" rel="stylesheet" type="text/css" />
    <link id="reset" runat="server" href="../css/reset.css" rel="stylesheet" type="text/css" />
    <link id="stylesheet2" runat="server" href="../css/stylesheet2.css" rel="stylesheet" type="text/css" />
    <link id="updatedcss" runat="server" href="../css/Updated_css.css" rel="stylesheet" type="text/css" />
    <link id="dropdown" runat="server" href="../css/dropdown.css" rel="stylesheet" type="text/css" />
    <%--<link id="uidatepicker" runat="server" type="text/css" href="../css/ui.datepicker.css" rel="stylesheet" />--%>
    <link id="uicore" runat="server" type="text/css" href="../css/ui.core.css" rel="stylesheet" />
    <link id="uitheme" runat="server" type="text/css" href="../css/ui.theme.css" rel="stylesheet" />
    <%--Custom Theme for DevEx 14.2--%>
    <link id="GridView" runat="server" type="text/css" href="~/App_Themes/Office2003Blue/GridView/grid.css" rel="stylesheet" />
    <link id="Editors" runat="server" type="text/css" href="~/App_Themes/Office2003Blue/Editors/styles.css" rel="stylesheet" />
    <link rel="icon" href="../NewDesign/img/favicon.png" type="image/x-icon">
    <link href="../NewDesign/css/bootstrap.css" rel="stylesheet" />
    <link href="../NewDesign/css/font-awesome.css" rel="stylesheet" />
    <link href="../NewDesign/css/responsive.css" rel="stylesheet" />
    <link href="../NewDesign/css/style.css" rel="stylesheet" />
    <script src="../NewDesign/js/jquery.min.js"></script>
    <script src="../js/jquery-3.3.1.min.js"></script>
    <script src="../NewDesign/js/bootstrap.min.js"></script>
    <script src="../NewDesign/js/jquery.js"></script>
    <script src="../NewDesign/js/script.js"></script>
    <link href="../NewDesign/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
    <link href="../NewDesign/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet" />
    <%--BootStrap Css--%>
    <%--<link id="BootStrapCss" href="../css/bootstrap.css" runat="server" rel="stylesheet" type="text/css" />--%>
    <link id="mainstyle" runat="server" href="../css/mainstyle.css" rel="stylesheet" type="text/css" />
    <%--End of BootStrap Css--%>
    <%--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">--%>
    <script type="text/javascript" src="../js/jquery-1.5.1.min.js"></script>
    <%--<script type="text/javascript" src="../js/ui.datepicker.js"></script>--%>
    <%--<script type="text/javascript" src="../js/JQQueryDatePicker.js"></script>--%>
    <script type="text/javascript" src="../js/GridCheckBoxMaintaining.js"></script>
    <script src="../js/CustomAlert/jquery.min.js" type="text/javascript"></script>
    <script src="../js/CustomAlert/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>
    <script src="../js/CustomAlert/jquery-ui-1.10.3.custom.js" type="text/javascript"></script>
    <script src="../js/CustomAlert/CustomAlert.js" type="text/javascript"></script>
    <%--<script src="../js/bootstrap.js"></script>--%>
    <script type="text/javascript">
        function hidestatus() {
            window.status = ''
            return true
        }
        if (document.layers)
            document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)
        document.onmouseover = hidestatus
        document.onmouseout = hidestatus
    </script>
    <script src="../js/wow.min.js"></script>
</head>
<body onload="ShowHideInterval();" class="white">
    <div class="page-wrapper">
        <div class="preloader"></div>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <asp:UpdatePanel ID="updGrid" runat="server">
                <ContentTemplate>
                    <!-- Header Starts Here -->
                    <uc1:Header ID="ucHeader" runat="server" />
                    <!-- Nav Ends Here -->
                    <!-- Content Starts Here -->
                    <div class="vlive-reports-section maintenance">
                        <div class="container-fluid">
                            <div class="row clearfix">
                                <div class="col-ks-16">
                                    <div class="col-ks-8 HeaderTest">
                                        <div class="col-ks-16">
                                            <h2 class="pull-left">
                                                <asp:Literal ID="lblFleetMaintenanceCaption" Text="Maintenance" runat="server"></asp:Literal>
                                            </h2>
                                        </div>
                                        <div class="col-ks-16">
                                            <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
                                                <NodeStyle CssClass="active" />
                                            </asp:SiteMapPath>
                                        </div>
                                    </div>
                                    <div class="col-ks-8 HeaderTopButton">
                                        <asp:LinkButton ID="ibtnServiceHistory" runat="server" PostBackUrl="~/Forms/VehicleMaintenanceHistory.aspx"
                                            ImageUrl="~/images/btnServiceHistory.png" CssClass="btn btn-primary btn-fa-history" Text="&nbsp;&nbsp;History" />

                                        <asp:LinkButton ID="lnkbtnfleetmaintenance" runat="server" CausesValidation="false" CssClass="fa-arrow-left btn btn-primary" PostBackUrl="~/Forms/FleetMaintenancePanel.aspx" Text="&nbsp;&nbsp;Back to Maintenance">
                                        </asp:LinkButton>

                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                    <div class="vlive-filter">
                        <div class="container-fluid">
                            <div class="vlive-centrifugal-fan maintenance-plan">
                                <div class="col-ks-16 vlive-header_VXL">
                                    <div class="col-ks-16">
                                        <asp:Label ID="lblNearingMaintenance" runat="server" CssClass="pnlhearder" Text="Nearing Maintenance"></asp:Label>
                                    </div>
                                </div>
                                <div class="row ftop">
                                    <asp:Panel ID="pnlNearingMainParams" runat="server">
                                        <div id="tblNearingMainSearch">
                                            <div class="col-md-12">
                                                <div class="col-ks-1_5">
                                                    <asp:Label ID="lblFleet" runat="server" Text="Fleet"></asp:Label>
                                                </div>
                                                <div class="col-ks-2">
                                                    <asp:DropDownList ID="ddlFleet" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlFleet_SelectedIndexChanged"
                                                        CssClass="form-control">
                                                    </asp:DropDownList>
                                                </div>
                                                <div class="col-ks-1_5">
                                                    <asp:Label ID="lblVehicle" runat="server" Text="Device"></asp:Label>
                                                </div>
                                                <div class="col-ks-2">
                                                    <%--<asp:DropDownList ID="ddlVehicle" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlVehicle_SelectedIndexChanged"
                                                        AppendDataBoundItems="true" CssClass="form-control">--%>
                                                    <asp:DropDownList ID="ddlVehicle" runat="server" AppendDataBoundItems="true" CssClass="form-control">
                                                    </asp:DropDownList>
                                                </div>
                                                <div class="col-ks-1_5">
                                                    <asp:Label ID="lblVType" runat="server" Text="Device type"></asp:Label>
                                                </div>
                                                <div class="col-ks-2">
                                                    <%--<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true"
                                                        OnSelectedIndexChanged="ddlVehType_SelectedIndexChanged" CssClass="form-control">--%>
                                                    <asp:DropDownList ID="ddlVehType" runat="server" CssClass="form-control">
                                                    </asp:DropDownList>
                                                </div>
                                            </div>
                                            <div class="col-md-12">
                                                <div class="col-ks-1_5">
                                                    <asp:Label ID="lblPlan" runat="server" Text="Plan"></asp:Label>
                                                </div>
                                                <div class="col-ks-2">
                                                    <asp:DropDownList ID="ddlMainPlans" runat="server" AppendDataBoundItems="true" CssClass="form-control">
                                                    <%--<asp:DropDownList ID="ddlMainPlans" runat="server" AppendDataBoundItems="true" AutoPostBack="true"
                                                        OnSelectedIndexChanged="ddlMainPlans_SelectedIndexChanged" CssClass="form-control">--%>
                                                    </asp:DropDownList>
                                                </div>
                                                <div class="col-ks-1_5">
                                                    <asp:Label ID="lblServiceTypeS" runat="server" Text="Service Type"></asp:Label>
                                                </div>
                                                <div class="col-ks-2">
                                                    <%--<asp:DropDownList ID="ddlServiceType" runat="server" AutoPostBack="true" CssClass="form-control"
                                                        OnSelectedIndexChanged="ddlServiceType_SelectedIndexChanged">--%>
                                                    <asp:DropDownList ID="ddlServiceType" runat="server" CssClass="form-control">
                                                        <asp:ListItem Value="4">All</asp:ListItem>
                                                        <%--<asp:ListItem Value="3">Concrete Mix Hours</asp:ListItem>
                                                                    <asp:ListItem Value="1">Odometer</asp:ListItem>--%>
                                                        <asp:ListItem Value="0">Running Hours</asp:ListItem>
                                                        <asp:ListItem Value="2">Time Based</asp:ListItem>
                                                    </asp:DropDownList>
                                                </div>
                                                <div class="col-ks-1_5">
                                                    <asp:Label ID="lblNearingS" runat="server" Text="Nearing(%)"></asp:Label>
                                                </div>
                                                <div class="col-ks-2">
                                                    <%--<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlNearing_SelectedIndexChanged"
                                                        CssClass="form-control">--%>
                                                    <asp:DropDownList ID="ddlNearing" runat="server" CssClass="form-control">
                                                        <asp:ListItem Text="All" Value="0" Selected="True"></asp:ListItem>
                                                        <asp:ListItem Text="> 20 <= 30" Value="20"></asp:ListItem>
                                                        <asp:ListItem Text="> 30 <= 40" Value="30"></asp:ListItem>
                                                        <asp:ListItem Text="> 40 <= 50" Value="40"></asp:ListItem>
                                                        <asp:ListItem Text="> 50 <= 60" Value="50"></asp:ListItem>
                                                        <asp:ListItem Text="> 60 <= 70" Value="60"></asp:ListItem>
                                                        <asp:ListItem Text="> 70 <= 80" Value="70"></asp:ListItem>
                                                        <asp:ListItem Text="> 80 <= 90" Value="80"></asp:ListItem>
                                                        <asp:ListItem Text="> 90 <= 100" Value="90"></asp:ListItem>
                                                        <asp:ListItem Text="> 100 <= 125" Value="100"></asp:ListItem>
                                                        <asp:ListItem Text="> 125 <= 150" Value="125"></asp:ListItem>
                                                        <asp:ListItem Text="> 150" Value="150"></asp:ListItem>
                                                    </asp:DropDownList>
                                                </div>
                                                <div runat="server" id="divDuration">
                                                    <div class="col-ks-1_5">
                                                        <asp:Label ID="lblDuration" runat="server" Text="Duration"></asp:Label>
                                                    </div>
                                                    <div class="col-ks-2">
                                                      <%--  <asp:DropDownList ID="ddlDuration" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlDuration_SelectedIndexChanged"
                                                            CssClass="form-control">--%>
                                                          <asp:DropDownList ID="ddlDuration" runat="server" CssClass="form-control">
                                                            <asp:ListItem Text="All" Value="0" Selected="True"></asp:ListItem>
                                                            <asp:ListItem Text="Current Week" Value="1"></asp:ListItem>
                                                            <asp:ListItem Text="Current Month" Value="2"></asp:ListItem>
                                                            <asp:ListItem Text="Current Quarter" Value="3"></asp:ListItem>
                                                        </asp:DropDownList>
                                                    </div>
                                                </div>
                                                <div class="col-ks-1">
                                                    <asp:LinkButton ID="btnSearch" runat="server" CssClass="btn btn-danger btn-circle btn-lg" OnClick="btnSearch_Click"
                                                        OnClientClick="ShowPopUp();"><i class="fa fa-search"></i></asp:LinkButton>
                                                </div>
                                            </div>
                                        </div>
                                    </asp:Panel>
                                </div>
                            </div>
                        </div>
                    </div>
                    <asp:Panel ID="pnlPolicyList" runat="server">
                        <div class="vlive-filter">
                            <div class="container-fluid">
                                <div class="vlive-centrifugal-fan maintenance-plan">
                                    <div class="col-ks-16 vlive-header_VXL">
                                        <div class="col-ks-13">
                                            <asp:Label ID="lblNearingdetails" runat="server" CssClass="pnlhearder" Text="Nearing Maintenance Details"></asp:Label>
                                        </div>
                                        <div class="col-ks-1">
                                            <dxw:ASPxComboBox ID="ASPxCboExport" runat="server" ValueType="System.String" CssClass="form-control exportddl"
                                                ShowImageInEditBox="false" ItemImage-Height="12px" ClientInstanceName="ASPxCboExport" SelectedIndex="0"
                                                CssFilePath="~/App_Themes/Office2003Blue/GridView/styles.css" CssPostfix="Office2003_Blue"
                                                EnableTheming="true" Theme="Office2003Blue">
                                                <Items>
                                                    <dxw:ListEditItem ImageUrl="../images/icn-pdf.jpg" Text="pdf" Value="pdf" />
                                                    <dxw:ListEditItem ImageUrl="../images/icn-excel.jpg" Text="xls" Value="xls" />
                                                    <dxw:ListEditItem ImageUrl="../images/icn-excel-xlsx.png" Text="xlsx" Value="xlsx" />
                                                    <dxw:ListEditItem ImageUrl="../images/icn-word.jpg" Text="rtf" Value="rtf" />
                                                    <%--<dxw:ListEditItem ImageUrl="../images/icn-csv.gif" Text="csv" Value="csv" />--%>
                                                </Items>
                                            </dxw:ASPxComboBox>
                                        </div>
                                        <div class="col-ks-2">
                                            <asp:ImageButton ID="btnExport1" runat="server" ImageUrl="~/images/btn-export.jpg"
                                                valign="bottom" align="right" OnClick="btnExport_Click" Visible="false" />
                                            <asp:LinkButton ID="btnExport" runat="server" CssClass="btn btn-primary btn-fa-file-excel-o" Text="&nbsp;&nbsp;Export" OnClick="btnExport_Click">
                                            </asp:LinkButton>
                                        </div>
                                    </div>
                                    <div class="row ftop">
                                        <div class="col-md-12">
                                            <div class="table-responsive">
                                                <dxw:ASPxGridView ID="gvNearingMaintenance" ClientInstanceName="gvNearingMaintenance"
                                                    runat="server" KeyFieldName="ServiceDetailsId" AutoGenerateColumns="false" Width="100%"
                                                    CssFilePath="~/App_Themes/Office2003Blue/GridView/styles.css" CssPostfix="Office2003_Blue"
                                                    EnableTheming="true" Theme="Office2003Blue">
                                                    <%--<Images ImageFolder="~/App_Themes/Office2003Blue/GridView/">
                                                        <CollapsedButton Height="12px" Url="~/App_Themes/Office2003Blue/GridView/gvCollapsedButton.png"
                                                            Width="11px" />
                                                        <ExpandedButton Height="12px" Url="~/App_Themes/Office2003Blue/GridView/gvExpandedButton.png"
                                                            Width="11px" />
                                                        <DetailCollapsedButton Height="12px" Url="~/App_Themes/Office2003Blue/GridView/gvCollapsedButton.png"
                                                            Width="11px" />
                                                        <DetailExpandedButton Height="12px" Url="~/App_Themes/Office2003Blue/GridView/gvExpandedButton.png"
                                                            Width="11px" />
                                                    </Images>--%>
                                                    <Styles CssFilePath="~/App_Themes/Office2003Blue/GridView/grid.css" AlternatingRow-Enabled="True"
                                                        CssPostfix="Office2003_Blue">
                                                        <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                                        </Header>
                                                        <LoadingPanel ImageSpacing="10px">
                                                        </LoadingPanel>
                                                        <PagerBottomPanel CssClass="PageFooter">
                                                        </PagerBottomPanel>
                                                        <PagerTopPanel CssClass="PageFooter">
                                                        </PagerTopPanel>
                                                    </Styles>
                                                    <SettingsPager PrevPageButton-Image-Url="../App_Themes/Office2003Blue/GridView/pPrev.gif"
                                                        PrevPageButton-Image-UrlDisabled="../App_Themes/Office2003Blue/GridView/pPrevDisabled.gif"
                                                        NextPageButton-Image-UrlDisabled="../App_Themes/Office2003Blue/GridView/pNextDisabled.gif"
                                                        NextPageButton-Image-Url="../App_Themes/Office2003Blue/GridView/pNext.gif" AlwaysShowPager="true"
                                                        PageSize="10">
                                                    </SettingsPager>
                                                    <Columns>
                                                        <dxw:GridViewDataTextColumn FieldName="VehicleName" Caption="Device Name" VisibleIndex="0"
                                                            Width="11%">
                                                            <HeaderCaptionTemplate>
                                                                <table cellpadding="0" cellspacing="0" border="0">
                                                                    <tr>
                                                                        <td style="height: 20px; padding-top: 5px">
                                                                            <asp:Label ID="lblgVehicleName" runat="server" Text="Device Name"></asp:Label>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </HeaderCaptionTemplate>
                                                            <DataItemTemplate>
                                                                <asp:LinkButton ID="lnkVehicleName" runat="server" Text='<%# Eval("VehicleName") %>'
                                                                    OnClientClick="document.getElementById('divMsg').innerHTML=''; ShowPopUp();"
                                                                    OnClick="lnkVehicleName_Click" CommandArgument='<%# Eval("VehicleId").ToString() %>'
                                                                    ForeColor='<%# Convert.ToInt64(Eval("Nearing").ToString()) >= 100 ? System.Drawing.Color.Red : ((Convert.ToInt64(Eval("Nearing").ToString()) >= 90 && Convert.ToInt64(Eval("Nearing").ToString()) < 100) ? System.Drawing.Color.Purple : System.Drawing.Color.Black) %>'></asp:LinkButton>
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataTextColumn>
                                                        <dxw:GridViewDataColumn FieldName="PlanName" Caption="Plan Name" VisibleIndex="1"
                                                            Width="10%">
                                                            <DataItemTemplate>
                                                                <asp:Label ID="glblPlanName" runat="server" Text='<%# Eval("PlanName").ToString() %>'
                                                                    ForeColor='<%# Convert.ToInt64(Eval("Nearing").ToString()) >= 100 ? System.Drawing.Color.Red : ((Convert.ToInt64(Eval("Nearing").ToString()) >= 90 && Convert.ToInt64(Eval("Nearing").ToString()) < 100) ? System.Drawing.Color.Purple : System.Drawing.Color.Black) %>'></asp:Label>
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataColumn FieldName="ServiceType" Caption="Service Type" VisibleIndex="2"
                                                            CellStyle-HorizontalAlign="Left" Width="7%">
                                                            <DataItemTemplate>
                                                                <asp:Label ID="glblServiceType" runat="server" Text='<%# Eval("ServiceType") %>'
                                                                    ForeColor='<%# Convert.ToInt64(Eval("Nearing").ToString()) >= 100 ? System.Drawing.Color.Red : ((Convert.ToInt64(Eval("Nearing").ToString()) >= 90 && Convert.ToInt64(Eval("Nearing").ToString()) < 100) ? System.Drawing.Color.Purple : System.Drawing.Color.Black) %>'></asp:Label>
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataColumn FieldName="ExpectedDueOnDateSort" Caption="Expected Due On Date"
                                                            VisibleIndex="3" CellStyle-HorizontalAlign="Center" Width="19%" HeaderStyle-Wrap="True">
                                                            <DataItemTemplate>
                                                                <asp:Label ID="glblDueOn" runat="server" Text='<%# ((Eval("ExpectedDueOnDate") == DBNull.Value) ? "" : (Convert.ToString(Eval("ServiceType")) == "Time Based"?Eval("ExpectedDueOnDate"):"NA")) %>'
                                                                    ForeColor='<%# Convert.ToInt64(Eval("Nearing").ToString()) >= 100 ? System.Drawing.Color.Red : ((Convert.ToInt64(Eval("Nearing").ToString()) >= 90 && Convert.ToInt64(Eval("Nearing").ToString()) < 100) ? System.Drawing.Color.Purple : System.Drawing.Color.Black) %>'></asp:Label>
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <%--DueOn--%>
                                                        <dxw:GridViewDataColumn FieldName="ReadingswhenDue" Caption="Readings when Due" VisibleIndex="4"
                                                            Width="10%">
                                                            <DataItemTemplate>
                                                                <asp:Label ID="glblReadingsDue" runat="server" Text='<%# (Convert.ToString(Eval("ServiceType")) != "Running Hours"?"N/A":(Eval("Frequency").ToString() == "3" ? (Eval("DueOn").ToString() + " hrs" ) 
                                                                    : (Eval("Frequency").ToString() == "4" ? ((Eval("EngineHrsOnDue") != DBNull.Value ? Eval("EngineHrsOnDue").ToString() + " hrs; " : "") + Eval("DueOn").ToString() + Eval("DistanceUnits").ToString()) 
                                                                    : ((Eval("EngineHrsOnDue") != DBNull.Value ? Eval("EngineHrsOnDue").ToString() + " hrs; " : "") + (Eval("OdometerReadingOnDue") != DBNull.Value ? "" : ""))))) %>'
                                                                    ForeColor='<%# Convert.ToInt64(Eval("Nearing").ToString()) >= 100 ? System.Drawing.Color.Red : ((Convert.ToInt64(Eval("Nearing").ToString()) >= 90 && Convert.ToInt64(Eval("Nearing").ToString()) < 100) ? System.Drawing.Color.Purple : System.Drawing.Color.Black) %>'></asp:Label>
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <%--CurrentReadings--%>
                                                        <dxw:GridViewDataColumn FieldName="CurrentValues" Caption="Current Date" VisibleIndex="5"
                                                            Width="10%">
                                                            <DataItemTemplate>
                                                                <asp:Label ID="glblCurrentReading" runat="server" Text='<%# Eval("CurrentValues").ToString() %>'
                                                                    ForeColor='<%# Convert.ToInt64(Eval("Nearing").ToString()) >= 100 ? System.Drawing.Color.Red : ((Convert.ToInt64(Eval("Nearing").ToString()) >= 90 && Convert.ToInt64(Eval("Nearing").ToString()) < 100) ? System.Drawing.Color.Purple : System.Drawing.Color.Black) %>'></asp:Label>
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataColumn FieldName="Overduebynew" Caption="Overdue By" VisibleIndex="6"
                                                            Width="10%">
                                                            <DataItemTemplate>
                                                                <asp:Label ID="glblDueBy" runat="server" Text='<%# ((Eval("Frequency").ToString() == "3" || Eval("Frequency").ToString() == "4") ? Eval("Dueby").ToString() : Eval("Dueby").ToString()) %>'
                                                                    ForeColor='<%# Convert.ToInt64(Eval("Nearing").ToString()) >= 100 ? System.Drawing.Color.Red : ((Convert.ToInt64(Eval("Nearing").ToString()) >= 90 && Convert.ToInt64(Eval("Nearing").ToString()) < 100) ? System.Drawing.Color.Purple : System.Drawing.Color.Black) %>'></asp:Label>
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataColumn FieldName="Nearing" Caption="Nearing (%)" VisibleIndex="7"
                                                            Width="7%">
                                                            <DataItemTemplate>
                                                                <asp:Label ID="glblNearing" runat="server" Text='<%# Eval("Nearing").ToString() %>'
                                                                    ForeColor='<%# Convert.ToInt64(Eval("Nearing").ToString()) >= 100 ? System.Drawing.Color.Red : ((Convert.ToInt64(Eval("Nearing").ToString()) >= 90 && Convert.ToInt64(Eval("Nearing").ToString()) < 100) ? System.Drawing.Color.Purple : System.Drawing.Color.Black) %>'></asp:Label>
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataColumn FieldName="ReScheduledOnSort" Caption="Scheduled On" VisibleIndex="8"
                                                            CellStyle-HorizontalAlign="Center" Width="7%">
                                                            <DataItemTemplate>
                                                                <asp:Label ID="glblReScheduledOn" runat="server" Text='<%# Eval("ReScheduledOn") %>'
                                                                    ForeColor='<%# Convert.ToInt64(Eval("Nearing").ToString()) >= 100 ? System.Drawing.Color.Red : ((Convert.ToInt64(Eval("Nearing").ToString()) >= 90 && Convert.ToInt64(Eval("Nearing").ToString()) < 100) ? System.Drawing.Color.Purple : System.Drawing.Color.Black) %>'></asp:Label>
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataTextColumn VisibleIndex="9" Width="3%" Settings-AllowDragDrop="False">
                                                            <DataItemTemplate>
                                                                <a style="cursor: hand;">
                                                                    <asp:LinkButton ID="btnEdit" runat="server" CommandName="Service" CommandArgument='<%# Eval("ServiceDetailsId").ToString() + "," + Eval("PlanId").ToString() + "," + Eval("CurrentReadings").ToString() + "," + Eval("IsRecurring").ToString() + "," + Eval("Frequency").ToString() + "," + Eval("DueOn").ToString() + "," + Eval("ServiceInterval").ToString() %>'
                                                                        alternatetext="Service Device" OnClientClick="document.getElementById('divMsg').innerHTML=''; ShowPopUp();" OnClick="btnEdit_Click"
                                                                        ToolTip="Click here to enter service details" CssClass="btn-fa-cogs" Text=" ">
                                                                    </asp:LinkButton>
                                                                </a>
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataTextColumn>
                                                        <dxw:GridViewDataTextColumn VisibleIndex="10" Width="3%" Settings-AllowDragDrop="False">
                                                            <DataItemTemplate>
                                                                <a style="cursor: hand;">
                                                                    <asp:LinkButton ID="btnRescheduleService" runat="server" CommandName="Reschedule" CommandArgument='<%# Eval("ServiceDetailsId").ToString() %>'
                                                                        alternatetext="Reschedule Service" OnClientClick="document.getElementById('divMsg').innerHTML=''; ShowPopUp();" OnClick="btnRescheduleService_Click"
                                                                        ToolTip="Click here to rescheduling service" CssClass="btn-fa-repeat" Text=" ">
                                                                    </asp:LinkButton>
                                                                </a>
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataTextColumn>
                                                        <dxw:GridViewDataTextColumn VisibleIndex="11" Width="3%" Settings-AllowDragDrop="False">
                                                            <DataItemTemplate>
                                                                <asp:HiddenField ID="hdnSkipStatus" runat="server" Value='<%# Eval("SkipStatus").ToString() %>' />
                                                                <a style="cursor: hand;">
                                                                    <asp:LinkButton ID="btnSkip" runat="server" CommandName="Skip" CommandArgument='<%# Eval("ServiceDetailsId").ToString() + "," + Eval("CurrentReadings").ToString() + "," + Eval("IsRecurring").ToString() + "," + Eval("Frequency").ToString() + "," + Eval("DueOn").ToString() + "," + Eval("ServiceInterval").ToString() %>'
                                                                        alternatetext="Skip Service" OnClientClick="return ValidateSkipOption(this.id);" OnClick="btnSkip_Click"
                                                                        ToolTip="Click here to skip the service" CssClass="btn-fa-angle-double-right" Text=" ">

                                                                    </asp:LinkButton>
                                                                </a>
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataTextColumn>
                                                        <%--<dxw:GridViewDataTextColumn VisibleIndex="11" Width="25px" Settings-AllowDragDrop="False">
                                                            <DataItemTemplate>
                                                                <a style="cursor:hand;"><asp:ImageButton ID="btnDelete" runat="server" AlternateText="Dismiss Service" CommandName="Dismiss"
                                                                    ImageUrl="~/images/delete-icon.gif" ToolTip="Click here to dismiss the service"
                                                                    ImageAlign="Middle" OnClick="btnDelete_Click" OnClientClick="CategoryPopup(true, 3);" /></a>
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataTextColumn>--%>
                                                    </Columns>
                                                    <Settings ShowFilterRow="false" ShowGroupPanel="false" ShowStatusBar="Auto" />
                                                    <SettingsBehavior ColumnResizeMode="Disabled" AllowSort="true" AllowDragDrop="true"
                                                        AllowGroup="false" AllowFocusedRow="false" />
                                                    <Styles CssFilePath="~/App_Themes/Office2003Blue/GridView/grid.css" AlternatingRow-Enabled="True"
                                                        CssPostfix="Office2003_Blue">
                                                        <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                                        </Header>
                                                        <LoadingPanel ImageSpacing="10px">
                                                        </LoadingPanel>
                                                        <PagerBottomPanel CssClass="PageFooter">
                                                        </PagerBottomPanel>
                                                        <PagerTopPanel CssClass="PageFooter">
                                                        </PagerTopPanel>
                                                    </Styles>
                                                    <SettingsPager PrevPageButton-Image-Url="../App_Themes/Office2003Blue/GridView/pPrev.gif"
                                                        PrevPageButton-Image-UrlDisabled="../App_Themes/Office2003Blue/GridView/pPrevDisabled.gif"
                                                        NextPageButton-Image-UrlDisabled="../App_Themes/Office2003Blue/GridView/pNextDisabled.gif"
                                                        NextPageButton-Image-Url="../App_Themes/Office2003Blue/GridView/pNext.gif" AlwaysShowPager="true"
                                                        PageSize="10">
                                                    </SettingsPager>
                                                </dxw:ASPxGridView>
                                            </div>
                                            <dxw:ASPxGridViewExporter ID="ASPxGridViewExporter1" runat="server" GridViewID="gvNearingMaintenance"
                                                OnRenderBrick="ASPxGridViewExporter1_RenderBrick"
                                                ReportHeader="{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}}\viewkind4\uc1\pard\qc\b\fs28 Alert Details\fs24\par\pard\par\par}">
                                                <PageFooter Right="[Page # of Pages #]">
                                                </PageFooter>
                                            </dxw:ASPxGridViewExporter>
                                            <asp:HiddenField ID="hdnTimeBasedStartDate" runat="server" />
                                            <asp:HiddenField ID="hdnCloseServices" runat="server" />
                                            <asp:HiddenField ID="hdnDistance" runat="server" />
                                            <asp:HiddenField ID="hdnFrequency" runat="server" />
                                            <asp:HiddenField ID="hdnOprType" runat="server" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </asp:Panel>
                </ContentTemplate>
                <Triggers>
                    <asp:PostBackTrigger ControlID="btnExport" />
                </Triggers>
            </asp:UpdatePanel>
            <asp:HiddenField ID="hdnbtnName" runat="server" />
            <asp:Panel ID="pnlServiceDetails" runat="server" Style="display: none;" CssClass="searchPanel">
                <asp:UpdatePanel ID="upServiceDetails" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <div class="popup">
                            <div class="top">
                                <h1>
                                    <asp:Label ID="lblServiceDetailsHeading" Text="Service Details" runat="server"></asp:Label></h1>
                                <div class="close">
                                    <%--  <asp:ImageButton ID="ibtClose" runat="server" OnClientClick="CategoryPopup(false);"
                                        ImageUrl="~/Images/popup-close.gif" />--%>
                                    <asp:LinkButton ID="ibtClose" runat="server" CssClass="Map-btn-fa-times-circle-o" OnClientClick="CategoryPopup(false);"></asp:LinkButton>
                                </div>
                                <div class="clear clearfix"></div>
                            </div>
                            <div class="popup-content">
                                <div class="form-horizontal">
                                    <div class="form-tbl">
                                        <div class="form-group" id="trExecutedOn" runat="server">
                                            <div class="col-md-12">
                                                <div class="col-sm-2 padding-width-sm icon-img override-col-width">
                                                    Executed On
                                            <%--<span class="redtxt">*</span>--%>
                                                </div>
                                                <div class="col-sm-6 col-md-4 padding-width-sm">
                                                    <div class="input-group" id="dtExecutedOn" runat="server">
                                                        <asp:HiddenField runat="server" ID="hdnDateFormatSH" Value="dd-MMM-yyyy" />
                                                        <asp:TextBox ID="txtExecutedOn" runat="server" CssClass="form-control man-dat" oncopy="return false"
                                                            oncut="return false" onkeydown="doCheckBackSpaceOrDelete()" onkeypress="return false"
                                                            onpaste="return false" ToolTip="dd-MMM-yyyy HH:mm tt" />
                                                        <div class="input-group-addon" style="cursor: pointer">
                                                            <i class="fa fa-calendar"></i>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div id="trServiced">
                                            <div class="vlive-filter" style="padding-right: 0px; padding-left: 0px;">
                                                <div class="container-fluid" style="padding-right: 0px; padding-left: 0px;">
                                                    <div class="vlive-centrifugal-fan maintenance-plan">
                                                        <div class="col-ks-16 vlive-header_VXL">
                                                            <div class="col-ks-16">
                                                                <asp:Label ID="lblservice" runat="server" CssClass="pnlhearder" Text="Services List"></asp:Label>
                                                                <%--<span class="redtxt">*</span>--%>
                                                            </div>
                                                        </div>
                                                        <div class="row ftop">
                                                            <div class="col-md-12">
                                                                <dxw:ASPxGridView ID="gvServiceDetails" runat="server" Width="100%" KeyFieldName="ServiceId" ClientInstanceName="gvServiceDetails"
                                                                    CssFilePath="~/App_Themes/Office2003Blue/GridView/styles.css" CssPostfix="Office2003_Blue"
                                                                    EnableTheming="true" Theme="Office2003Blue" OnHtmlRowPrepared="gvServiceDetails_OnHtmlRowPrepared"
                                                                    OnCustomJSProperties="gvServiceDetails_CustomJSProperties" ClientIDMode="AutoID">
                                                                    <%--<Images ImageFolder="~/App_Themes/Office2003Blue/GridView/">
                                                                <CollapsedButton Height="12px" Url="~/App_Themes/Office2003Blue/GridView/gvCollapsedButton.png"
                                                                    Width="11px" />
                                                                <ExpandedButton Height="12px" Url="~/App_Themes/Office2003Blue/GridView/gvExpandedButton.png"
                                                                    Width="11px" />
                                                                <DetailCollapsedButton Height="12px" Url="~/App_Themes/Office2003Blue/GridView/gvCollapsedButton.png"
                                                                    Width="11px" />
                                                                <DetailExpandedButton Height="12px" Url="~/App_Themes/Office2003Blue/GridView/gvExpandedButton.png"
                                                                    Width="11px" />
                                                            </Images>--%>
                                                                    <Styles CssFilePath="~/App_Themes/Office2003Blue/GridView/grid.css" AlternatingRow-Enabled="True"
                                                                        CssPostfix="Office2003_Blue">
                                                                        <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                                                        </Header>
                                                                        <LoadingPanel ImageSpacing="10px">
                                                                        </LoadingPanel>
                                                                        <PagerBottomPanel CssClass="PageFooter">
                                                                        </PagerBottomPanel>
                                                                        <PagerTopPanel CssClass="PageFooter">
                                                                        </PagerTopPanel>
                                                                    </Styles>
                                                                    <SettingsPager PrevPageButton-Image-Url="../App_Themes/Office2003Blue/GridView/pPrev.gif"
                                                                        PrevPageButton-Image-UrlDisabled="../App_Themes/Office2003Blue/GridView/pPrevDisabled.gif"
                                                                        NextPageButton-Image-UrlDisabled="../App_Themes/Office2003Blue/GridView/pNextDisabled.gif"
                                                                        NextPageButton-Image-Url="../App_Themes/Office2003Blue/GridView/pNext.gif" AlwaysShowPager="true"
                                                                        PageSize="5">
                                                                    </SettingsPager>
                                                                    <Columns>
                                                                        <dxw:GridViewDataColumn FieldName="ServiceId" Caption="AutoID" VisibleIndex="0"
                                                                            Visible="false">
                                                                        </dxw:GridViewDataColumn>
                                                                        <dxw:GridViewDataTextColumn VisibleIndex="1" Width="5%" Caption="Services">
                                                                            <%--<HeaderTemplate>
                                                                        <input type="checkbox" onclick="gvServiceDetails.SelectAllRowsOnPage(this.checked);"
                                                                            style="vertical-align: middle;" title="Select/Unselect all rows on the page"></input>
                                                                    </HeaderTemplate>--%>
                                                                            <HeaderCaptionTemplate>
                                                                                <asp:CheckBox ID="chkSelectAllServices" ToolTip="Select all in the current page"
                                                                                    runat="server" onclick="DevExpressGridCheckAll(5);" Text="" />
                                                                            </HeaderCaptionTemplate>
                                                                            <DataItemTemplate>
                                                                                <asp:CheckBox ID="chkServices" runat="server" Text="" onclick="CheckListOfServiceIDs(this, 'hdnServiced', 5);DevExpressGridCheckOrUnCheckSelectAll(5);" />
                                                                            </DataItemTemplate>
                                                                            <HeaderStyle Paddings-PaddingTop="1" Paddings-PaddingBottom="1" HorizontalAlign="Center" />
                                                                            <CellStyle HorizontalAlign="Center" />
                                                                        </dxw:GridViewDataTextColumn>
                                                                        <dxw:GridViewDataColumn FieldName="ServiceName" Caption="Service Name" VisibleIndex="2"
                                                                            Width="25%">
                                                                            <Settings AllowAutoFilter="False" AllowSort="False" />
                                                                        </dxw:GridViewDataColumn>
                                                                        <dxw:GridViewDataColumn FieldName="Description" Caption="Description" VisibleIndex="3"
                                                                            Width="40%" CellStyle-Wrap="True">
                                                                            <Settings AllowAutoFilter="False" AllowSort="False" />
                                                                        </dxw:GridViewDataColumn>
                                                                        <dxw:GridViewDataColumn FieldName="PlannedCost" Caption="Planned Cost" VisibleIndex="4"
                                                                            Width="10%">
                                                                            <Settings AllowAutoFilter="False" AllowSort="False" />
                                                                        </dxw:GridViewDataColumn>
                                                                        <dxw:GridViewDataColumn Caption="Serviced On" VisibleIndex="5" Width="12%">
                                                                            <DataItemTemplate>
                                                                                <asp:HiddenField ID="ghdnServiceId" runat="server" Value='<%# Eval("ServiceId") %>' />
                                                                                <asp:TextBox ID="gtxtServicedOn" runat="server" CssClass="form-control man-dat" oncopy="return false"
                                                                                    oncut="return false" onkeydown="doCheckBackSpaceOrDelete()" onkeypress="return false"
                                                                                    onpaste="return false" ToolTip="dd-MMM-yyyy" Text='<%# (Eval("ServicedOn") == DBNull.Value ? Eval("ServicedOn") : Convert.ToDateTime(Eval("ServicedOn")).ToString("dd-MMM-yyyy")) %>'
                                                                                    ClientIDMode="AutoID"/>
                                                                            </DataItemTemplate>
                                                                            <Settings AllowAutoFilter="False" AllowSort="False" />
                                                                        </dxw:GridViewDataColumn>
                                                                        <dxw:GridViewDataColumn Caption="Service Cost" VisibleIndex="6" Width="8%">
                                                                            <DataItemTemplate>
                                                                                <asp:TextBox ID="gtxtServiceCost" runat="server" MaxLength="10" oncopy="return false" CssClass="form-control man-dat"
                                                                                    ondrop="return false" onpaste="return false" Text='<%# Eval("ServiceCost") %>'
                                                                                    Style="text-align: right;" onkeypress="return chkDecNums(event, this);" />
                                                                            </DataItemTemplate>
                                                                            <Settings AllowAutoFilter="False" AllowSort="False" />
                                                                        </dxw:GridViewDataColumn>
                                                                    </Columns>
                                                                    <Settings ShowFilterRow="False" ShowFilterRowMenu="True" />
                                                                    <SettingsText EmptyDataRow=" No Assigned Devices found" />
                                                                </dxw:ASPxGridView>
                                                                <asp:HiddenField ID="hdnServiced" runat="server" />
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group" id="trComment" runat="server">
                                            <div class="col-md-12">
                                                <div class="col-sm-2 padding-width-sm icon-img">
                                                    Comments
                                                </div>
                                                <div class="col-sm-6 col-md-4 padding-width-sm">
                                                    <asp:TextBox ID="txtComment" TextMode="MultiLine" runat="server" Rows="2" CssClass="form-control"
                                                        MaxLength="250" onkeypress="return chkDescription(event,this,249);" onblur="return disallowScriptTags(this);" Style="resize: none;"></asp:TextBox>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group" id="trNextScheduleFrom" runat="server">
                                            <div class="col-md-12">
                                                <div class="col-sm-2 padding-width-sm icon-img">
                                                    Next Schedule From
                                                </div>
                                                <div class="col-sm-6 col-md-4 padding-width-sm">
                                                    <div class="col-xs-4 col-sm-6">
                                                        <asp:RadioButton ID="rbtDueOn" runat="server" Text="Due On" GroupName="NextSchedule"
                                                            Checked="true" OnCheckedChanged="NextScheduleChanged" AutoPostBack="true" CssClass="radio" />
                                                    </div>
                                                    <div class="col-xs-8 col-sm-6">
                                                        <asp:RadioButton ID="rbtLastService" runat="server" Text="Executed On" GroupName="NextSchedule"
                                                            OnCheckedChanged="NextScheduleChanged" AutoPostBack="true" onclick="CheckExecutionDate();" CssClass="radio" />
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group" id="trNextScheduleOn" runat="server">
                                            <div class="col-md-12">
                                                <div class="col-sm-2 padding-width-sm icon-img">
                                                    Next Schedule On
                                                </div>
                                                <div class="col-sm-6 col-md-4 padding-width-sm">
                                                    <asp:Label ID="lblNextScheduleOn" runat="server" Text="2000 km"></asp:Label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group" runat="server" id="trPostpone">
                                            <div class="col-md-12">
                                                <div class="col-sm-2 padding-width-sm icon-img">
                                                    <asp:Label ID="lblDueOnDate" runat="server" Text="Due On Date"></asp:Label>

                                                </div>
                                                <div class="col-sm-3 col-md-2 padding-width-sm">
                                                    <div class="input-group" id="dtDueOnDate" runat="server">
                                                        <asp:TextBox ID="txtDueOnDate" runat="server" CssClass="form-control man-dat" oncopy="return false"
                                                            oncut="return false" onkeydown="doCheckBackSpaceOrDelete()" onkeypress="return false"
                                                            onpaste="return false" ToolTip="dd-MMM-yyyy"></asp:TextBox>
                                                        <div class="input-group-addon" style="cursor: pointer">
                                                            <i class="fa fa-calendar"></i>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group" runat="server" id="trComments">
                                            <div class="col-md-12">
                                                <div class="col-sm-2 padding-width-sm icon-img">
                                                    <asp:Label ID="lblComments" runat="server" Text="Comments"></asp:Label>

                                                </div>
                                                <div class="col-sm-6 col-md-4 padding-width-sm">
                                                    <asp:TextBox ID="txtComments" TextMode="MultiLine" runat="server" Rows="5" CssClass="form-control man-dat"
                                                        MaxLength="250" onkeypress="return chkDescription(event,this,249);" onblur="return disallowScriptTags(this);"></asp:TextBox>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-md-12">
                                                <div class="col-sm-2 padding-width-sm icon-img override-col-width">
                                                    <span class="redtxt">|</span>&nbsp;<asp:Label ID="lblIndicatesMandatory" runat="server"
                                                        Text="Required Fields"></asp:Label>
                                                </div>
                                                <div class="col-sm-6 padding-width-sm" runat="server" id="tdClose">
                                                    <div class="col-xs-12">
                                                        <asp:CheckBox ID="chkIsCompleted" runat="server" Text="Skip the remaining services and close the plan"
                                                            Checked="false" CssClass="checkbox" />
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-md-12">
                                                <div class="col-xs-3"></div>
                                                <div class="col-xs-9 padding-width-sm" align="right">
                                                    <asp:LinkButton ID="btnSaveServiceDetails" runat="server" CausesValidation="true"
                                                        OnClientClick="return ValidateNearingMaintenance()"
                                                        OnClick="btnSaveServiceDetails_Click" Text="&nbsp;&nbsp;Save" CssClass="btn btn-fa-floppy-o btn-primary" />
                                                    <asp:LinkButton ID="btnCancelServiceDetails" runat="server" CssClass="btn btn-fa-ban btn-primary" Text="&nbsp;&nbsp;Cancel"
                                                        CausesValidation="false" OnClientClick="CategoryPopup(false);" OnClick="btnCancelServiceDetails_Click"
                                                        onkeydown="return Keyfocus();" />
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div id="divMsg" runat="server" align="center" style="font-weight: bold;">
                                    </div>
                                    <div class="clearfix"></div>
                                </div>
                            </div>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </asp:Panel>
            <asp:Panel ID="pnlVehicleInfo" runat="server" Style="display: none;" CssClass="searchPanel">
                <asp:UpdatePanel ID="upVehicleInfo" runat="server">
                    <ContentTemplate>
                        <div class="popup">
                            <div class="top">
                                <h1>Device Details</h1>
                                <div class="close">
                                    <asp:LinkButton ID="ibVehicleInfoClose" runat="server" OnClientClick="VehicleInformation(false);" CssClass="Map-btn-fa-times-circle-o" />
                                </div>
                                <div class="clear clearfix"></div>
                            </div>
                            <div class="popup-cont">
                                <div class="col-sm-12 nullpadding">
                                    <div class="vlive-filter">
                                        <div class="container-fluid">
                                            <div class="vlive-centrifugal-fan maintenance-plan">
                                                <div class="col-ks-16 vlive-header_VXL">
                                                    <div class="col-ks-16">
                                                        Details
                                                    </div>
                                                </div>
                                                <div class="row ftop">
                                                    <div class="col-md-12">
                                                        <div class="table-responsive">
                                                            <dxw:ASPxGridView ID="gvVehiclePlan" ClientInstanceName="gvVehiclePlan" runat="server"
                                                                KeyFieldName="ServiceDetailsId" AutoGenerateColumns="False" Width="100%"
                                                                CssFilePath="~/App_Themes/Office2003Blue/GridView/grid.css" CssPostfix="Office2003_Blue"
                                                                EnableTheming="True" Theme="Office2003Blue">
                                                                <Styles CssFilePath="~/App_Themes/Office2003Blue/GridView/grid.css" CssPostfix="Office2003_Blue">
                                                                    <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                                                    </Header>
                                                                    <AlternatingRow Enabled="True">
                                                                    </AlternatingRow>
                                                                    <PagerTopPanel CssClass="PageFooter">
                                                                    </PagerTopPanel>
                                                                    <PagerBottomPanel CssClass="PageFooter">
                                                                    </PagerBottomPanel>
                                                                    <LoadingPanel ImageSpacing="10px">
                                                                    </LoadingPanel>
                                                                </Styles>
                                                                <SettingsPager AlwaysShowPager="True" PageSize="5">
                                                                    <NextPageButton>
                                                                        <Image Url="../App_Themes/Office2003Blue/GridView/pNext.gif" UrlDisabled="../App_Themes/Office2003Blue/GridView/pNextDisabled.gif" />
                                                                    </NextPageButton>
                                                                    <PrevPageButton>
                                                                        <Image Url="../App_Themes/Office2003Blue/GridView/pPrev.gif" UrlDisabled="../App_Themes/Office2003Blue/GridView/pPrevDisabled.gif" />
                                                                    </PrevPageButton>
                                                                </SettingsPager>
                                                                <Columns>
                                                                    <dxw:GridViewDataColumn FieldName="PlanName" Caption="Plan Name" VisibleIndex="0"
                                                                        Width="10%">
                                                                        <HeaderCaptionTemplate>
                                                                            <table cellpadding="0" cellspacing="0" border="0">
                                                                                <tr>
                                                                                    <td style="height: 20px; padding-top: 5px">
                                                                                        <asp:Label ID="lblgPlanNameH" runat="server" Text="Plan Name"></asp:Label>
                                                                                    </td>
                                                                                </tr>
                                                                            </table>
                                                                        </HeaderCaptionTemplate>
                                                                        <Settings AllowAutoFilter="True" />
                                                                    </dxw:GridViewDataColumn>
                                                                    <dxw:GridViewDataColumn FieldName="ServicesPlanned" Caption="Services Planned" VisibleIndex="1"
                                                                        Width="52%">
                                                                        <CellStyle Wrap="True">
                                                                        </CellStyle>
                                                                        <Settings AllowAutoFilter="False" />
                                                                    </dxw:GridViewDataColumn>
                                                                    <dxw:GridViewDataColumn FieldName="ServiceType" Caption="Service Type" VisibleIndex="2"
                                                                        Width="9%">
                                                                        <Settings AllowAutoFilter="False" />
                                                                    </dxw:GridViewDataColumn>
                                                                    <dxw:GridViewDataColumn FieldName="ServiceInterval" Caption="Service Interval" VisibleIndex="3"
                                                                        Width="9%">
                                                                        <Settings AllowAutoFilter="False" />
                                                                    </dxw:GridViewDataColumn>
                                                                    <dxw:GridViewDataColumn FieldName="CurrentReading" Caption="Current" VisibleIndex="4"
                                                                        Width="10%">
                                                                        <DataItemTemplate>
                                                                            <asp:Label ID="glblvCurrentReading" runat="server" Text='<%# (Eval("ServiceType").ToString() == "2" ? DateTime.Now.ToString("dd-MMM-yyyy") : Eval("CurrentReading").ToString()) %>'>
                                                                            </asp:Label>
                                                                        </DataItemTemplate>
                                                                        <Settings AllowAutoFilter="False" />
                                                                    </dxw:GridViewDataColumn>
                                                                    <dxw:GridViewDataColumn FieldName="DueOn" Caption="Due On" VisibleIndex="5" Width="10%">
                                                                        <DataItemTemplate>
                                                                            <asp:Label ID="glblvDueOn" runat="server" Text='<%# (Eval("ServiceType").ToString() == "2" ? Convert.ToDateTime(Eval("DueOn").ToString()).ToString("dd-MMM-yyyy") : Eval("DueOn").ToString()) %>'></asp:Label>
                                                                        </DataItemTemplate>
                                                                        <Settings AllowAutoFilter="False" />
                                                                    </dxw:GridViewDataColumn>
                                                                </Columns>
                                                                <SettingsBehavior AllowGroup="False" />
                                                                <Settings ShowFilterRow="True" ShowFilterRowMenu="True" />
                                                            </dxw:ASPxGridView>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <cc1:TabContainer ID="tcVehicleDetails" runat="server" ActiveTabIndex="1" Visible="false">
                                        <cc1:TabPanel ID="tpVehicleDetails" runat="server" HeaderText="Device Information" Visible="false">
                                            <HeaderTemplate>Device Information</HeaderTemplate>
                                            <ContentTemplate>
                                                <div class="form-horizontal padding-sm-lrt">
                                                    <div class="col-xs-12">
                                                        <div class="form-group">
                                                            <div class="col-sm-2 padding-width-sm icon-img" style="font-weight: bold; font-family: Arial, Helvetica, sans-serif;">
                                                                <asp:Label ID="lblVNameH" runat="server" Text="Device name" Style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;"></asp:Label>
                                                            </div>
                                                            <div class="col-sm-3 padding-width-sm">
                                                                <asp:Label ID="lblVehicleName" runat="server" Style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;"></asp:Label>
                                                            </div>
                                                        </div>
                                                        <div class="form-group">
                                                            <div class="col-sm-2 padding-width-sm icon-img" style="font-weight: bold; font-family: Arial, Helvetica, sans-serif;">
                                                                <asp:Label ID="lblVINH" runat="server" Text="VIN" Style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;"></asp:Label>
                                                            </div>
                                                            <div class="col-sm-3 padding-width-sm">
                                                                <asp:Label ID="lblVIN" runat="server" Style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;"></asp:Label>
                                                            </div>
                                                        </div>
                                                        <div class="form-group">
                                                            <div class="col-sm-2 padding-width-sm icon-img" style="font-weight: bold; font-family: Arial, Helvetica, sans-serif;">
                                                                <asp:Label ID="lblLICPlateH" runat="server" Text="License Plate" Style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;"></asp:Label>
                                                            </div>
                                                            <div class="col-sm-3 padding-width-sm">
                                                                <asp:Label ID="lblLICPlate" runat="server" Style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;"></asp:Label>
                                                            </div>
                                                        </div>
                                                        <div class="form-group">
                                                            <div class="col-sm-2 padding-width-sm icon-img" style="font-weight: bold; font-family: Arial, Helvetica, sans-serif;">
                                                                <asp:Label ID="lblMakeH" runat="server" Text="Make" Style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;"></asp:Label>
                                                            </div>
                                                            <div class="col-sm-3 padding-width-sm">
                                                                <asp:Label ID="lblMake" runat="server" Style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;"></asp:Label>
                                                            </div>
                                                        </div>
                                                        <div class="form-group">
                                                            <div class="col-sm-2 padding-width-sm icon-img" style="font-weight: bold; font-family: Arial, Helvetica, sans-serif;">
                                                                <asp:Label ID="lblModelH" runat="server" Text="Model" Style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;"></asp:Label>
                                                            </div>
                                                            <div class="col-sm-3 padding-width-sm">
                                                                <asp:Label ID="lblModel" runat="server" Style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;"></asp:Label>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="clearfix"></div>
                                                </div>
                                            </ContentTemplate>
                                        </cc1:TabPanel>
                                        <cc1:TabPanel ID="tpVehiclePlan" runat="server" HeaderText="Device Plan">
                                            <HeaderTemplate>Device Plan</HeaderTemplate>
                                            <ContentTemplate>
                                            </ContentTemplate>
                                        </cc1:TabPanel>
                                    </cc1:TabContainer>
                                </div>
                                <div class="clear clearfix"></div>
                            </div>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </asp:Panel>
            <cc1:ModalPopupExtender ID="mpeProgressIndicator" runat="server" PopupControlID="progressPopUp"
                TargetControlID="btnTesting" BackgroundCssClass="modalBackground">
            </cc1:ModalPopupExtender>
            <asp:Button ID="btnTesting" Style="display: none;" runat="server" />
            <asp:Panel ID="progressPopUp" runat="server" CssClass="processMessage" Style="z-index: 1000; display: none;">
                <center>
                    <br />
                    <img alt="Please Wait ..." src="../images/47.gif" /><br />
                    <br />
                    <asp:Label ID="lbl_msg12" Text="Processing... Please Wait..." runat="server" CssClass="specialdisplay"></asp:Label>
                    <br />
                    <br />
                </center>
            </asp:Panel>
        </form>
    </div>
    <!-- Content Ends Here -->
    <uc2:Footer ID="ucFooter" runat="server" />
    <script type="text/javascript" language="javascript" src="../js/DateValidations.js"></script>
    <script src="../js/myformvalidations.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        function ValidateSkipOption(id) {
            var skipStatus = document.getElementById(id.replace("btnSkip", "hdnSkipStatus")).value;
            if (skipStatus == 1) {
                document.getElementById('divMsg').innerHTML = '';
                ShowPopUp();
            }
            else {
                alert('Cannot skip the plan. Some of the services have been already closed.');
                return false;
            }
            return true;
        }
        function CategoryPopup(isShow, type, isClear, isRecurring) {
            var isIE = CheckBrowser();
            if (!isShow) {
                document.getElementById('hdnServiced').value = "";
                document.getElementById('hdnOprType').value = "";
            }
            else {
                HidePopUp();
            }
            if (document.getElementById('pnlServiceDetails') != null) {
                document.getElementById('pnlServiceDetails').style.width = (type != 1) ? "400px" : "700px";
                document.getElementById('pnlServiceDetails').style.display = (isShow) ? "block" : "none";
            }
            if (document.getElementById('txtComments') != null && type != 1 && isClear == null) {
                document.getElementById('txtComments').value = "";
            }
            if (document.getElementById('txtDueOnDate') != null && type != 1 && isClear == null) {
                document.getElementById('txtDueOnDate').value = "";
            }
            if (document.getElementById('chkIsCompleted') != null) {
                document.getElementById('chkIsCompleted').checked = false;
            }
            if (isShow && type != null) {
                document.getElementById('trServiced').style.display = (type == 1) ? "block" : "none";           //(isIE ? "block" : "table-row") : "none";
                document.getElementById('tdClose').style.display = (type == 1) ? "block" : "none";           //(isIE ? "block" : "table-row") : "none";(isIE ? "block" : "table-row") : "none";
                //document.getElementById('lblNote').style.display = (type == 1) ? "block" : "none";           //(isIE ? "block" : "table-row") : "none";(isIE ? "block" : "table-row") : "none";
                document.getElementById('trPostpone').style.display = (type == 4) ? "block" : "none";           //(isIE ? "block" : "table-row") : "none";(isIE ? "block" : "table-row") : "none";
                document.getElementById('trComments').style.display = (type != 1) ? "block" : "none";           //(isIE ? "block" : "table-row") : "none";(isIE ? "block" : "table-row") : "none";
                if (isIE) {
                    document.getElementById('lblServiceDetailsHeading').innerText = (type == 1) ? "Service Details" : (type == 2) ? "Skip Service" : (type == 3) ? "Dismiss Service" : "Rescheduling Service";
                    document.getElementById('lblComments').innerText = (type == 1) ? "Comments" : (type == 2) ? "Reason" : (type == 3) ? "Reason" : "Comments";
                }
                else {
                    document.getElementById('lblServiceDetailsHeading').textContent = (type == 1) ? "Service Details" : (type == 2) ? "Skip Service" : (type == 3) ? "Dismiss Service" : "Rescheduling Service";
                    document.getElementById('lblComments').textContent = (type == 1) ? "Comments" : (type == 2) ? "Reason" : (type == 3) ? "Reason" : "Comments";
                }
                document.getElementById('pnlServiceDetails').focus();
            }
            document.getElementById('trComment').style.display = (type == 1) ? "block" : "none";           //(isIE ? "block" : "table-row") : "none";(isIE ? "block" : "table-row") : "none";
            document.getElementById('trExecutedOn').style.display = (type == 1) ? "block" : "none";           //(isIE ? "block" : "table-row") : "none";(isIE ? "block" : "table-row") : "none";
            document.getElementById('trNextScheduleFrom').style.display = ((type == 1 && (isRecurring != null && isRecurring)) || (isRecurring != null && isRecurring)) ? "block" : "none";           //(isIE ? "block" : "table-row") : "none";(isIE ? "block" : "table-row") : "none";
            document.getElementById('trNextScheduleOn').style.display = ((type == 1 && (isRecurring != null && isRecurring)) || (isRecurring != null && isRecurring)) ? "block" : "none";           //(isIE ? "block" : "table-row") : "none";(isIE ? "block" : "table-row") : "none";
        }
        function ShowHideInterval() {
            if (document.getElementById('ddlDuration') != null)
                document.getElementById('ddlDuration').style.display = document.getElementById('ddlServiceType').value == 2 ? "block" : "none";
            if (document.getElementById('lblDuration') != null)
                document.getElementById('lblDuration').style.display = document.getElementById('ddlServiceType').value == 2 ? "block" : "none";
            if (document.getElementById('divDuration') != null)
                document.getElementById('divDuration').style.display = document.getElementById('ddlServiceType').value == 2 ? "block" : "none";
            if (document.getElementById('imgInterval') != null)
                document.getElementById('imgInterval').style.display = document.getElementById('ddlServiceType').value == 2 ? "block" : "none";
        }
        function OnGridSelectionChanged() {
            gvServiceDetails.GetSelectedFieldValues('ServiceId', OnGridSelectionServiced);
        }
        function OnGridSelectionServiced(values) {
            var counter = document.getElementById("hdnServiced");
            counter.value = '';
            for (var i = 0; i < values.length; i++) {
                counter.value = counter.value + values[i] + ',';
            }
        }
        function CheckExecutionDate() {
            var isIE = CheckBrowser();
            var serviceDetailsHeading = "";
            serviceDetailsHeading = (isIE) ? document.getElementById('lblServiceDetailsHeading').innerText : document.getElementById('lblServiceDetailsHeading').textContent;
            var frequency = document.getElementById('hdnFrequency').value;
            if (serviceDetailsHeading == "Service Details" && (frequency == 0 || frequency == 1 || frequency == 2) && document.getElementById('txtExecutedOn') != null && document.getElementById('txtExecutedOn').value == "") {
                alert('Please enter the Execution On Date to calculate the Next Schedule On.');
                document.getElementById('rbtLastService').checked = true;
            }
        }
        function Keyfocus() {
            if (document.getElementById('trServiced').style.display.toString() != "none") {
                return setFocus(event, 'gvServiceDetails');
            }
            else if (document.getElementById('trPostpone').style.display.toString() != "none") {
                return setFocus(event, 'txtDueOnDate');
            }
            else {
                return setFocus(event, 'txtComments');
            }
        }
        //function StartHandler() {
        //    $jdp("[id$='_gtxtServicedOn']").datepicker({
        //        numberOfMonths: 1,
        //        showButtonPanel: true,
        //        dateFormat: 'dd-M-yy',
        //        changeYear: true,
        //        changeMonth: true,
        //        maxDate: '0',
        //        hideIfNoPrevNext: true,
        //        onSelect: RestrictTimeBasedSI,
        //        beforeShow: RestrictTimeBasedSI
        //    });
        //    $jdp('#txtExecutedOn').datepicker({
        //        numberOfMonths: 1,
        //        showButtonPanel: true,
        //        dateFormat: 'dd-M-yy',
        //        changeYear: true,
        //        changeMonth: true,
        //        maxDate: '0',
        //        hideIfNoPrevNext: true,
        //        onSelect: RestrictTimeBasedSI,
        //        beforeShow: RestrictTimeBasedSI
        //    });
        //    $jdp('#txtDueOnDate').datepicker({
        //        numberOfMonths: 1,
        //        showButtonPanel: true,
        //        dateFormat: 'dd-M-yy',
        //        changeYear: true,
        //        changeMonth: true,
        //        hideIfNoPrevNext: true,
        //        onSelect: RestrictTimeBasedSI,
        //        beforeShow: RestrictTimeBasedSI
        //    });
        //}
        function VehicleInformation(isShow, type) {
            if (isShow) {
                HidePopUp();
            }
            document.getElementById('pnlVehicleInfo').style.display = (isShow) ? "block" : "none";
        }
    </script>
    <script>
        function onfou(id) {
            var today = new Date();
            $(id).data("DateTimePicker").maxDate(today);
        }
    </script>
    <script type="text/javascript" src="../JQTimePicker/jquery-2.1.1.min.js"></script>
    <link id="Link3" runat="server" href="../css/Monitor_css/bootstrap-datetimepicker.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../JQTimePicker/moment-with-locales.js"></script>
    <script type="text/javascript" src="../js/Monitor_js/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript" src="../js/BDatePicker.js"></script>
</body>
</html>
