QuestPdf Implementado en la totalidad de reportes.
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 7m55s

This commit is contained in:
2025-06-24 12:52:37 -03:00
parent a5bcbefa52
commit 229eb937f5
51 changed files with 4009 additions and 954 deletions

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class ComparativaConsumoBobinasViewModel
{
public IEnumerable<ComparativaConsumoBobinasDto> Detalles { get; set; } = new List<ComparativaConsumoBobinasDto>();
public string? NombrePlanta { get; set; }
public string MesA { get; set; } = string.Empty;
public string MesB { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
public bool EsConsolidado => string.IsNullOrEmpty(NombrePlanta);
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class ConsumoBobinasPublicacionViewModel
{
public IEnumerable<ConsumoBobinasPublicacionDto> Detalles { get; set; } = new List<ConsumoBobinasPublicacionDto>();
public string FechaDesde { get; set; } = string.Empty;
public string FechaHasta { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class ConsumoBobinasSeccionViewModel
{
public IEnumerable<ConsumoBobinasSeccionDto> Detalles { get; set; } = new List<ConsumoBobinasSeccionDto>();
public string? NombrePlanta { get; set; }
public string FechaDesde { get; set; } = string.Empty;
public string FechaHasta { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
public bool EsConsolidado => string.IsNullOrEmpty(NombrePlanta);
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class ControlDevolucionesViewModel
{
// --- Datos de entrada ---
public IEnumerable<ControlDevolucionesReporteDto> Detalles { get; set; } = new List<ControlDevolucionesReporteDto>();
public int TotalDevolucionDiasAnteriores { get; set; }
// --- Parámetros del reporte ---
public string NombreEmpresa { get; set; } = string.Empty;
public string FechaConsultada { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
// --- Propiedades calculadas (corregidas para ser de solo lectura) ---
public int CantidadCanillas => Detalles?.FirstOrDefault()?.TotalNoAccionistas ?? 0;
public int TotalIngresadosPorRemito => Detalles?.FirstOrDefault()?.Ingresados ?? 0;
public int TotalSobrantes => Detalles?.FirstOrDefault()?.Sobrantes ?? 0;
public int TotalSinCargo => Detalles?.FirstOrDefault()?.SinCargo ?? 0;
public int TotalLlevados => Detalles?.Sum(d => d.Llevados) ?? 0;
public int TotalDevueltosFecha => Detalles?.Sum(d => d.Devueltos) ?? 0;
public decimal TotalDevolucionALaFecha => (decimal)(TotalIngresadosPorRemito - TotalLlevados + TotalDevueltosFecha);
public decimal TotalDevolucionGeneral => TotalDevolucionALaFecha + TotalDevolucionDiasAnteriores;
public decimal DiferenciaFinal => TotalDevolucionALaFecha - TotalSobrantes - TotalSinCargo;
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class CuentasDistribuidorViewModel
{
// --- Datos de entrada ---
public IEnumerable<BalanceCuentaDistDto> Movimientos { get; set; } = new List<BalanceCuentaDistDto>();
public IEnumerable<BalanceCuentaPagosDto> Pagos { get; set; } = new List<BalanceCuentaPagosDto>();
public IEnumerable<BalanceCuentaDebCredDto> DebitosCreditos { get; set; } = new List<BalanceCuentaDebCredDto>();
// Saldo real de la cuenta, se muestra al final sin usarse en cálculos intermedios.
public decimal SaldoDeCuenta { get; set; }
// --- Parámetros del reporte ---
public string NombreDistribuidor { get; set; } = string.Empty;
public string FechaDesde { get; set; } = string.Empty;
public string FechaHasta { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
// --- Propiedades para el resumen final ---
public decimal TotalMovimientos => Movimientos.Sum(m => m.Debe - m.Haber);
public decimal TotalPagos => Pagos.Sum(p => p.Debe - p.Haber);
public decimal TotalDebitosCreditos => DebitosCreditos.Sum(d => d.Debe - d.Haber);
public decimal TotalPeriodo => TotalMovimientos + TotalPagos + TotalDebitosCreditos;
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class DistribucionCanillasViewModel
{
// --- Datos de entrada ---
public IEnumerable<DetalleDistribucionCanillaDto> Canillas { get; set; } = new List<DetalleDistribucionCanillaDto>();
public IEnumerable<DetalleDistribucionCanillaDto> CanillasAccionistas { get; set; } = new List<DetalleDistribucionCanillaDto>();
public IEnumerable<DetalleDistribucionCanillaAllDto> CanillasTodos { get; set; } = new List<DetalleDistribucionCanillaAllDto>();
public IEnumerable<DetalleDistribucionCanillaDto> CanillasLiquidadasOtraFecha { get; set; } = new List<DetalleDistribucionCanillaDto>();
public IEnumerable<DetalleDistribucionCanillaDto> CanillasAccionistasLiquidadasOtraFecha { get; set; } = new List<DetalleDistribucionCanillaDto>();
public IEnumerable<ControlDevolucionesReporteDto> ControlDevolucionesDetalle { get; set; } = new List<ControlDevolucionesReporteDto>();
public int RemitoIngresado { get; set; }
// --- Parámetros del reporte ---
public string Empresa { get; set; } = string.Empty;
public string FechaConsultada { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
// Propiedades calculadas para el resumen final
public int VentaTotal => (ControlDevolucionesDetalle?.Sum(d => d.Llevados) ?? 0) - (ControlDevolucionesDetalle?.Sum(d => d.Devueltos) ?? 0);
public int DevolucionTotal => RemitoIngresado - VentaTotal;
}
}

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class LiquidacionCanillaViewModel
{
// --- Datos de entrada ---
public IEnumerable<LiquidacionCanillaDetalleDto> Detalles { get; set; } = new List<LiquidacionCanillaDetalleDto>();
public IEnumerable<LiquidacionCanillaGananciaDto> Ganancias { get; set; } = new List<LiquidacionCanillaGananciaDto>();
// --- Parámetros del reporte ---
public string FechaLiquidacion { get; set; } = string.Empty;
// Propiedades calculadas para un acceso más fácil y limpio en la plantilla
public string NombreVendedor => Detalles.FirstOrDefault()?.Canilla ?? "N/A";
public decimal TotalARendir => Detalles.Sum(d => d.TotalRendir);
public decimal TotalComisiones => Ganancias.Sum(g => g.TotalRendir);
// Propiedad para el título del reporte
public string TituloReporte => EsAccionista ? "Liquidación de Accionistas" : "Liquidación Venta de Diarios";
public bool EsAccionista { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class ListadoDistCanMensualDiariosViewModel
{
public IEnumerable<ListadoDistCanMensualDiariosDto> Detalles { get; set; } = new List<ListadoDistCanMensualDiariosDto>();
public string TipoDestinatario { get; set; } = string.Empty; // "Canillitas" o "Accionistas"
public string FechaDesde { get; set; } = string.Empty;
public string FechaHasta { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class ListadoDistCanMensualViewModel
{
// Usamos el DTO existente que ya tiene la estructura que necesitamos.
public IEnumerable<ListadoDistCanMensualPubDto> Detalles { get; set; } = new List<ListadoDistCanMensualPubDto>();
// Parámetros para el encabezado
public string TipoDestinatario { get; set; } = string.Empty; // "Canillitas" o "Accionistas"
public string FechaDesde { get; set; } = string.Empty;
public string FechaHasta { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class ListadoDistCanillasImporteViewModel
{
public IEnumerable<ListadoDistribucionCanillasImporteDto> Detalles { get; set; } = new List<ListadoDistribucionCanillasImporteDto>();
public string NombrePublicacion { get; set; } = string.Empty;
public string TipoDestinatario { get; set; } = string.Empty; // "Canillitas" o "Accionistas"
public string FechaDesde { get; set; } = string.Empty;
public string FechaHasta { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
}
}

View File

@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class ListadoDistribucionCanillasViewModel
{
public IEnumerable<ListadoDistribucionCanillasSimpleDto> DetalleDiario { get; set; } = new List<ListadoDistribucionCanillasSimpleDto>();
public IEnumerable<ListadoDistribucionCanillasPromedioDiaDto> PromediosPorDia { get; set; } = new List<ListadoDistribucionCanillasPromedioDiaDto>();
public string NombrePublicacion { get; set; } = string.Empty;
public string FechaDesde { get; set; } = string.Empty;
public string FechaHasta { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
public ListadoDistribucionCanillasSimpleDto TotalesDetalleDiario
{
get
{
if (DetalleDiario == null || !DetalleDiario.Any())
{
return new ListadoDistribucionCanillasSimpleDto();
}
return new ListadoDistribucionCanillasSimpleDto
{
Llevados = DetalleDiario.Sum(d => d.Llevados),
Devueltos = DetalleDiario.Sum(d => d.Devueltos)
};
}
}
// --- PROPIEDAD PARA LA FILA "GENERAL" ---
public ListadoDistribucionCanillasPromedioDiaDto? PromedioGeneral
{
get
{
if (PromediosPorDia == null || !PromediosPorDia.Any()) return null;
// Sumamos los totales, no promediamos los promedios
var totalLlevados = PromediosPorDia.Sum(p => p.Llevados);
var totalDevueltos = PromediosPorDia.Sum(p => p.Devueltos);
var totalDias = PromediosPorDia.Sum(p => p.Cant);
if (totalDias == 0) return null;
return new ListadoDistribucionCanillasPromedioDiaDto
{
Dia = "General",
Cant = totalDias,
Promedio_Llevados = totalLlevados / totalDias,
Promedio_Devueltos = totalDevueltos / totalDias,
Promedio_Ventas = (totalLlevados - totalDevueltos) / totalDias
};
}
}
}
}

View File

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class ListadoDistribucionDistribuidoresViewModel
{
public IEnumerable<ListadoDistribucionDistSimpleDto> DetalleDiario { get; set; } = new List<ListadoDistribucionDistSimpleDto>();
public IEnumerable<ListadoDistribucionDistPromedioDiaDto> PromediosPorDia { get; set; } = new List<ListadoDistribucionDistPromedioDiaDto>();
public string NombrePublicacion { get; set; } = string.Empty;
public string NombreDistribuidor { get; set; } = string.Empty;
public string FechaDesde { get; set; } = string.Empty;
public string FechaHasta { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
// --- PROPIEDAD CALCULADA PARA LA FILA "GENERAL" ---
public ListadoDistribucionDistPromedioDiaDto? PromedioGeneral
{
get
{
if (DetalleDiario == null || !DetalleDiario.Any())
{
return null;
}
var diasConDatos = DetalleDiario.Count(d => (d.Llevados ?? 0) > 0);
if (diasConDatos == 0) return null;
var totalLlevados = DetalleDiario.Sum(d => d.Llevados ?? 0);
var totalDevueltos = DetalleDiario.Sum(d => d.Devueltos ?? 0);
return new ListadoDistribucionDistPromedioDiaDto
{
Dia = "General",
Cant = diasConDatos,
Promedio_Llevados = totalLlevados / diasConDatos,
Promedio_Devueltos = totalDevueltos / diasConDatos,
Promedio_Ventas = (totalLlevados - totalDevueltos) / diasConDatos,
Llevados = totalLlevados, // Guardamos el total para el cálculo del %
Devueltos = totalDevueltos // Guardamos el total para el cálculo del %
};
}
}
}
}

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq; // Necesario para .Any() y .Sum()
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class ListadoDistribucionGeneralViewModel
{
public IEnumerable<ListadoDistribucionGeneralResumenDto> ResumenMensual { get; set; } = new List<ListadoDistribucionGeneralResumenDto>();
public IEnumerable<ListadoDistribucionGeneralPromedioDiaDto> PromediosPorDia { get; set; } = new List<ListadoDistribucionGeneralPromedioDiaDto>();
public string NombrePublicacion { get; set; } = string.Empty;
public string MesConsultado { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
// --- PROPIEDAD PARA LOS TOTALES GENERALES DE PROMEDIOS ---
// Esta propiedad calcula los promedios generales basados en los datos del resumen mensual.
public ListadoDistribucionGeneralPromedioDiaDto? PromedioGeneral
{
get
{
if (ResumenMensual == null || !ResumenMensual.Any())
{
return null;
}
// Contar solo los días con tirada > 0 para promediar correctamente
var diasConTirada = ResumenMensual.Count(d => d.CantidadTirada > 0);
if (diasConTirada == 0) return null;
return new ListadoDistribucionGeneralPromedioDiaDto
{
Dia = "General",
CantidadDias = diasConTirada,
PromedioTirada = (int)ResumenMensual.Average(r => r.CantidadTirada),
PromedioSinCargo = (int)ResumenMensual.Average(r => r.SinCargo),
PromedioPerdidos = (int)ResumenMensual.Average(r => r.Perdidos),
PromedioLlevados = (int)ResumenMensual.Average(r => r.Llevados),
PromedioDevueltos = (int)ResumenMensual.Average(r => r.Devueltos),
PromedioVendidos = (int)ResumenMensual.Average(r => r.Vendidos)
};
}
}
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class MovimientoBobinasEstadoViewModel
{
public IEnumerable<MovimientoBobinaEstadoDetalleDto> Detalles { get; set; } = new List<MovimientoBobinaEstadoDetalleDto>();
public IEnumerable<MovimientoBobinaEstadoTotalDto> Totales { get; set; } = new List<MovimientoBobinaEstadoTotalDto>();
public string NombrePlanta { get; set; } = string.Empty;
public string FechaDesde { get; set; } = string.Empty;
public string FechaHasta { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class MovimientoBobinasViewModel
{
public IEnumerable<MovimientoBobinasDto> Movimientos { get; set; } = new List<MovimientoBobinasDto>();
public string NombrePlanta { get; set; } = string.Empty;
public string FechaDesde { get; set; } = string.Empty;
public string FechaHasta { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class NovedadesCanillasViewModel
{
// Resumen de ganancias, faltas y francos por canilla
public IEnumerable<CanillaGananciaReporteDto> ResumenCanillas { get; set; } = new List<CanillaGananciaReporteDto>();
// Detalle de las novedades textuales
public IEnumerable<NovedadesCanillasReporteDto> DetallesNovedades { get; set; } = new List<NovedadesCanillasReporteDto>();
// Parámetros para el encabezado
public string NombreEmpresa { get; set; } = string.Empty;
public string FechaDesde { get; set; } = string.Empty;
public string FechaHasta { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class TiradasPublicacionesSeccionesViewModel
{
public IEnumerable<TiradasPublicacionesSeccionesDto> Detalles { get; set; } = new List<TiradasPublicacionesSeccionesDto>();
public string NombrePublicacion { get; set; } = string.Empty;
public string MesConsultado { get; set; } = string.Empty;
public string FechaReporte { get; set; } = DateTime.Now.ToString("dd/MM/yyyy");
// Será nulo o vacío para la versión consolidada.
public string? NombrePlanta { get; set; }
// Propiedad calculada para simplificar la lógica en la plantilla.
public bool EsConsolidado => string.IsNullOrEmpty(NombrePlanta);
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class VentaMensualSecretariaElDiaViewModel
{
public IEnumerable<VentaMensualSecretariaElDiaDto> VentasDiarias { get; set; } = new List<VentaMensualSecretariaElDiaDto>();
public string FechaDesde { get; set; } = string.Empty;
public string FechaHasta { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class VentaMensualSecretariaElPlataViewModel
{
public IEnumerable<VentaMensualSecretariaElPlataDto> VentasDiarias { get; set; } = new List<VentaMensualSecretariaElPlataDto>();
public string FechaDesde { get; set; } = string.Empty;
public string FechaHasta { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
namespace GestionIntegral.Api.Dtos.Reportes.ViewModels
{
public class VentaMensualSecretariaTirDevoViewModel
{
public IEnumerable<VentaMensualSecretariaTirDevoDto> VentasDiarias { get; set; } = new List<VentaMensualSecretariaTirDevoDto>();
public string FechaDesde { get; set; } = string.Empty;
public string FechaHasta { get; set; } = string.Empty;
}
}