feat: dim unreachable event rows in expired certificate reports
This commit is contained in:
@@ -5,6 +5,7 @@ using Syncfusion.Drawing;
|
||||
using Syncfusion.Pdf;
|
||||
using Syncfusion.Pdf.Graphics;
|
||||
using Syncfusion.Pdf.Grid;
|
||||
using System.Globalization;
|
||||
|
||||
namespace CertReports.Syncfusion.Services.Implementations;
|
||||
|
||||
@@ -86,6 +87,15 @@ public class EventiSectionRenderer : IPdfSectionRenderer
|
||||
hr.Cells[i].StringFormat = new PdfStringFormat(PdfTextAlignment.Center);
|
||||
}
|
||||
|
||||
// Pre-parse DataRimborso per confronto righe non raggiungibili (solo expired)
|
||||
DateTime? rimborsoDate = null;
|
||||
if (isExpired && !string.IsNullOrEmpty(data.Info.DataRimborso) &&
|
||||
DateTime.TryParseExact(data.Info.DataRimborso, "dd/MM/yyyy",
|
||||
CultureInfo.InvariantCulture, DateTimeStyles.None, out var rd))
|
||||
{
|
||||
rimborsoDate = rd;
|
||||
}
|
||||
|
||||
// Righe dati
|
||||
for (int i = 0; i < data.Eventi.Count; i++)
|
||||
{
|
||||
@@ -133,6 +143,16 @@ public class EventiSectionRenderer : IPdfSectionRenderer
|
||||
// Evidenzia "SI" nella colonna Pagato
|
||||
if (evt.Paid == "SI")
|
||||
row.Cells[paidColIndex].Style.TextBrush = PdfTheme.PositiveBrush as PdfBrush;
|
||||
|
||||
// Righe non raggiungibili: testo grigio dimmed (ObservationDate > DataRimborso)
|
||||
if (rimborsoDate.HasValue &&
|
||||
DateTime.TryParseExact(evt.ObservationDate, "dd/MM/yyyy",
|
||||
CultureInfo.InvariantCulture, DateTimeStyles.None, out var obsDate) &&
|
||||
obsDate > rimborsoDate.Value)
|
||||
{
|
||||
foreach (var cell in row.Cells.OfType<PdfGridCell>())
|
||||
cell.Style.TextBrush = PdfTheme.GrayedOutBrush;
|
||||
}
|
||||
}
|
||||
|
||||
// Larghezze colonne (landscape A4 ~ 757 punti utili)
|
||||
|
||||
Reference in New Issue
Block a user