diff --git a/TestDevExpress/Components/Pages/ReportViewer.razor b/TestDevExpress/Components/Pages/ReportViewer.razor index 849a596c..d03e3d71 100644 --- a/TestDevExpress/Components/Pages/ReportViewer.razor +++ b/TestDevExpress/Components/Pages/ReportViewer.razor @@ -13,7 +13,8 @@ -@* *@ + +Download PDF diff --git a/TestDevExpress/Components/Pages/ReportViewer.razor.cs b/TestDevExpress/Components/Pages/ReportViewer.razor.cs index 3a82be7a..fc70a17a 100644 --- a/TestDevExpress/Components/Pages/ReportViewer.razor.cs +++ b/TestDevExpress/Components/Pages/ReportViewer.razor.cs @@ -1,6 +1,8 @@ using DevExpress.Blazor.Reporting; using DevExpress.DataAccess; using DevExpress.DataAccess.Json; +using DevExpress.Drawing.Internal.Fonts.Interop; +using DevExpress.Security; using DevExpress.XtraReports; using DevExpress.XtraReports.UI; using Microsoft.AspNetCore.Components; @@ -13,36 +15,60 @@ namespace TestDevExpress.Components.Pages { #region Protected Methods + private string pdfUrl + { + get => $"download-offer?id={oID}"; + } + private int oID = 0; protected override void OnInitialized() { - // assegno il parametro basePath da conf - string basePath = _config.GetValue("ServerConf:ImageBaseUrl") ?? "https://iis01.egalware.com/lux/srv/api/image/"; - currReport.Parameters["pBasePath"].Value = basePath; + // calcolo i parametri x IMG e Json da conf + + string apiUrl = _config.GetValue("ServerConf:ApiBaseUrl") ?? "https://iis01.egalware.com/lux/srv/api"; + string imgUrl = _config.GetValue("ServerConf:ImageUrl") ?? "image"; + string dataUrl = _config.GetValue("ServerConf:DataUrl") ?? "report/offert/"; + + string imgFullUrl = $"{apiUrl}/{imgUrl}/"; + string dataFullUrl = $"{apiUrl}/{dataUrl}"; //cerco id da URL x offerta da mostrare var uri = NavManager.ToAbsoluteUri(NavManager.Uri); if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("OfferId", out var offerId)) { - if (currReport.Parameters["pOfferId"] != null) - { - currReport.Parameters["pOfferId"].Value = offerId; + + int.TryParse(offerId, out oID); - // 2. Cerca il JsonDataSource e aggiorna l'URL manualmente - var jsonDataSource = currReport.DataSource as JsonDataSource; - if (jsonDataSource != null) - { - // Costruiamo l'URL finale - string urlCompleto = $"https://iis01.egalware.com/Lux/srv/api/report/offert/{offerId}"; - // Assegniamo l'URL "pulito" al data source del report - jsonDataSource.JsonSource = new UriJsonSource(new Uri(urlCompleto)); + currReport = new OfferReport(dataFullUrl, oID); + currReport.Parameters["pBasePath"].Value = imgFullUrl; - // IMPORTANTE: Dirottiamo la connessione perché non usi quella di appsettings.json - jsonDataSource.ConnectionName = null; - } + // currReport.Parameters["pBasePath"].Value = basePath; + // if (currReport.Parameters["pOfferId"] != null) + // { + // currReport.Parameters["pOfferId"].Value = offerId; - currReport.RequestParameters = false; - } + //#if false + // // 2. Cerca il JsonDataSource e aggiorna l'URL manualmente + // var jsonDataSource = currReport.DataSource as JsonDataSource; + // if (jsonDataSource != null) + // { + // // Costruiamo l'URL finale + // //string baseUrl = _config.GetValue("connectionStrings:JsonConnection") ?? "https://iis01.egalware.com/Lux/srv/api/report/offert/"; + // string baseUrl = _config.GetConnectionString("JsonConnection") ?? "https://iis01.egalware.com/Lux/srv/api/report/offert/"; + + + // string urlCompleto = $"{baseUrl}{offerId}"; + + // // Assegniamo l'URL "pulito" al data source del report + // jsonDataSource.JsonSource = new UriJsonSource(new Uri(urlCompleto)); + + // // IMPORTANTE: Dirottiamo la connessione perché non usi quella di appsettings.json + // jsonDataSource.ConnectionName = null; + // } + //#endif + + // currReport.RequestParameters = false; + // } } } diff --git a/TestDevExpress/Components/Reports/OfferReport.Designer.cs b/TestDevExpress/Components/Reports/OfferReport.Designer.cs index bbad426a..1973e10c 100644 --- a/TestDevExpress/Components/Reports/OfferReport.Designer.cs +++ b/TestDevExpress/Components/Reports/OfferReport.Designer.cs @@ -118,6 +118,8 @@ DevExpress.DataAccess.Json.JsonSchemaNode jsonSchemaNode86 = new DevExpress.DataAccess.Json.JsonSchemaNode("offerNav", true, DevExpress.DataAccess.Json.JsonNodeType.Property); DevExpress.DataAccess.Json.JsonSchemaNode jsonSchemaNode87 = new DevExpress.DataAccess.Json.JsonSchemaNode("templateRowNav", true, DevExpress.DataAccess.Json.JsonNodeType.Property); DevExpress.DataAccess.Json.JsonSchemaNode jsonSchemaNode88 = new DevExpress.DataAccess.Json.JsonSchemaNode("sellingItemNav", true, DevExpress.DataAccess.Json.JsonNodeType.Property); + DevExpress.XtraReports.UI.XRSummary xrSummary1 = new DevExpress.XtraReports.UI.XRSummary(); + DevExpress.XtraReports.UI.XRSummary xrSummary2 = new DevExpress.XtraReports.UI.XRSummary(); this.Detail = new DevExpress.XtraReports.UI.DetailBand(); this.xrLabel15 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel14 = new DevExpress.XtraReports.UI.XRLabel(); @@ -133,18 +135,37 @@ this.TopMargin = new DevExpress.XtraReports.UI.TopMarginBand(); this.BottomMargin = new DevExpress.XtraReports.UI.BottomMarginBand(); this.GroupHeader1 = new DevExpress.XtraReports.UI.GroupHeaderBand(); + this.xrPageBreak1 = new DevExpress.XtraReports.UI.XRPageBreak(); + this.xrLabel21 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel24 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel23 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel22 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel20 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel19 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel18 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel16 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel10 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel4 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel3 = new DevExpress.XtraReports.UI.XRLabel(); - this.GroupFooter1 = new DevExpress.XtraReports.UI.GroupFooterBand(); + this.xrLabel17 = new DevExpress.XtraReports.UI.XRLabel(); this.xrLabel2 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrPageInfo1 = new DevExpress.XtraReports.UI.XRPageInfo(); this.pOfferId = new DevExpress.XtraReports.Parameters.Parameter(); this.jsonDataSource1 = new DevExpress.DataAccess.Json.JsonDataSource(this.components); this.DetailReport = new DevExpress.XtraReports.UI.DetailReportBand(); this.Detail1 = new DevExpress.XtraReports.UI.DetailBand(); this.xrPictureBox1 = new DevExpress.XtraReports.UI.XRPictureBox(); + this.GroupHeader2 = new DevExpress.XtraReports.UI.GroupHeaderBand(); + this.xrLabel25 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel28 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel27 = new DevExpress.XtraReports.UI.XRLabel(); + this.GroupFooter1 = new DevExpress.XtraReports.UI.GroupFooterBand(); + this.xrLabel26 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel29 = new DevExpress.XtraReports.UI.XRLabel(); + this.xrLabel30 = new DevExpress.XtraReports.UI.XRLabel(); this.pBasePath = new DevExpress.XtraReports.Parameters.Parameter(); + this.ReportFooter = new DevExpress.XtraReports.UI.ReportFooterBand(); + this.PageFooter = new DevExpress.XtraReports.UI.PageFooterBand(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); // // Detail @@ -160,6 +181,7 @@ this.xrLabel11, this.xrLabel1}); this.Detail.HeightF = 44.79168F; + this.Detail.KeepTogetherWithDetailReports = true; this.Detail.Name = "Detail"; this.Detail.Padding = new DevExpress.XtraPrinting.PaddingInfo(0F, 0F, 0F, 0F, 100F); this.Detail.StylePriority.UseBackColor = false; @@ -169,36 +191,36 @@ // // xrLabel15 // - this.xrLabel15.LocationFloat = new DevExpress.Utils.PointFloat(550F, 10.00004F); + this.xrLabel15.LocationFloat = new DevExpress.Utils.PointFloat(616.4581F, 10.00004F); this.xrLabel15.Multiline = true; this.xrLabel15.Name = "xrLabel15"; this.xrLabel15.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); - this.xrLabel15.SizeF = new System.Drawing.SizeF(100F, 23F); + this.xrLabel15.SizeF = new System.Drawing.SizeF(113.5417F, 34.79164F); this.xrLabel15.StylePriority.UseTextAlignment = false; this.xrLabel15.Text = "Totale"; - this.xrLabel15.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopRight; + this.xrLabel15.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; // // xrLabel14 // - this.xrLabel14.LocationFloat = new DevExpress.Utils.PointFloat(434.375F, 10.00004F); + this.xrLabel14.LocationFloat = new DevExpress.Utils.PointFloat(479.9998F, 10.00004F); this.xrLabel14.Multiline = true; this.xrLabel14.Name = "xrLabel14"; this.xrLabel14.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); - this.xrLabel14.SizeF = new System.Drawing.SizeF(115.625F, 23F); + this.xrLabel14.SizeF = new System.Drawing.SizeF(136.4583F, 34.79164F); this.xrLabel14.StylePriority.UseTextAlignment = false; - this.xrLabel14.Text = "Importo unitario"; + this.xrLabel14.Text = "Importo\r\nunitario"; this.xrLabel14.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopRight; // // xrLabel13 // - this.xrLabel13.LocationFloat = new DevExpress.Utils.PointFloat(379.1667F, 10.00001F); + this.xrLabel13.LocationFloat = new DevExpress.Utils.PointFloat(413.3331F, 10.00004F); this.xrLabel13.Multiline = true; this.xrLabel13.Name = "xrLabel13"; this.xrLabel13.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); - this.xrLabel13.SizeF = new System.Drawing.SizeF(55.20834F, 23F); + this.xrLabel13.SizeF = new System.Drawing.SizeF(66.66666F, 34.79164F); this.xrLabel13.StylePriority.UseTextAlignment = false; this.xrLabel13.Text = "Qty"; - this.xrLabel13.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopRight; + this.xrLabel13.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; // // xrLabel12 // @@ -206,47 +228,53 @@ this.xrLabel12.Multiline = true; this.xrLabel12.Name = "xrLabel12"; this.xrLabel12.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); - this.xrLabel12.SizeF = new System.Drawing.SizeF(228.125F, 23F); + this.xrLabel12.SizeF = new System.Drawing.SizeF(262.2914F, 34.79164F); + this.xrLabel12.StylePriority.UseTextAlignment = false; this.xrLabel12.Text = "Descrizione"; + this.xrLabel12.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; // // xrLabel11 // - this.xrLabel11.LocationFloat = new DevExpress.Utils.PointFloat(32.29167F, 10.00001F); + this.xrLabel11.LocationFloat = new DevExpress.Utils.PointFloat(32.29167F, 10.00004F); this.xrLabel11.Multiline = true; this.xrLabel11.Name = "xrLabel11"; this.xrLabel11.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); - this.xrLabel11.SizeF = new System.Drawing.SizeF(118.75F, 23F); + this.xrLabel11.SizeF = new System.Drawing.SizeF(118.75F, 34.79164F); + this.xrLabel11.StylePriority.UseTextAlignment = false; this.xrLabel11.Text = "Preview"; + this.xrLabel11.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter; // // xrLabel1 // - this.xrLabel1.LocationFloat = new DevExpress.Utils.PointFloat(0F, 10.00001F); + this.xrLabel1.LocationFloat = new DevExpress.Utils.PointFloat(0F, 10.00004F); this.xrLabel1.Multiline = true; this.xrLabel1.Name = "xrLabel1"; this.xrLabel1.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); - this.xrLabel1.SizeF = new System.Drawing.SizeF(32.29167F, 23F); + this.xrLabel1.SizeF = new System.Drawing.SizeF(32.29167F, 34.79164F); + this.xrLabel1.StylePriority.UseTextAlignment = false; this.xrLabel1.Text = "N°"; + this.xrLabel1.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; // // xrLabel9 // this.xrLabel9.ExpressionBindings.AddRange(new DevExpress.XtraReports.UI.ExpressionBinding[] { new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[offerRowNav].[note]")}); - this.xrLabel9.LocationFloat = new DevExpress.Utils.PointFloat(151.0417F, 10.00004F); + this.xrLabel9.LocationFloat = new DevExpress.Utils.PointFloat(151.0417F, 10.00001F); this.xrLabel9.Multiline = true; this.xrLabel9.Name = "xrLabel9"; this.xrLabel9.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); - this.xrLabel9.SizeF = new System.Drawing.SizeF(228.125F, 23F); + this.xrLabel9.SizeF = new System.Drawing.SizeF(262.2914F, 23F); this.xrLabel9.Text = "xrLabel9"; // // xrLabel8 // this.xrLabel8.ExpressionBindings.AddRange(new DevExpress.XtraReports.UI.ExpressionBinding[] { new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[offerRowNav].[totalPrice]")}); - this.xrLabel8.LocationFloat = new DevExpress.Utils.PointFloat(550F, 10.0001F); + this.xrLabel8.LocationFloat = new DevExpress.Utils.PointFloat(616.4581F, 10.0001F); this.xrLabel8.Multiline = true; this.xrLabel8.Name = "xrLabel8"; this.xrLabel8.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); - this.xrLabel8.SizeF = new System.Drawing.SizeF(100F, 23F); + this.xrLabel8.SizeF = new System.Drawing.SizeF(113.5417F, 23F); this.xrLabel8.StylePriority.UseTextAlignment = false; this.xrLabel8.Text = "xrLabel8"; this.xrLabel8.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopRight; @@ -256,11 +284,11 @@ // this.xrLabel7.ExpressionBindings.AddRange(new DevExpress.XtraReports.UI.ExpressionBinding[] { new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[offerRowNav].[unitPrice]")}); - this.xrLabel7.LocationFloat = new DevExpress.Utils.PointFloat(434.375F, 9.999974F); + this.xrLabel7.LocationFloat = new DevExpress.Utils.PointFloat(479.9998F, 10.00001F); this.xrLabel7.Multiline = true; this.xrLabel7.Name = "xrLabel7"; this.xrLabel7.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); - this.xrLabel7.SizeF = new System.Drawing.SizeF(115.625F, 23F); + this.xrLabel7.SizeF = new System.Drawing.SizeF(136.4583F, 23F); this.xrLabel7.StylePriority.UseTextAlignment = false; this.xrLabel7.Text = "xrLabel7"; this.xrLabel7.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopRight; @@ -270,11 +298,11 @@ // this.xrLabel6.ExpressionBindings.AddRange(new DevExpress.XtraReports.UI.ExpressionBinding[] { new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[offerRowNav].[qty]")}); - this.xrLabel6.LocationFloat = new DevExpress.Utils.PointFloat(379.1667F, 10.0001F); + this.xrLabel6.LocationFloat = new DevExpress.Utils.PointFloat(413.3331F, 10.00001F); this.xrLabel6.Multiline = true; this.xrLabel6.Name = "xrLabel6"; this.xrLabel6.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); - this.xrLabel6.SizeF = new System.Drawing.SizeF(55.20834F, 23F); + this.xrLabel6.SizeF = new System.Drawing.SizeF(66.66666F, 23F); this.xrLabel6.StylePriority.UseTextAlignment = false; this.xrLabel6.Text = "xrLabel6"; this.xrLabel6.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopRight; @@ -292,12 +320,14 @@ // // TopMargin // + this.TopMargin.HeightF = 60F; this.TopMargin.Name = "TopMargin"; this.TopMargin.Padding = new DevExpress.XtraPrinting.PaddingInfo(0F, 0F, 0F, 0F, 100F); this.TopMargin.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopLeft; // // BottomMargin // + this.BottomMargin.HeightF = 60F; this.BottomMargin.Name = "BottomMargin"; this.BottomMargin.Padding = new DevExpress.XtraPrinting.PaddingInfo(0F, 0F, 0F, 0F, 100F); this.BottomMargin.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopLeft; @@ -305,21 +335,113 @@ // GroupHeader1 // this.GroupHeader1.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.xrPageBreak1, + this.xrLabel21, + this.xrLabel24, + this.xrLabel23, + this.xrLabel22, + this.xrLabel20, + this.xrLabel19, + this.xrLabel18, this.xrLabel16, this.xrLabel10, this.xrLabel4, this.xrLabel3}); - this.GroupHeader1.HeightF = 100F; + this.GroupHeader1.HeightF = 164.25F; this.GroupHeader1.Name = "GroupHeader1"; // + // xrPageBreak1 + // + this.xrPageBreak1.LocationFloat = new DevExpress.Utils.PointFloat(0F, 162.25F); + this.xrPageBreak1.Name = "xrPageBreak1"; + this.xrPageBreak1.Visible = false; + // + // xrLabel21 + // + this.xrLabel21.Borders = DevExpress.XtraPrinting.BorderSide.Bottom; + this.xrLabel21.LocationFloat = new DevExpress.Utils.PointFloat(0F, 85.2917F); + this.xrLabel21.Multiline = true; + this.xrLabel21.Name = "xrLabel21"; + this.xrLabel21.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); + this.xrLabel21.SizeF = new System.Drawing.SizeF(730.0001F, 10.49994F); + this.xrLabel21.StylePriority.UseBorders = false; + // + // xrLabel24 + // + this.xrLabel24.ExpressionBindings.AddRange(new DevExpress.XtraReports.UI.ExpressionBinding[] { + new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[dealerNav].[lastName]")}); + this.xrLabel24.LocationFloat = new DevExpress.Utils.PointFloat(630.0001F, 118.7916F); + this.xrLabel24.Multiline = true; + this.xrLabel24.Name = "xrLabel24"; + this.xrLabel24.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); + this.xrLabel24.SizeF = new System.Drawing.SizeF(100F, 23F); + this.xrLabel24.Text = "xrLabel24"; + // + // xrLabel23 + // + this.xrLabel23.ExpressionBindings.AddRange(new DevExpress.XtraReports.UI.ExpressionBinding[] { + new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[dealerNav].[firstName]")}); + this.xrLabel23.LocationFloat = new DevExpress.Utils.PointFloat(530.0001F, 118.7916F); + this.xrLabel23.Multiline = true; + this.xrLabel23.Name = "xrLabel23"; + this.xrLabel23.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); + this.xrLabel23.SizeF = new System.Drawing.SizeF(100F, 23F); + this.xrLabel23.Text = "xrLabel23"; + // + // xrLabel22 + // + this.xrLabel22.Borders = DevExpress.XtraPrinting.BorderSide.None; + this.xrLabel22.LocationFloat = new DevExpress.Utils.PointFloat(630.0001F, 95.79166F); + this.xrLabel22.Multiline = true; + this.xrLabel22.Name = "xrLabel22"; + this.xrLabel22.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); + this.xrLabel22.SizeF = new System.Drawing.SizeF(100F, 23F); + this.xrLabel22.StylePriority.UseBorders = false; + this.xrLabel22.Text = "Venditore"; + // + // xrLabel20 + // + this.xrLabel20.ExpressionBindings.AddRange(new DevExpress.XtraReports.UI.ExpressionBinding[] { + new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[customerNav].[lastName]")}); + this.xrLabel20.LocationFloat = new DevExpress.Utils.PointFloat(119.9999F, 118.7916F); + this.xrLabel20.Multiline = true; + this.xrLabel20.Name = "xrLabel20"; + this.xrLabel20.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); + this.xrLabel20.SizeF = new System.Drawing.SizeF(130F, 23F); + this.xrLabel20.Text = "xrLabel20"; + // + // xrLabel19 + // + this.xrLabel19.ExpressionBindings.AddRange(new DevExpress.XtraReports.UI.ExpressionBinding[] { + new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[customerNav].[firstName]")}); + this.xrLabel19.LocationFloat = new DevExpress.Utils.PointFloat(0F, 118.7916F); + this.xrLabel19.Multiline = true; + this.xrLabel19.Name = "xrLabel19"; + this.xrLabel19.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); + this.xrLabel19.SizeF = new System.Drawing.SizeF(119.9999F, 23F); + this.xrLabel19.Text = "xrLabel19"; + // + // xrLabel18 + // + this.xrLabel18.Borders = DevExpress.XtraPrinting.BorderSide.None; + this.xrLabel18.LocationFloat = new DevExpress.Utils.PointFloat(0F, 95.79166F); + this.xrLabel18.Multiline = true; + this.xrLabel18.Name = "xrLabel18"; + this.xrLabel18.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); + this.xrLabel18.SizeF = new System.Drawing.SizeF(77.08334F, 23F); + this.xrLabel18.StylePriority.UseBorders = false; + this.xrLabel18.StylePriority.UseTextAlignment = false; + this.xrLabel18.Text = "Cliente"; + this.xrLabel18.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; + // // xrLabel16 // this.xrLabel16.Font = new DevExpress.Drawing.DXFont("Times New Roman", 32F, DevExpress.Drawing.DXFontStyle.Bold); - this.xrLabel16.LocationFloat = new DevExpress.Utils.PointFloat(151.0417F, 0F); + this.xrLabel16.LocationFloat = new DevExpress.Utils.PointFloat(0F, 0F); this.xrLabel16.Multiline = true; this.xrLabel16.Name = "xrLabel16"; this.xrLabel16.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); - this.xrLabel16.SizeF = new System.Drawing.SizeF(352.0834F, 23F); + this.xrLabel16.SizeF = new System.Drawing.SizeF(352.0834F, 28.20833F); this.xrLabel16.StylePriority.UseFont = false; this.xrLabel16.Text = "Preventivo"; // @@ -327,18 +449,20 @@ // this.xrLabel10.ExpressionBindings.AddRange(new DevExpress.XtraReports.UI.ExpressionBinding[] { new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "?pOfferId")}); - this.xrLabel10.LocationFloat = new DevExpress.Utils.PointFloat(550F, 77.00002F); + this.xrLabel10.LocationFloat = new DevExpress.Utils.PointFloat(630.0001F, 62.29169F); this.xrLabel10.Multiline = true; this.xrLabel10.Name = "xrLabel10"; this.xrLabel10.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); this.xrLabel10.SizeF = new System.Drawing.SizeF(100F, 23F); + this.xrLabel10.StylePriority.UseTextAlignment = false; this.xrLabel10.Text = "xrLabel10"; + this.xrLabel10.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopRight; // // xrLabel4 // this.xrLabel4.ExpressionBindings.AddRange(new DevExpress.XtraReports.UI.ExpressionBinding[] { new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[offerCode]")}); - this.xrLabel4.LocationFloat = new DevExpress.Utils.PointFloat(0F, 77.00002F); + this.xrLabel4.LocationFloat = new DevExpress.Utils.PointFloat(0F, 62.29169F); this.xrLabel4.Multiline = true; this.xrLabel4.Name = "xrLabel4"; this.xrLabel4.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); @@ -349,29 +473,47 @@ // this.xrLabel3.ExpressionBindings.AddRange(new DevExpress.XtraReports.UI.ExpressionBinding[] { new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[description]")}); - this.xrLabel3.Font = new DevExpress.Drawing.DXFont("Times New Roman", 24F, DevExpress.Drawing.DXFontStyle.Italic); - this.xrLabel3.LocationFloat = new DevExpress.Utils.PointFloat(0F, 42.91668F); + this.xrLabel3.Font = new DevExpress.Drawing.DXFont("Times New Roman", 24F); + this.xrLabel3.LocationFloat = new DevExpress.Utils.PointFloat(0F, 28.20832F); this.xrLabel3.Multiline = true; this.xrLabel3.Name = "xrLabel3"; this.xrLabel3.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); - this.xrLabel3.SizeF = new System.Drawing.SizeF(650F, 34.08335F); + this.xrLabel3.SizeF = new System.Drawing.SizeF(730.0001F, 34.08335F); this.xrLabel3.StylePriority.UseFont = false; this.xrLabel3.Text = "xrLabel3"; // - // GroupFooter1 + // xrLabel17 // - this.GroupFooter1.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { - this.xrLabel2}); - this.GroupFooter1.Name = "GroupFooter1"; + this.xrLabel17.ExpressionBindings.AddRange(new DevExpress.XtraReports.UI.ExpressionBinding[] { + new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "[validUntil]")}); + this.xrLabel17.LocationFloat = new DevExpress.Utils.PointFloat(77.08334F, 10.00004F); + this.xrLabel17.Multiline = true; + this.xrLabel17.Name = "xrLabel17"; + this.xrLabel17.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); + this.xrLabel17.SizeF = new System.Drawing.SizeF(100F, 20.91664F); + this.xrLabel17.Text = "xrLabel17"; + this.xrLabel17.TextFormatString = "{0:dd/MM/yyyy}"; // // xrLabel2 // - this.xrLabel2.LocationFloat = new DevExpress.Utils.PointFloat(0F, 9.999974F); + this.xrLabel2.LocationFloat = new DevExpress.Utils.PointFloat(0F, 10.00001F); this.xrLabel2.Multiline = true; this.xrLabel2.Name = "xrLabel2"; this.xrLabel2.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); - this.xrLabel2.SizeF = new System.Drawing.SizeF(100F, 23F); - this.xrLabel2.Text = "Fine offerta"; + this.xrLabel2.SizeF = new System.Drawing.SizeF(77.08334F, 20.91667F); + this.xrLabel2.StylePriority.UseTextAlignment = false; + this.xrLabel2.Text = "Scadenza: "; + this.xrLabel2.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; + // + // xrPageInfo1 + // + this.xrPageInfo1.LocationFloat = new DevExpress.Utils.PointFloat(629.9998F, 9.999974F); + this.xrPageInfo1.Name = "xrPageInfo1"; + this.xrPageInfo1.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); + this.xrPageInfo1.SizeF = new System.Drawing.SizeF(100F, 23F); + this.xrPageInfo1.StylePriority.UseTextAlignment = false; + this.xrPageInfo1.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopRight; + this.xrPageInfo1.TextFormatString = "{0} di {1}"; // // pOfferId // @@ -481,7 +623,9 @@ // DetailReport // this.DetailReport.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { - this.Detail1}); + this.Detail1, + this.GroupHeader2, + this.GroupFooter1}); this.DetailReport.DataMember = "offerRowNav"; this.DetailReport.DataSource = this.jsonDataSource1; this.DetailReport.Level = 0; @@ -497,7 +641,7 @@ this.xrLabel9, this.xrLabel8, this.xrLabel5}); - this.Detail1.HeightF = 131.25F; + this.Detail1.HeightF = 112.6249F; this.Detail1.Name = "Detail1"; this.Detail1.SortFields.AddRange(new DevExpress.XtraReports.UI.GroupField[] { new DevExpress.XtraReports.UI.GroupField("rowNum", DevExpress.XtraReports.UI.XRColumnSortOrder.Ascending)}); @@ -511,6 +655,103 @@ this.xrPictureBox1.SizeF = new System.Drawing.SizeF(118.75F, 89.58334F); this.xrPictureBox1.Sizing = DevExpress.XtraPrinting.ImageSizeMode.ZoomImage; // + // GroupHeader2 + // + this.GroupHeader2.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.xrLabel25, + this.xrLabel28, + this.xrLabel27}); + this.GroupHeader2.HeightF = 47.625F; + this.GroupHeader2.Name = "GroupHeader2"; + this.GroupHeader2.PageBreak = DevExpress.XtraReports.UI.PageBreak.BeforeBandExceptFirstEntry; + this.GroupHeader2.RepeatEveryPage = true; + // + // xrLabel25 + // + this.xrLabel25.Borders = DevExpress.XtraPrinting.BorderSide.Bottom; + this.xrLabel25.LocationFloat = new DevExpress.Utils.PointFloat(0F, 37.12506F); + this.xrLabel25.Multiline = true; + this.xrLabel25.Name = "xrLabel25"; + this.xrLabel25.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); + this.xrLabel25.SizeF = new System.Drawing.SizeF(730.0001F, 10.49994F); + this.xrLabel25.StylePriority.UseBorders = false; + // + // xrLabel28 + // + this.xrLabel28.ExpressionBindings.AddRange(new DevExpress.XtraReports.UI.ExpressionBinding[] { + new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "sumCarryoverSum([totalPrice])")}); + this.xrLabel28.LocationFloat = new DevExpress.Utils.PointFloat(616.4581F, 10.00001F); + this.xrLabel28.Multiline = true; + this.xrLabel28.Name = "xrLabel28"; + this.xrLabel28.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); + this.xrLabel28.SizeF = new System.Drawing.SizeF(113.5417F, 23F); + this.xrLabel28.StylePriority.UseTextAlignment = false; + xrSummary1.IgnoreNullValues = true; + xrSummary1.Running = DevExpress.XtraReports.UI.SummaryRunning.Group; + this.xrLabel28.Summary = xrSummary1; + this.xrLabel28.Text = "xrLabel28"; + this.xrLabel28.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; + this.xrLabel28.TextFormatString = "{0:c}"; + // + // xrLabel27 + // + this.xrLabel27.LocationFloat = new DevExpress.Utils.PointFloat(479.9998F, 9.999974F); + this.xrLabel27.Multiline = true; + this.xrLabel27.Name = "xrLabel27"; + this.xrLabel27.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); + this.xrLabel27.SizeF = new System.Drawing.SizeF(136.4583F, 23F); + this.xrLabel27.StylePriority.UseTextAlignment = false; + this.xrLabel27.Text = "Totale"; + this.xrLabel27.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; + // + // GroupFooter1 + // + this.GroupFooter1.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.xrLabel26, + this.xrLabel29, + this.xrLabel30}); + this.GroupFooter1.HeightF = 46.75007F; + this.GroupFooter1.Name = "GroupFooter1"; + this.GroupFooter1.RepeatEveryPage = true; + // + // xrLabel26 + // + this.xrLabel26.Borders = DevExpress.XtraPrinting.BorderSide.Bottom; + this.xrLabel26.LocationFloat = new DevExpress.Utils.PointFloat(0F, 0F); + this.xrLabel26.Multiline = true; + this.xrLabel26.Name = "xrLabel26"; + this.xrLabel26.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); + this.xrLabel26.SizeF = new System.Drawing.SizeF(730.0001F, 10.49994F); + this.xrLabel26.StylePriority.UseBorders = false; + // + // xrLabel29 + // + this.xrLabel29.LocationFloat = new DevExpress.Utils.PointFloat(479.9998F, 10.49995F); + this.xrLabel29.Multiline = true; + this.xrLabel29.Name = "xrLabel29"; + this.xrLabel29.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); + this.xrLabel29.SizeF = new System.Drawing.SizeF(136.4583F, 23F); + this.xrLabel29.StylePriority.UseTextAlignment = false; + this.xrLabel29.Text = "Totale"; + this.xrLabel29.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; + // + // xrLabel30 + // + this.xrLabel30.ExpressionBindings.AddRange(new DevExpress.XtraReports.UI.ExpressionBinding[] { + new DevExpress.XtraReports.UI.ExpressionBinding("BeforePrint", "Text", "sumCarryoverSum([offerRowNav.totalPrice])")}); + this.xrLabel30.LocationFloat = new DevExpress.Utils.PointFloat(616.4581F, 10.49995F); + this.xrLabel30.Multiline = true; + this.xrLabel30.Name = "xrLabel30"; + this.xrLabel30.Padding = new DevExpress.XtraPrinting.PaddingInfo(2F, 2F, 0F, 0F, 100F); + this.xrLabel30.SizeF = new System.Drawing.SizeF(113.5417F, 23F); + this.xrLabel30.StylePriority.UseTextAlignment = false; + xrSummary2.IgnoreNullValues = true; + xrSummary2.Running = DevExpress.XtraReports.UI.SummaryRunning.Group; + this.xrLabel30.Summary = xrSummary2; + this.xrLabel30.Text = "xrLabel25"; + this.xrLabel30.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight; + this.xrLabel30.TextFormatString = "{0:c}"; + // // pBasePath // this.pBasePath.Description = "Bath di base API x immagini"; @@ -518,6 +759,21 @@ this.pBasePath.ValueInfo = "https://iis01.egalware.com/Lux/srv/api/window/svgfile/"; this.pBasePath.Visible = false; // + // ReportFooter + // + this.ReportFooter.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.xrLabel17, + this.xrLabel2}); + this.ReportFooter.HeightF = 39.9999F; + this.ReportFooter.Name = "ReportFooter"; + // + // PageFooter + // + this.PageFooter.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] { + this.xrPageInfo1}); + this.PageFooter.HeightF = 49.5835F; + this.PageFooter.Name = "PageFooter"; + // // OfferReport // this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] { @@ -525,11 +781,13 @@ this.TopMargin, this.BottomMargin, this.GroupHeader1, - this.GroupFooter1, - this.DetailReport}); + this.DetailReport, + this.ReportFooter, + this.PageFooter}); this.ComponentStorage.AddRange(new System.ComponentModel.IComponent[] { this.jsonDataSource1}); this.DataSource = this.jsonDataSource1; + this.Margins = new DevExpress.Drawing.DXMargins(60F, 60F, 60F, 60F); this.ParameterPanelLayoutItems.AddRange(new DevExpress.XtraReports.Parameters.ParameterPanelLayoutItem[] { new DevExpress.XtraReports.Parameters.ParameterLayoutItem(this.pOfferId, DevExpress.XtraReports.Parameters.Orientation.Horizontal), new DevExpress.XtraReports.Parameters.ParameterLayoutItem(this.pBasePath, DevExpress.XtraReports.Parameters.Orientation.Horizontal)}); @@ -547,8 +805,6 @@ private DevExpress.XtraReports.UI.TopMarginBand TopMargin; private DevExpress.XtraReports.UI.BottomMarginBand BottomMargin; private DevExpress.XtraReports.UI.GroupHeaderBand GroupHeader1; - private DevExpress.XtraReports.UI.GroupFooterBand GroupFooter1; - private DevExpress.XtraReports.UI.XRLabel xrLabel2; private DevExpress.XtraReports.Parameters.Parameter pOfferId; private DevExpress.DataAccess.Json.JsonDataSource jsonDataSource1; private DevExpress.XtraReports.UI.XRLabel xrLabel9; @@ -570,5 +826,26 @@ private DevExpress.XtraReports.UI.XRLabel xrLabel13; private DevExpress.XtraReports.UI.XRLabel xrLabel12; private DevExpress.XtraReports.UI.XRLabel xrLabel16; + private DevExpress.XtraReports.UI.XRPageInfo xrPageInfo1; + private DevExpress.XtraReports.UI.XRLabel xrLabel18; + private DevExpress.XtraReports.UI.XRLabel xrLabel17; + private DevExpress.XtraReports.UI.XRLabel xrLabel2; + private DevExpress.XtraReports.UI.ReportFooterBand ReportFooter; + private DevExpress.XtraReports.UI.XRLabel xrLabel24; + private DevExpress.XtraReports.UI.XRLabel xrLabel23; + private DevExpress.XtraReports.UI.XRLabel xrLabel22; + private DevExpress.XtraReports.UI.XRLabel xrLabel20; + private DevExpress.XtraReports.UI.XRLabel xrLabel19; + private DevExpress.XtraReports.UI.XRLabel xrLabel21; + private DevExpress.XtraReports.UI.PageFooterBand PageFooter; + private DevExpress.XtraReports.UI.GroupHeaderBand GroupHeader2; + private DevExpress.XtraReports.UI.XRLabel xrLabel27; + private DevExpress.XtraReports.UI.GroupFooterBand GroupFooter1; + private DevExpress.XtraReports.UI.XRLabel xrLabel29; + private DevExpress.XtraReports.UI.XRLabel xrLabel30; + private DevExpress.XtraReports.UI.XRLabel xrLabel28; + private DevExpress.XtraReports.UI.XRLabel xrLabel25; + private DevExpress.XtraReports.UI.XRLabel xrLabel26; + private DevExpress.XtraReports.UI.XRPageBreak xrPageBreak1; } } diff --git a/TestDevExpress/Components/Reports/OfferReport.cs b/TestDevExpress/Components/Reports/OfferReport.cs index 7b61e605..efe1a8eb 100644 --- a/TestDevExpress/Components/Reports/OfferReport.cs +++ b/TestDevExpress/Components/Reports/OfferReport.cs @@ -1,8 +1,10 @@ -using DevExpress.XtraReports.UI; +using DevExpress.DataAccess.Json; +using DevExpress.XtraReports.UI; using System; using System.Collections; using System.ComponentModel; using System.Drawing; +using System.Drawing.Printing; namespace TestDevExpress.Components.Reports { @@ -12,5 +14,31 @@ namespace TestDevExpress.Components.Reports { InitializeComponent(); } + + public OfferReport(string baseUrl, int offerID) + { + InitializeComponent(); + Parameters["pBasePath"].Value = baseUrl; + Parameters["pOfferId"].Value = offerID; + _offerId = offerID; + _basePath = baseUrl; + RequestParameters = false; + } + + private int _offerId = 0; + private string _basePath = ""; + + protected override void OnDataSourceDemanded(EventArgs e) + { + var jsonDataSource = DataSource as JsonDataSource; + if (jsonDataSource != null && !string.IsNullOrEmpty(_basePath) && _offerId > 0) + { + string url = $"{_basePath}/{_offerId}"; + + jsonDataSource.JsonSource = new UriJsonSource(new Uri(url)); + jsonDataSource.ConnectionName = null; + //RequestParameters = false; + } + } } } diff --git a/TestDevExpress/Program.cs b/TestDevExpress/Program.cs index 963ffcff..b1151f01 100644 --- a/TestDevExpress/Program.cs +++ b/TestDevExpress/Program.cs @@ -1,9 +1,17 @@ using DevExpress.Blazor.Reporting; using DevExpress.XtraReports.Web.Extensions; +using Microsoft.AspNetCore.Localization; +using System.Globalization; using TestDevExpress.Components; +using TestDevExpress.Components.Reports; + + var builder = WebApplication.CreateBuilder(args); +// gestione configurazione +ConfigurationManager _config = builder.Configuration; + // Add services to the container. builder.Services.AddRazorComponents() .AddInteractiveServerComponents(); @@ -37,4 +45,42 @@ app.UseAntiforgery(); app.MapRazorComponents() .AddInteractiveServerRenderMode(); +// cultura IT... +var supportedCultures = new[]{ + new CultureInfo("it-IT") + }; + +app.MapGet("/download-offer", (int id) => +{ + string apiUrl = _config.GetValue("ServerConf:ApiBaseUrl") ?? "https://iis01.egalware.com/lux/srv/api"; + string imgUrl = _config.GetValue("ServerConf:ImageUrl") ?? "image"; + string dataUrl = _config.GetValue("ServerConf:DataUrl") ?? "report/offert"; + + string imgFullUrl = $"{apiUrl}/{imgUrl}/"; + string dataFullUrl = $"{apiUrl}/{dataUrl}"; + + var report = new OfferReport(dataFullUrl, id); + report.Parameters["pBasePath"].Value = imgFullUrl; + + using var ms = new MemoryStream(); + report.ExportToPdf(ms); + ms.Position = 0; + + string fName = $"Offert_{id:00000000}.pdf"; + + return Results.File( + ms.ToArray(), + "application/pdf", + fName + ); +}); + +app.UseRequestLocalization(new RequestLocalizationOptions +{ + DefaultRequestCulture = new RequestCulture("it-IT"), + SupportedCultures = supportedCultures, + FallBackToParentCultures = false +}); +CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture("it-IT"); + app.Run(); diff --git a/TestDevExpress/appsettings.json b/TestDevExpress/appsettings.json index 27baf8f0..aa798249 100644 --- a/TestDevExpress/appsettings.json +++ b/TestDevExpress/appsettings.json @@ -11,6 +11,8 @@ "JsonConnParam": "Uri=https://iis01.egalware.com/Lux/srv/api/report/offert/" }, "ServerConf": { - "ImageBaseUrl": "https://iis01.egalware.com/Lux/srv/api/image/" + "ApiBaseUrl": "https://iis01.egalware.com/Lux/srv/api", + "ImageUrl": "image", + "DataUrl": "report/offert" } } \ No newline at end of file