89 lines
4.6 KiB
C#
89 lines
4.6 KiB
C#
|
|
using GestionIntegral.Api.Dtos.Reportes.ViewModels;
|
||
|
|
using QuestPDF.Fluent;
|
||
|
|
using QuestPDF.Helpers;
|
||
|
|
using QuestPDF.Infrastructure;
|
||
|
|
using System.Linq;
|
||
|
|
|
||
|
|
namespace GestionIntegral.Api.Controllers.Reportes.PdfTemplates
|
||
|
|
{
|
||
|
|
public class VentaMensualSecretariaElPlataDocument : IDocument
|
||
|
|
{
|
||
|
|
public VentaMensualSecretariaElPlataViewModel Model { get; }
|
||
|
|
|
||
|
|
public VentaMensualSecretariaElPlataDocument(VentaMensualSecretariaElPlataViewModel model)
|
||
|
|
{
|
||
|
|
Model = model;
|
||
|
|
}
|
||
|
|
|
||
|
|
public DocumentMetadata GetMetadata() => DocumentMetadata.Default;
|
||
|
|
|
||
|
|
public void Compose(IDocumentContainer container)
|
||
|
|
{
|
||
|
|
container.Page(page =>
|
||
|
|
{
|
||
|
|
page.Margin(1, Unit.Centimetre);
|
||
|
|
page.DefaultTextStyle(x => x.FontFamily("Arial").FontSize(11));
|
||
|
|
|
||
|
|
page.Header().Element(ComposeHeader);
|
||
|
|
page.Content().Element(ComposeContent);
|
||
|
|
page.Footer().AlignCenter().Text(x => { x.Span("Página "); x.CurrentPageNumber(); });
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
void ComposeHeader(IContainer container)
|
||
|
|
{
|
||
|
|
container.Column(column =>
|
||
|
|
{
|
||
|
|
column.Spacing(5);
|
||
|
|
column.Item().AlignCenter().Text("VENTA DIARIO EL PLATA").SemiBold().FontSize(16);
|
||
|
|
|
||
|
|
column.Item().AlignCenter().Text(text =>
|
||
|
|
{
|
||
|
|
text.Span("Fecha Consultada: Desde ").SemiBold().FontSize(12);
|
||
|
|
text.Span(Model.FechaDesde).FontSize(12);
|
||
|
|
text.Span(" Hasta ").SemiBold().FontSize(12);
|
||
|
|
text.Span(Model.FechaHasta).FontSize(12);
|
||
|
|
});
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
void ComposeContent(IContainer container)
|
||
|
|
{
|
||
|
|
container.PaddingTop(5, Unit.Millimetre).Table(table =>
|
||
|
|
{
|
||
|
|
table.ColumnsDefinition(columns =>
|
||
|
|
{
|
||
|
|
columns.ConstantColumn(50); // Día
|
||
|
|
columns.RelativeColumn(); // Tirada Coop
|
||
|
|
columns.RelativeColumn(); // Devolución Coop
|
||
|
|
columns.RelativeColumn(); // Venta Coop
|
||
|
|
columns.RelativeColumn(); // Tirada Canillas
|
||
|
|
columns.RelativeColumn(); // Venta Canillas
|
||
|
|
columns.RelativeColumn(); // Total
|
||
|
|
});
|
||
|
|
|
||
|
|
table.Header(header =>
|
||
|
|
{
|
||
|
|
header.Cell().Background(Colors.Black).Border(1).BorderColor(Colors.White).Padding(4).AlignCenter().Text(text => text.Span("DÍA").FontColor(Colors.White).SemiBold());
|
||
|
|
header.Cell().Background(Colors.Black).Border(1).BorderColor(Colors.White).Padding(4).AlignCenter().Text(text => text.Span("TIRADA COOP.").FontColor(Colors.White).SemiBold());
|
||
|
|
header.Cell().Background(Colors.Black).Border(1).BorderColor(Colors.White).Padding(4).AlignCenter().Text(text => text.Span("DEVOLUCIÓN COOP.").FontColor(Colors.White).SemiBold());
|
||
|
|
header.Cell().Background(Colors.Black).Border(1).BorderColor(Colors.White).Padding(4).AlignCenter().Text(text => text.Span("VENTA COOP.").FontColor(Colors.White).SemiBold());
|
||
|
|
header.Cell().Background(Colors.Black).Border(1).BorderColor(Colors.White).Padding(4).AlignCenter().Text(text => text.Span("TIRADA CANILLAS").FontColor(Colors.White).SemiBold());
|
||
|
|
header.Cell().Background(Colors.Black).Border(1).BorderColor(Colors.White).Padding(4).AlignCenter().Text(text => text.Span("VENTA CANILLAS (TOTAL)").FontColor(Colors.White).SemiBold());
|
||
|
|
header.Cell().Background(Colors.Black).Border(1).BorderColor(Colors.White).Padding(4).AlignCenter().Text(text => text.Span("TOTAL").FontColor(Colors.White).SemiBold());
|
||
|
|
});
|
||
|
|
|
||
|
|
foreach (var item in Model.VentasDiarias.OrderBy(x => x.Dia))
|
||
|
|
{
|
||
|
|
table.Cell().Border(1).Padding(4).AlignCenter().Text(item.Dia.ToString());
|
||
|
|
table.Cell().Border(1).Padding(4).AlignCenter().Text(item.TiradaCoop.ToString("N0"));
|
||
|
|
table.Cell().Border(1).Padding(4).AlignCenter().Text(item.DevolucionCoop.ToString("N0"));
|
||
|
|
table.Cell().Border(1).Padding(4).AlignCenter().Text(item.VentaCoop.ToString("N0"));
|
||
|
|
table.Cell().Border(1).Padding(4).AlignCenter().Text(item.TiradaCan.ToString("N0"));
|
||
|
|
table.Cell().Border(1).Padding(4).AlignCenter().Text(item.VentaCan.ToString("N0"));
|
||
|
|
table.Cell().Border(1).Padding(4).AlignCenter().Text(t => t.Span(item.Total.ToString("N0")).SemiBold());
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|