Expand notification export columns
This commit is contained in:
parent
b5c410b9cf
commit
02acc181a5
|
|
@ -114,9 +114,12 @@ public class NotificationsController : ControllerBase
|
|||
from vigencia in vigencias.DefaultIfEmpty()
|
||||
orderby notification.ReferenciaData descending, notification.Data descending
|
||||
select new NotificationExportRow(
|
||||
vigencia.Conta,
|
||||
notification.Linha ?? vigencia.Linha,
|
||||
notification.Cliente ?? vigencia.Cliente,
|
||||
notification.Usuario ?? vigencia.Usuario,
|
||||
vigencia.PlanoContrato,
|
||||
vigencia.DtEfetivacaoServico,
|
||||
notification.ReferenciaData ?? vigencia.DtTerminoFidelizacao,
|
||||
notification.Tipo))
|
||||
.ToListAsync();
|
||||
|
|
@ -125,19 +128,15 @@ public class NotificationsController : ControllerBase
|
|||
var worksheet = workbook.Worksheets.Add("Notificacoes");
|
||||
|
||||
var normalizedFilter = NormalizeFilter(filter);
|
||||
var dateHeader = normalizedFilter switch
|
||||
{
|
||||
"vencidas" or "vencido" => "Data da Expiração",
|
||||
"a-vencer" or "avencer" => "Data a Vencer",
|
||||
_ => "Data de Referência"
|
||||
};
|
||||
|
||||
var headers = new[]
|
||||
{
|
||||
"Número da Linha",
|
||||
"CONTA",
|
||||
"LINHA",
|
||||
"Cliente",
|
||||
"Usuário",
|
||||
dateHeader,
|
||||
"PLANO CONTRATO",
|
||||
"DATA INICIO",
|
||||
normalizedFilter is "vencidas" or "vencido" ? "DATA VENCIMENTO" : "DATA A VENCER",
|
||||
"Status"
|
||||
};
|
||||
|
||||
|
|
@ -155,20 +154,27 @@ public class NotificationsController : ControllerBase
|
|||
{
|
||||
var row = rows[i];
|
||||
var rowIndex = i + 2;
|
||||
worksheet.Cell(rowIndex, 1).Value = row.Linha ?? string.Empty;
|
||||
worksheet.Cell(rowIndex, 2).Value = row.Cliente ?? string.Empty;
|
||||
worksheet.Cell(rowIndex, 3).Value = row.Usuario ?? string.Empty;
|
||||
worksheet.Cell(rowIndex, 4).Value = row.DataReferencia;
|
||||
worksheet.Cell(rowIndex, 5).Value = row.Tipo;
|
||||
worksheet.Cell(rowIndex, 1).Value = row.Conta ?? string.Empty;
|
||||
worksheet.Cell(rowIndex, 2).Value = row.Linha ?? string.Empty;
|
||||
worksheet.Cell(rowIndex, 3).Value = row.Cliente ?? string.Empty;
|
||||
worksheet.Cell(rowIndex, 4).Value = row.Usuario ?? string.Empty;
|
||||
worksheet.Cell(rowIndex, 5).Value = row.PlanoContrato ?? string.Empty;
|
||||
worksheet.Cell(rowIndex, 6).Value = row.DataInicio;
|
||||
worksheet.Cell(rowIndex, 7).Value = row.DataReferencia;
|
||||
worksheet.Cell(rowIndex, 8).Value = row.Tipo;
|
||||
}
|
||||
|
||||
worksheet.Column(1).Width = 18;
|
||||
worksheet.Column(2).Width = 26;
|
||||
worksheet.Column(3).Width = 24;
|
||||
worksheet.Column(4).Width = 20;
|
||||
worksheet.Column(5).Width = 14;
|
||||
worksheet.Column(2).Width = 18;
|
||||
worksheet.Column(3).Width = 26;
|
||||
worksheet.Column(4).Width = 24;
|
||||
worksheet.Column(5).Width = 22;
|
||||
worksheet.Column(6).Width = 16;
|
||||
worksheet.Column(7).Width = 18;
|
||||
worksheet.Column(8).Width = 14;
|
||||
|
||||
worksheet.Column(4).Style.DateFormat.Format = "dd/MM/yyyy";
|
||||
worksheet.Column(6).Style.DateFormat.Format = "dd/MM/yyyy";
|
||||
worksheet.Column(7).Style.DateFormat.Format = "dd/MM/yyyy";
|
||||
|
||||
worksheet.Columns().AdjustToContents();
|
||||
|
||||
|
|
@ -215,9 +221,12 @@ public class NotificationsController : ControllerBase
|
|||
}
|
||||
|
||||
private sealed record NotificationExportRow(
|
||||
string? Conta,
|
||||
string? Linha,
|
||||
string? Cliente,
|
||||
string? Usuario,
|
||||
string? PlanoContrato,
|
||||
DateTime? DataInicio,
|
||||
DateTime? DataReferencia,
|
||||
string Tipo);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue