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()
|
from vigencia in vigencias.DefaultIfEmpty()
|
||||||
orderby notification.ReferenciaData descending, notification.Data descending
|
orderby notification.ReferenciaData descending, notification.Data descending
|
||||||
select new NotificationExportRow(
|
select new NotificationExportRow(
|
||||||
|
vigencia.Conta,
|
||||||
notification.Linha ?? vigencia.Linha,
|
notification.Linha ?? vigencia.Linha,
|
||||||
notification.Cliente ?? vigencia.Cliente,
|
notification.Cliente ?? vigencia.Cliente,
|
||||||
notification.Usuario ?? vigencia.Usuario,
|
notification.Usuario ?? vigencia.Usuario,
|
||||||
|
vigencia.PlanoContrato,
|
||||||
|
vigencia.DtEfetivacaoServico,
|
||||||
notification.ReferenciaData ?? vigencia.DtTerminoFidelizacao,
|
notification.ReferenciaData ?? vigencia.DtTerminoFidelizacao,
|
||||||
notification.Tipo))
|
notification.Tipo))
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
@ -125,19 +128,15 @@ public class NotificationsController : ControllerBase
|
||||||
var worksheet = workbook.Worksheets.Add("Notificacoes");
|
var worksheet = workbook.Worksheets.Add("Notificacoes");
|
||||||
|
|
||||||
var normalizedFilter = NormalizeFilter(filter);
|
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[]
|
var headers = new[]
|
||||||
{
|
{
|
||||||
"Número da Linha",
|
"CONTA",
|
||||||
|
"LINHA",
|
||||||
"Cliente",
|
"Cliente",
|
||||||
"Usuário",
|
"Usuário",
|
||||||
dateHeader,
|
"PLANO CONTRATO",
|
||||||
|
"DATA INICIO",
|
||||||
|
normalizedFilter is "vencidas" or "vencido" ? "DATA VENCIMENTO" : "DATA A VENCER",
|
||||||
"Status"
|
"Status"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -155,20 +154,27 @@ public class NotificationsController : ControllerBase
|
||||||
{
|
{
|
||||||
var row = rows[i];
|
var row = rows[i];
|
||||||
var rowIndex = i + 2;
|
var rowIndex = i + 2;
|
||||||
worksheet.Cell(rowIndex, 1).Value = row.Linha ?? string.Empty;
|
worksheet.Cell(rowIndex, 1).Value = row.Conta ?? string.Empty;
|
||||||
worksheet.Cell(rowIndex, 2).Value = row.Cliente ?? string.Empty;
|
worksheet.Cell(rowIndex, 2).Value = row.Linha ?? string.Empty;
|
||||||
worksheet.Cell(rowIndex, 3).Value = row.Usuario ?? string.Empty;
|
worksheet.Cell(rowIndex, 3).Value = row.Cliente ?? string.Empty;
|
||||||
worksheet.Cell(rowIndex, 4).Value = row.DataReferencia;
|
worksheet.Cell(rowIndex, 4).Value = row.Usuario ?? string.Empty;
|
||||||
worksheet.Cell(rowIndex, 5).Value = row.Tipo;
|
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(1).Width = 18;
|
||||||
worksheet.Column(2).Width = 26;
|
worksheet.Column(2).Width = 18;
|
||||||
worksheet.Column(3).Width = 24;
|
worksheet.Column(3).Width = 26;
|
||||||
worksheet.Column(4).Width = 20;
|
worksheet.Column(4).Width = 24;
|
||||||
worksheet.Column(5).Width = 14;
|
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();
|
worksheet.Columns().AdjustToContents();
|
||||||
|
|
||||||
|
|
@ -215,9 +221,12 @@ public class NotificationsController : ControllerBase
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed record NotificationExportRow(
|
private sealed record NotificationExportRow(
|
||||||
|
string? Conta,
|
||||||
string? Linha,
|
string? Linha,
|
||||||
string? Cliente,
|
string? Cliente,
|
||||||
string? Usuario,
|
string? Usuario,
|
||||||
|
string? PlanoContrato,
|
||||||
|
DateTime? DataInicio,
|
||||||
DateTime? DataReferencia,
|
DateTime? DataReferencia,
|
||||||
string Tipo);
|
string Tipo);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue