<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PerformanceYTDLinee.aspx.cs" Inherits="OlympiaIntranet.PerformanceYTDLinee" %>

<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.XtraCharts.v23.2.Web, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts.Web" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.XtraCharts.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraCharts" TagPrefix="dx" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script>
        function ExportChartToPdf(e) {
            e.processOnServer = false;
            var chartPrintOptions = clientBarChart.GetPrintOptions();
            chartPrintOptions.SetSizeMode('Stretch');
            chartPrintOptions.SetLandscape(true);
            const date = new Date();
            var fileName = 'PerformanceYTD_Histogram_' + date.toLocaleDateString();
            clientBarChart.SaveToDisk('pdf', fileName);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <table>
                <tr>
                    <td>
                        <dx:ASPxButton ID="ASPxExportXls" runat="server" OnClick="ASPxExportXls_Click" Theme="Office2010Blue" ToolTip="Click to export data to excel..." Height="22px" Width="36px">
                            <Image IconID="export_exporttoxlsx_16x16">
                            </Image>
                            <Paddings Padding="0px" />
                        </dx:ASPxButton>
                    </td>
                    <td>
                        <dx:ASPxButton ID="ASPxExportPdf" runat="server" OnClick="ASPxExportPdf_Click" Theme="Office2010Blue" ToolTip="Click to export table to pdf..." Height="22px" Width="36px">
                            <Image IconID="export_exporttopdf_16x16">
                            </Image>
                            <Paddings Padding="0px" />
                        </dx:ASPxButton>
                    </td>
                    <td>
                        <dx:ASPxButton ID="buttonEsportaPdf" runat="server" AutoPostBack="False" Theme="Office2010Blue" ToolTip="Click to export graph to pdf..." Height="22px" Width="36px" OnClick="buttonEsportaPdf_Click">
                            <ClientSideEvents Click="function(s, e) { ExportChartToPdf(e); }" />
                            <Image IconID="export_exporttopdf_16x16">
                            </Image>
                        </dx:ASPxButton>
                    </td>
                </tr>
            </table>
            <table>
                <tr>
                    <td>
                        <dx:ASPxGridView ID="gvPerformanceYTDLinee" runat="server" EnableTheming="True" Theme="Office2010Blue" AutoGenerateColumns="False" KeyFieldName="Linea">
                            <SettingsPager PageSize="40" Visible="False">
                                <PageSizeItemSettings ShowAllItem="True">
                                </PageSizeItemSettings>
                            </SettingsPager>
                            <Settings ShowFilterRow="True" ShowHeaderFilterButton="True" ShowFilterBar="Visible" ShowFooter="true" />
                            <SettingsBehavior FilterRowMode="OnClick" />
                            <SettingsFilterControl ViewMode="VisualAndText">
                            </SettingsFilterControl>
                            <Columns>
                                <dx:GridViewDataTextColumn FieldName="Linea" VisibleIndex="3">
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="PerfYTDAvg" Caption="Perf YTD (Avg)" VisibleIndex="4">
                                    <PropertiesTextEdit DisplayFormatString="F2">
                                    </PropertiesTextEdit>
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="PerfYTDStd" Caption="Perf YTD (Std)" VisibleIndex="5">
                                    <PropertiesTextEdit DisplayFormatString="F2">
                                    </PropertiesTextEdit>
                                </dx:GridViewDataTextColumn>
                            </Columns>
                            <TotalSummary>
                                <dx:ASPxSummaryItem FieldName="PerfYTDAvg" SummaryType="Average" DisplayFormat="Avg = {0:F2}" />
                                <dx:ASPxSummaryItem FieldName="PerfYTDStd" SummaryType="Average" DisplayFormat="Avg = {0:F2}" />
                            </TotalSummary>
                        </dx:ASPxGridView>
                    </td>
                    <td>
                        <dx:WebChartControl ID="barChart" ClientInstanceName="clientBarChart" runat="server" CrosshairEnabled="True" Height="500px" Width="1024px" RenderFormat="Svg" EnableViewState="False" AppearanceNameSerializable="Gray">
                        </dx:WebChartControl>
                    </td>
                </tr>
            </table>

            <asp:SqlDataSource ID="SqlDSPerformanceYTDLinee" runat="server" ConnectionString="<%$ ConnectionStrings:OlympiaIntranet.Properties.Settings.SqlConnection %>" ProviderName="<%$ ConnectionStrings:OlympiaIntranet.Properties.Settings.SqlConnection.ProviderName %>" SelectCommand="GDN_PerformanceYTDLinee_Load" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
            <dx:ASPxGridViewExporter ID="ASPxGridViewExporter1" runat="server" GridViewID="gvPerformanceYTDLinee">
            </dx:ASPxGridViewExporter>
        </div>
    </form>
</body>
</html>
