using System; using System.Collections.Generic; using System.Linq; namespace GestionIntegral.Api.Dtos.Reportes.ViewModels { public class ControlDevolucionesViewModel { // --- Datos de entrada --- public IEnumerable Detalles { get; set; } = new List(); 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; } }