diff --git a/Lux.Report.Data/Services/IPdfReportService.cs b/Lux.Report.Data/Services/IPdfReportService.cs
index 3881fa8b..2b67644d 100644
--- a/Lux.Report.Data/Services/IPdfReportService.cs
+++ b/Lux.Report.Data/Services/IPdfReportService.cs
@@ -6,6 +6,7 @@
int reqId,
string repType,
string selFile,
+ string codGroup,
string imgFullUrl,
string dataFullUrl
);
diff --git a/Lux.Report.Data/Services/PdfReportService.cs b/Lux.Report.Data/Services/PdfReportService.cs
index 407aff48..6f1d6c41 100644
--- a/Lux.Report.Data/Services/PdfReportService.cs
+++ b/Lux.Report.Data/Services/PdfReportService.cs
@@ -20,11 +20,12 @@ namespace Lux.Report.Data.Services
int reqId,
string repType,
string selFile,
+ string codGroup,
string imgFullUrl,
string dataFullUrl
)
{
- _logger.LogInformation($"Generating PDF for reqId={reqId}, repType={repType}, selFile={selFile}");
+ _logger.LogInformation($"Generating PDF for reqId={reqId}, repType={repType}, selFile={selFile}, codGroup={codGroup}");
string repPath = Path.Combine("reports", repType, selFile);
@@ -37,7 +38,7 @@ namespace Lux.Report.Data.Services
using (MemoryStream ms = new MemoryStream(repData))
{
var Report = XtraReport.FromStream(ms);
- var ds = ComposeJsonDataSource(dataFullUrl, reqId);
+ var ds = ComposeJsonDataSource(dataFullUrl, reqId, codGroup);
ds.Fill();
Report.DataSource = ds;
Report.DataMember = "";
@@ -82,7 +83,7 @@ namespace Lux.Report.Data.Services
/// URL di partenza
/// ID record richiesto
///
- private JsonDataSource ComposeJsonDataSource(string rawDataUrl, int reqId)
+ private JsonDataSource ComposeJsonDataSource(string rawDataUrl, int reqId, string codGroup)
{
// Create a new JSON source.
var jsonSource = new UriJsonSource()
@@ -91,6 +92,10 @@ namespace Lux.Report.Data.Services
};
jsonSource.PathParameters.Add(new PathParameter("ReqId", typeof(int), reqId));
+ if (!string.IsNullOrEmpty(codGroup))
+ {
+ jsonSource.QueryParameters.Add(new QueryParameter("codGroup", typeof(string), codGroup));
+ }
// Assign the JSON source to the data source.
var datasource = new JsonDataSource()
{
diff --git a/Lux.Report.Server/Components/Compo/ReportViewer.razor.cs b/Lux.Report.Server/Components/Compo/ReportViewer.razor.cs
index 3d269106..83a9103a 100644
--- a/Lux.Report.Server/Components/Compo/ReportViewer.razor.cs
+++ b/Lux.Report.Server/Components/Compo/ReportViewer.razor.cs
@@ -102,15 +102,22 @@ namespace Lux.Report.Server.Components.Compo
Uri = new Uri(rawDataUrl)
};
int reqID = 7;
- if (RequestDict.ContainsKey("ReqID"))
+ string codGroup = "";
+ if (paramsVal.ContainsKey("ReqID"))
{
- var rawData = RequestDict["ReqID"];
+ var rawData = paramsVal["ReqID"];
int.TryParse(rawData, out reqID);
}
+ if (paramsVal.ContainsKey("codGroup"))
+ {
+ codGroup = paramsVal["codGroup"];
+ }
- // sistemo origine dati x download
- pdfUrl = $"download-offer?id={reqID}";
jsonSource.PathParameters.Add(new PathParameter("ReqId", typeof(int), reqID));
+ if (!string.IsNullOrEmpty(codGroup) && rawDataUrl.Contains("matreq-sale-ord"))
+ {
+ jsonSource.QueryParameters.Add(new QueryParameter("codGroup", typeof(string), codGroup));
+ }
// Assign the JSON source to the data source.
var datasource = new JsonDataSource()
{
diff --git a/Lux.Report.Server/Components/Pages/Reports.razor.cs b/Lux.Report.Server/Components/Pages/Reports.razor.cs
index 0c568300..b5a4adec 100644
--- a/Lux.Report.Server/Components/Pages/Reports.razor.cs
+++ b/Lux.Report.Server/Components/Pages/Reports.razor.cs
@@ -52,6 +52,19 @@ namespace Lux.Report.Server.Components.Pages
}
}
+ protected string CodGroup
+ {
+ get => reqGroup;
+ set
+ {
+ if (reqGroup != value)
+ {
+ reqGroup = value;
+ UpdateParams();
+ }
+ }
+ }
+
#endregion Protected Properties
#region Protected Methods
@@ -101,6 +114,7 @@ namespace Lux.Report.Server.Components.Pages
private string reqID = "0";
private string selFile = "";
+ private string reqGroup = "";
#endregion Private Fields
@@ -162,11 +176,12 @@ namespace Lux.Report.Server.Components.Pages
SelFile = query.TryGetValue("selFile", out var sel) ? sel.ToString() : "";
ReqID = query.TryGetValue("reqId", out var rID) ? rID.ToString() : "0";
+ CodGroup = query.TryGetValue("codGroup", out var rGroup) ? rGroup.ToString() : "";
forceRepType = !string.IsNullOrEmpty(RepType);
forceSelFile = !string.IsNullOrEmpty(SelFile);
// sistemo download URL
- pdfUrl = $"download?ReqId={ReqID}&RepType={RepType}&SelFile={SelFile}";
+ pdfUrl = $"download?ReqId={ReqID}&RepType={RepType}&SelFile={SelFile}&CodGroup={CodGroup}";
}
///
@@ -203,6 +218,7 @@ namespace Lux.Report.Server.Components.Pages
CurrParam.Add("RepType", RepType);
CurrParam.Add("SelFile", SelFile);
CurrParam.Add("ReqID", ReqID);
+ CurrParam.Add("codGroup", CodGroup);
}
#endregion Private Methods
diff --git a/Lux.Report.Server/Lux.Report.Server.csproj b/Lux.Report.Server/Lux.Report.Server.csproj
index 4e70702c..9ae92717 100644
--- a/Lux.Report.Server/Lux.Report.Server.csproj
+++ b/Lux.Report.Server/Lux.Report.Server.csproj
@@ -4,7 +4,7 @@
net8.0
enable
enable
- 1.1.2604.2812
+ 1.1.2604.3017
diff --git a/Lux.Report.Server/Program.cs b/Lux.Report.Server/Program.cs
index bd304391..41c7f6a6 100644
--- a/Lux.Report.Server/Program.cs
+++ b/Lux.Report.Server/Program.cs
@@ -73,6 +73,7 @@ app.MapGet("/download", async (
int? reqId,
string? repType,
string? selFile,
+ string? codGroup,
IPdfReportService pdfService
) =>
{
@@ -114,7 +115,7 @@ app.MapGet("/download", async (
break;
}
string dataFullUrl = $"{apiUrl}/{dataUrl}/{dataReportUrl}";
- var pdf = await pdfService.GeneratePdfAsync(reqId.Value, repType, selFile, imgFullUrl, dataFullUrl);
+ var pdf = await pdfService.GeneratePdfAsync(reqId.Value, repType, selFile, codGroup, imgFullUrl, dataFullUrl);
string fName = $"{repType}_{reqId:00000000}.pdf";
return Results.File(pdf, "application/pdf", fName);
});