<%@ page language="C#" autoeventwireup="true" inherits="Forms_SchedulingReportsHistory, App_Web_5gbuhbxa" %>

<%@ 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.ASPxGridView.v8.2" Namespace="DevExpress.Web.ASPxGridView"
    TagPrefix="dxgv" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v8.2.Export" Namespace="DevExpress.Web.ASPxGridView.Export"
    TagPrefix="exp" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v8.2" Namespace="DevExpress.Web.ASPxEditors"
    TagPrefix="dxe" %>--%>
<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web" TagPrefix="dxw" %>
<!DOCTYPE html>
<html lang="en">
<head id="Head1" runat="server">
    <title>tSense-IoT Scheduled Reports</title>
    <%--<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" />--%>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <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="dropdown" runat="server" href="../css/dropdown.css" rel="stylesheet" type="text/css" />
    <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" />
    <%--Custom Theme for DevEx 14.2--%>
    <link id="GridView" type="text/css" href="~/App_Themes/Office2003Blue/GridView/grid.css" rel="stylesheet" />
    <link id="Editors" type="text/css" href="~/App_Themes/Office2003Blue/Editors/styles.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--%>
    <script src="../js/CommonFuncitonsInHeader.js" type="text/javascript"></script>
    <script src="../js/CustomAlert/CustomAlert.js" type="text/javascript"></script>
    <script src="../js/wow.min.js"></script>
</head>
<body class="white">
    <div class="page-wrapper">
        <div class="preloader"></div>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <!-- Header Starts Here -->
            <uc1:Header ID="ucHeader" runat="server" />
            <!-- Nav Ends Here -->
            <!-- Content Starts Here -->
            <asp:UpdatePanel runat="server" ID="updScheduleReports" UpdateMode="Conditional">
                <ContentTemplate>
                    <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="ltReports" 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:ImageButton ID="ibtnScheduleReports1" runat="server" ImageUrl="~/images/btn-schedule-report.jpg"
                                            PostBackUrl="~/Forms/ReportFilter.aspx?Type=2" Visible="false" />
                                        <asp:LinkButton ID="ibtnScheduleReports" runat="server" CssClass="btn btn-primary btn-fa-file-text-o" Text="&nbsp;&nbsp;Schedule Report">
                                        </asp:LinkButton>
                                        <asp:ImageButton ID="btnBack1" runat="server" ImageUrl="~/images/btn-back-to-reports.jpg"
                                            PostBackUrl="~/Forms/ReportFilter.aspx" Visible="false" />
                                        <asp:LinkButton ID="btnBack" runat="server" CssClass="fa-arrow-left btn btn-primary" PostBackUrl="~/Forms/ReportFilter.aspx" Text="&nbsp;&nbsp;Back to Report">
                                        </asp:LinkButton>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <asp:Panel ID="pnlSchedulingReportsList" 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-16">
                                            <asp:Label ID="lblScheduledReportsHeading" Text="Scheduled Reports" runat="server"></asp:Label>
                                        </div>
                                    </div>
                                    <div class="row ftop">
                                        <div class="col-md-12">
                                            <div class="col-ks-16">
                                                <div class="table-responsive">
                                                    <dxw:ASPxGridView ID="gvSchedulingReports" runat="server" Width="100%" KeyFieldName="ReportScheduleId"
                                                        CssFilePath="~/App_Themes/Office2003Blue/GridView/styles.css" CssPostfix="Office2003_Blue"
                                                        EnableTheming="true" Theme="Office2003Blue" OnHtmlRowCreated="gvSchedulingReports_OnHtmlRowCreated">
                                                        <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">
                                                        </SettingsPager>
                                                        <Columns>
                                                            <dxw:GridViewDataColumn FieldName="ReportScheduleId" Caption="Report Schedule ID"
                                                                VisibleIndex="0" Visible="false">
                                                            </dxw:GridViewDataColumn>
                                                            <dxw:GridViewDataTextColumn FieldName="ReportTypesName" Caption="Report Type" VisibleIndex="1"
                                                                HeaderStyle-HorizontalAlign="Center" CellStyle-Wrap="True" Width="9%">
                                                                <HeaderCaptionTemplate>
                                                                    <asp:Label ID="lblReportTypesName" runat="server" Text="Report Type" Font-Bold="false"></asp:Label>
                                                                </HeaderCaptionTemplate>
                                                                <Settings AllowAutoFilter="True" />
                                                            </dxw:GridViewDataTextColumn>
                                                            <dxw:GridViewDataTextColumn FieldName="FleetName" Caption="Fleet" VisibleIndex="2"
                                                                HeaderStyle-HorizontalAlign="Center" CellStyle-Wrap="True" Width="15%">
                                                                <HeaderCaptionTemplate>
                                                                    <asp:Label ID="lblFleetVehicle" runat="server" Text="Fleet - Vehicle" Font-Bold="false"></asp:Label>
                                                                </HeaderCaptionTemplate>
                                                                <DataItemTemplate>
                                                                    <asp:Label ID="lbFleetVehicle" runat="server" Text='<%# Eval("FleetName") + " - " + Eval("VehicleDescription") %>'></asp:Label>
                                                                </DataItemTemplate>
                                                                <Settings AllowAutoFilter="True" />
                                                            </dxw:GridViewDataTextColumn>
                                                            <dxw:GridViewDataTextColumn FieldName="EffectiveFromSort" Caption="Scheduled Duration"
                                                                VisibleIndex="3" HeaderStyle-HorizontalAlign="Center" CellStyle-Wrap="True" Width="13%">
                                                                <HeaderCaptionTemplate>
                                                                    <asp:Label ID="lblScheduledDuration" runat="server" Text="Scheduled Duration" Font-Bold="false"></asp:Label>
                                                                </HeaderCaptionTemplate>
                                                                <DataItemTemplate>
                                                                    <asp:Label ID="lbScheduledDuration" runat="server" Text='<%# Eval("EffectiveFrom") + " - " + (Eval("EffectiveTo")!= DBNull.Value ? Eval("EffectiveTo") : "No End Date")  %>'></asp:Label>
                                                                </DataItemTemplate>
                                                                <Settings AllowAutoFilter="False" />
                                                            </dxw:GridViewDataTextColumn>
                                                            <dxw:GridViewDataTextColumn FieldName="Frequency" Caption="Frequency" VisibleIndex="4"
                                                                HeaderStyle-HorizontalAlign="Center" Width="20%" CellStyle-Wrap="True">
                                                                <HeaderCaptionTemplate>
                                                                    <asp:Label ID="lblFrequency" runat="server" Text="Frequency" Font-Bold="false"></asp:Label>
                                                                </HeaderCaptionTemplate>
                                                                <DataItemTemplate>
                                                                    <asp:Label ID="lbFrequency" runat="server" Text='<%# Eval("Frequency") + "(" + 
                                                                  ((Convert.ToString(Eval("Frequency")).Equals("Daily") || Convert.ToString(Eval("Frequency")).Equals("Fortnightly"))? 
                                                                  (Convert.ToDateTime(Eval("ReportFrom")).ToString("hh:mm tt") + " - " + Convert.ToDateTime(Eval("ReportTo")).ToString("hh:mm tt") + " @ " + Convert.ToDateTime(Eval("GenerateReportOn")).ToString("hh:mm tt") + ")") :
                                                                    (Convert.ToString(Eval("Frequency")).Equals("Weekly") ? 
                                                                     (((DayOfWeek)(Convert.ToInt32(Eval("WeekDayFrom"))-1)).ToString() + " - " + ((DayOfWeek)(Convert.ToInt32(Eval("WeekDayTo"))-1)).ToString() + " on " + ((DayOfWeek)(Convert.ToInt32(Eval("WeekDayOn"))-1)).ToString() + " @ " + Convert.ToDateTime(Eval("GenerateReportOn")).ToString("hh:mm tt") + ")") :
                                                                      ("on " + Eval("DayOfMonth")+(Convert.ToInt32(Eval("DayOfMonth"))%10 == 1 ?  "st" : Convert.ToInt32(Eval("DayOfMonth")) %10 == 2?"nd": Convert.ToInt32(Eval("DayOfMonth")) %10 == 3?"rd": "th"  )+ " @ " + Convert.ToDateTime(Eval("GenerateReportOn")).ToString("hh:mm tt") + ")")))
                                                            %>'>
                                                                    </asp:Label>
                                                                </DataItemTemplate>
                                                                <Settings AllowAutoFilter="False" />
                                                            </dxw:GridViewDataTextColumn>
                                                            <dxw:GridViewDataTextColumn FieldName="EmailUserNameList" Caption="Email Users"
                                                                VisibleIndex="5" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle"
                                                                Width="12%" CellStyle-Wrap="True">
                                                                <HeaderCaptionTemplate>
                                                                    <asp:Label ID="lblEmailUserNameList" runat="server" Text=" Email Users" Font-Bold="false"></asp:Label>
                                                                </HeaderCaptionTemplate>
                                                                <Settings AllowAutoFilter="True" />
                                                            </dxw:GridViewDataTextColumn>
                                                            <dxw:GridViewDataTextColumn FieldName="NextGenerationDateTimeSort" Caption="Next Generation"
                                                                VisibleIndex="6" HeaderStyle-HorizontalAlign="Center" Width="13%" CellStyle-Wrap="True">
                                                                <HeaderCaptionTemplate>
                                                                    <asp:Label ID="lblNextGenerationDateTime" runat="server" Font-Bold="false" Text="Next Generation"></asp:Label>
                                                                </HeaderCaptionTemplate>
                                                                <DataItemTemplate>
                                                                    <asp:Label ID="lbNextGenerationDateTime" runat="server"
                                                                        Text='<%# Convert.ToString(Eval("ReportStatus")).Equals("1")? Eval("ReportStatusDetails") + ( Eval("ModifiedDateTime")!= DBNull.Value? 
                                                            " - " + Eval("ModifiedDateTime"): string.Empty) :( Eval("NextGenerationDateTime")!= DBNull.Value? Eval("NextGenerationDateTime"): 
                                                            Eval("ReportStatusDetails") + ( Eval("ModifiedDateTime")!= DBNull.Value? " - " + Eval("ModifiedDateTime"): string.Empty)) %>'>
                                                                    </asp:Label>
                                                                </DataItemTemplate>
                                                                <Settings AllowAutoFilter="False" />
                                                            </dxw:GridViewDataTextColumn>
                                                            <dxw:GridViewDataTextColumn Caption="Abort" VisibleIndex="7" HeaderStyle-HorizontalAlign="Center"
                                                                CellStyle-HorizontalAlign="Center" Width="3%" Name="Abort">
                                                                <HeaderTemplate>
                                                                </HeaderTemplate>
                                                                <DataItemTemplate>
                                                                    <asp:LinkButton ID="btnAbort" runat="server" CommandArgument='<%# Eval("ReportScheduleId") %>'
                                                                        AlternateText="Stop Scheduling" CommandName="StopScheduling" OnClientClick="
                                                                    ('Are you sure you want to stop scheduling?');"
                                                                        OnClick="btnAbort_click" ToolTip="Click here to Stop Scheduling" CssClass="Grid-btn-fa-pause-circle-o">
                                                                        <%--<asp:Image ID="imgAbortButton" runat="server" ImageUrl="~/images/icn-pause-schedule.gif"
                                                                            ImageAlign="Middle" />--%>
                                                                    </asp:LinkButton>
                                                                    <asp:LinkButton ID="btnResume" runat="server" CommandArgument='<%# Eval("ReportScheduleId") %>'
                                                                        AlternateText="Resume Scheduling" CommandName="ResumeScheduling" OnClientClick="return confirm('Are you sure you want to resume scheduling?');"
                                                                        OnClick="btnResume_Click" ToolTip="Click here to Resume Scheduling" CssClass="Grid-btn-fa-play-circle-o">
                                                                        <%--<asp:Image ID="imgResumeReport" runat="server" ImageAlign="Middle" ImageUrl="~/images/icn-resume-schedule.gif" />--%>
                                                                    </asp:LinkButton>
                                                                    <asp:Image ID="imgExpired" runat="server" AlternateText="Expired" ToolTip="Expired"
                                                                        Style="padding-left: 2px" ImageUrl="~/images/icn-schedul-expired.gif" />
                                                                    <asp:Image ID="imgInProgess" runat="server" AlternateText="Scheduling Inprogress"
                                                                        ToolTip="Scheduling Inprogress" Style="padding-left: 2px" ImageUrl="~/images/icn-locked-schedule.gif" />
                                                                </DataItemTemplate>
                                                            </dxw:GridViewDataTextColumn>
                                                            <dxw:GridViewDataTextColumn Caption="Edit" VisibleIndex="9" HeaderStyle-HorizontalAlign="Center"
                                                                CellStyle-HorizontalAlign="Center" Width="3%" Name="Edit">
                                                                <HeaderTemplate>
                                                                </HeaderTemplate>
                                                                <DataItemTemplate>
                                                                    <asp:LinkButton ID="btnEdit" runat="server" CommandArgument='<%# Eval("ReportScheduleId") %>'
                                                                        AlternateText="Edit" CommandName="Edit" OnClick="btnEdit_click" ToolTip="Click here to Edit"
                                                                        ImageAlign="Middle" CssClass="Grid-btn-fa-pencil-square-o">
                                                                    </asp:LinkButton>
                                                                </DataItemTemplate>
                                                            </dxw:GridViewDataTextColumn>
                                                            <dxw:GridViewDataTextColumn Caption="View" VisibleIndex="8" HeaderStyle-HorizontalAlign="Center"
                                                                CellStyle-HorizontalAlign="Center" Width="3%" Name="Edit">
                                                                <HeaderTemplate>
                                                                </HeaderTemplate>
                                                                <DataItemTemplate>
                                                                    <asp:LinkButton ID="btnView" runat="server" CommandArgument='<%# Eval("ReportScheduleId") %>'
                                                                        AlternateText="View" CommandName="View" OnClick="btnEdit_click" ToolTip="Click here to View" OnClientClick="ShowPopUp();"
                                                                        ImageAlign="Middle" CssClass="Grid-btn-fa-binoculars">
                                                                    </asp:LinkButton>
                                                                </DataItemTemplate>
                                                            </dxw:GridViewDataTextColumn>
                                                            <dxw:GridViewDataTextColumn Caption="Delete" VisibleIndex="10" HeaderStyle-HorizontalAlign="Center"
                                                                CellStyle-HorizontalAlign="Center" Width="3%" Name="Delete">
                                                                <HeaderTemplate>
                                                                </HeaderTemplate>
                                                                <DataItemTemplate>
                                                                    <asp:LinkButton ID="btnDelete" runat="server" CommandArgument='<%# Eval("ReportScheduleId") %>'
                                                                        AlternateText="Delete" CommandName="Delete" OnClick="btnDelete_click" ToolTip="Click here to Delete"
                                                                        CssClass="Grid-btn-fa-trash-o">
                                                                    </asp:LinkButton>
                                                                </DataItemTemplate>
                                                            </dxw:GridViewDataTextColumn>
                                                        </Columns>
                                                        <Settings ShowVerticalScrollBar="true" VerticalScrollableHeight="325" />
                                                        <Settings ShowFilterRow="true" ShowFilterRowMenu="True" />
                                                        <SettingsText EmptyDataRow="No scheduling reports settings found" />
                                                    </dxw:ASPxGridView>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </asp:Panel>
                    <!-- Content Ends Here -->
                </ContentTemplate>
            </asp:UpdatePanel>
            <cc1:ModalPopupExtender ID="mpeProgressIndicator" runat="server" PopupControlID="progressPopUp"
                TargetControlID="btnTesting">
            </cc1:ModalPopupExtender>
            <asp:Button ID="btnTesting" Style="display: none;" runat="server" />
            <asp:Panel ID="progressPopUp" runat="server" CssClass="processMessage" Style="display: none;">
                <center>
                <br />
                <img id="imgLoad" runat="server" 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>
    <uc2:Footer ID="ucFooter" runat="server" />
</body>
</html>
