feat(reportes): Permite consulta consolidada en Detalle de Distribución
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 2m34s
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 2m34s
Implementa la funcionalidad para generar el reporte "Detalle de Distribución de Canillas" de forma consolidada para todas las empresas, separando entre Canillitas y Accionistas. Adicionalmente, se realizan correcciones y mejoras visuales en otros reportes.
### Cambios Principales
- **Frontend (`ReporteDetalleDistribucionCanillasPage`):**
- Se añade la opción "TODAS" al selector de Empresas.
- Al seleccionar "TODAS", se muestra un nuevo control para elegir entre "Canillitas" o "Accionistas".
- La vista del reporte se simplifica en el modo "TODAS", mostrando solo la tabla correspondiente y ocultando el resumen por tipo de vendedor.
- **Backend (`ReportesService`, `ReportesRepository`):**
- Se modifica el servicio para recibir el parámetro `esAccionista`.
- Se implementa una nueva lógica que, si `idEmpresa` es 0, llama a los nuevos procedimientos almacenados que consultan todas las empresas.
- Se ajusta el `ReportesController` para aceptar y pasar el nuevo parámetro.
### Correcciones
- **Base de Datos:**
- Se añade la función SQL `FN_ObtenerPrecioVigente` para los nuevos Stored Procedures.
- Se crean los Stored Procedures `SP_DistCanillasEntradaSalidaPubli_AllEmpresas` y `SP_DistCanillasAccEntradaSalidaPubli_AllEmpresas`.
- **Backend (`ReportesController`):**
- Se corrigen errores de compilación (`CS7036`, `CS8130`) añadiendo el parámetro `esAccionista` faltante en las llamadas al servicio `ObtenerReporteDistribucionCanillasAsync`.
### Mejoras Visuales
- **PDF (`ControlDevolucionesDocument.cs`):**
- Se ajustan los espaciados verticales (`Padding` y `Spacing`) en la plantilla QuestPDF del reporte "Control de Devoluciones" para lograr un diseño más compacto.
This commit is contained in:
@@ -41,9 +41,11 @@ namespace GestionIntegral.Api.Controllers.Reportes.PdfTemplates
|
||||
|
||||
void ComposeContent(IContainer container)
|
||||
{
|
||||
container.PaddingTop(1, Unit.Centimetre).Column(column =>
|
||||
// << CAMBIO: Reducido el padding superior de 1cm a 5mm >>
|
||||
container.PaddingTop(5, Unit.Millimetre).Column(column =>
|
||||
{
|
||||
column.Spacing(15);
|
||||
// << CAMBIO: Reducido el espaciado principal entre elementos de 15 a 10 puntos >>
|
||||
column.Spacing(10);
|
||||
|
||||
column.Item().Row(row =>
|
||||
{
|
||||
@@ -59,23 +61,24 @@ namespace GestionIntegral.Api.Controllers.Reportes.PdfTemplates
|
||||
});
|
||||
});
|
||||
|
||||
column.Item().PaddingTop(5).Border(1).Background(Colors.Grey.Lighten3).AlignCenter().Padding(2).Text(Model.NombreEmpresa).SemiBold();
|
||||
column.Item().PaddingTop(3).Border(1).Background(Colors.Grey.Lighten3).AlignCenter().Padding(2).Text(Model.NombreEmpresa).SemiBold();
|
||||
|
||||
column.Item().Border(1).Padding(10).Column(innerCol =>
|
||||
column.Item().Border(1).Padding(8).Column(innerCol => // << CAMBIO: Padding reducido de 10 a 8 >>
|
||||
{
|
||||
innerCol.Spacing(5);
|
||||
// << CAMBIO: Reducido el espaciado interno de 5 a 4 >>
|
||||
innerCol.Spacing(4);
|
||||
|
||||
// Fila de "Ingresados por Remito" con borde inferior sólido.
|
||||
innerCol.Item().BorderBottom(1, Unit.Point).BorderColor(Colors.Grey.Medium).Row(row =>
|
||||
{
|
||||
row.RelativeItem().Text("Ingresados por Remito:").SemiBold();
|
||||
row.RelativeItem().AlignRight().Text(Model.TotalIngresadosPorRemito.ToString("N0"));
|
||||
}); // <-- SOLUCIÓN: Borde sólido simple.
|
||||
});
|
||||
|
||||
foreach (var item in Model.Detalles)
|
||||
{
|
||||
var totalSeccion = item.Devueltos - item.Llevados;
|
||||
innerCol.Item().PaddingTop(5).Row(row =>
|
||||
// << CAMBIO: Reducido el padding superior de 5 a 3 >>
|
||||
innerCol.Item().PaddingTop(3).Row(row =>
|
||||
{
|
||||
row.ConstantItem(100).Text(item.Tipo).SemiBold();
|
||||
|
||||
@@ -90,7 +93,8 @@ namespace GestionIntegral.Api.Controllers.Reportes.PdfTemplates
|
||||
r.RelativeItem().Text("Devueltos");
|
||||
r.RelativeItem().AlignRight().Text($"{item.Devueltos:N0}");
|
||||
});
|
||||
sub.Item().BorderTop(1.5f).BorderColor(Colors.Black).PaddingTop(2).Row(r => {
|
||||
// << CAMBIO: Reducido el padding superior de 2 a 1 >>
|
||||
sub.Item().BorderTop(1.5f).BorderColor(Colors.Black).PaddingTop(1).Row(r => {
|
||||
r.RelativeItem().Text(t => t.Span("Total").SemiBold());
|
||||
r.RelativeItem().AlignRight().Text(t => t.Span(totalSeccion.ToString("N0")).SemiBold());
|
||||
});
|
||||
@@ -99,7 +103,8 @@ namespace GestionIntegral.Api.Controllers.Reportes.PdfTemplates
|
||||
}
|
||||
});
|
||||
|
||||
column.Item().PaddingTop(10).Column(finalCol =>
|
||||
// << CAMBIO: Reducido el padding superior de 10 a 8 >>
|
||||
column.Item().PaddingTop(8).Column(finalCol =>
|
||||
{
|
||||
finalCol.Spacing(2);
|
||||
|
||||
@@ -112,13 +117,15 @@ namespace GestionIntegral.Api.Controllers.Reportes.PdfTemplates
|
||||
if (isBold) valueText.SemiBold();
|
||||
};
|
||||
|
||||
// Usamos bordes superiores para separar las líneas de total
|
||||
finalCol.Item().BorderTop(2f).BorderColor(Colors.Black).PaddingTop(2).Row(row => AddTotalRow(row, "Total Devolución a la Fecha", Model.TotalDevolucionALaFecha.ToString("N0"), false));
|
||||
finalCol.Item().BorderTop(1).BorderColor(Colors.Grey.Lighten2).PaddingTop(2).Row(row => AddTotalRow(row, "Total Devolución Días Anteriores", Model.TotalDevolucionDiasAnteriores.ToString("N0"), false));
|
||||
finalCol.Item().BorderTop(1).BorderColor(Colors.Grey.Lighten2).PaddingTop(2).Row(row => AddTotalRow(row, "Total Devolución", Model.TotalDevolucionGeneral.ToString("N0"), false));
|
||||
finalCol.Item().BorderTop(2f).BorderColor(Colors.Black).PaddingTop(5).Row(row => AddTotalRow(row, "Sin Cargo", Model.TotalSinCargo.ToString("N0"), false));
|
||||
finalCol.Item().BorderTop(1).BorderColor(Colors.Grey.Lighten2).PaddingTop(2).Row(row => AddTotalRow(row, "Sobrantes", $"-{Model.TotalSobrantes.ToString("N0")}", false));
|
||||
finalCol.Item().BorderTop(1).BorderColor(Colors.Grey.Lighten2).BorderBottom(1).BorderColor(Colors.Grey.Lighten2).PaddingTop(5).Row(row => AddTotalRow(row, "Diferencia", Model.DiferenciaFinal.ToString("N0"), true));
|
||||
// << CAMBIO: Reducido el padding superior de 2 a 1 en las siguientes líneas >>
|
||||
finalCol.Item().BorderTop(2f).BorderColor(Colors.Black).PaddingTop(1).Row(row => AddTotalRow(row, "Total Devolución a la Fecha", Model.TotalDevolucionALaFecha.ToString("N0"), false));
|
||||
finalCol.Item().BorderTop(1).BorderColor(Colors.Grey.Lighten2).PaddingTop(1).Row(row => AddTotalRow(row, "Total Devolución Días Anteriores", Model.TotalDevolucionDiasAnteriores.ToString("N0"), false));
|
||||
finalCol.Item().BorderTop(1).BorderColor(Colors.Grey.Lighten2).PaddingTop(1).Row(row => AddTotalRow(row, "Total Devolución", Model.TotalDevolucionGeneral.ToString("N0"), false));
|
||||
// << CAMBIO: Reducido el padding superior de 5 a 3 >>
|
||||
finalCol.Item().BorderTop(2f).BorderColor(Colors.Black).PaddingTop(3).Row(row => AddTotalRow(row, "Sin Cargo", Model.TotalSinCargo.ToString("N0"), false));
|
||||
finalCol.Item().BorderTop(1).BorderColor(Colors.Grey.Lighten2).PaddingTop(1).Row(row => AddTotalRow(row, "Sobrantes", $"-{Model.TotalSobrantes.ToString("N0")}", false));
|
||||
// << CAMBIO: Reducido el padding superior de 5 a 3 >>
|
||||
finalCol.Item().BorderTop(1).BorderColor(Colors.Grey.Lighten2).BorderBottom(1).BorderColor(Colors.Grey.Lighten2).PaddingTop(3).Row(row => AddTotalRow(row, "Diferencia", Model.DiferenciaFinal.ToString("N0"), true));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -678,13 +678,18 @@ namespace GestionIntegral.Api.Controllers
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status403Forbidden)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> GetReporteDistribucionCanillasData([FromQuery] DateTime fecha, [FromQuery] int idEmpresa)
|
||||
public async Task<IActionResult> GetReporteDistribucionCanillasData(
|
||||
[FromQuery] DateTime fecha,
|
||||
[FromQuery] int idEmpresa,
|
||||
[FromQuery] bool? esAccionista
|
||||
)
|
||||
{
|
||||
if (!TienePermiso(PermisoVerComprobanteLiquidacionCanilla)) return Forbid();
|
||||
|
||||
// Pasar el nuevo parámetro al servicio
|
||||
var (canillas, canillasAcc, canillasAll, canillasFechaLiq, canillasAccFechaLiq,
|
||||
ctrlDevolucionesRemitos, ctrlDevolucionesParaDistCan, ctrlDevolucionesOtrosDias, error) =
|
||||
await _reportesService.ObtenerReporteDistribucionCanillasAsync(fecha, idEmpresa);
|
||||
await _reportesService.ObtenerReporteDistribucionCanillasAsync(fecha, idEmpresa, esAccionista);
|
||||
|
||||
if (error != null) return BadRequest(new { message = error });
|
||||
|
||||
@@ -719,14 +724,20 @@ namespace GestionIntegral.Api.Controllers
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status403Forbidden)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> GetReporteDistribucionCanillasPdf([FromQuery] DateTime fecha, [FromQuery] int idEmpresa, [FromQuery] bool soloTotales = false)
|
||||
public async Task<IActionResult> GetReporteDistribucionCanillasPdf(
|
||||
[FromQuery] DateTime fecha,
|
||||
[FromQuery] int idEmpresa,
|
||||
[FromQuery] bool? esAccionista,
|
||||
[FromQuery] bool soloTotales = false
|
||||
)
|
||||
{
|
||||
if (!TienePermiso(PermisoVerComprobanteLiquidacionCanilla)) return Forbid();
|
||||
|
||||
// Pasar el nuevo parámetro al servicio
|
||||
var (
|
||||
canillas, canillasAcc, canillasAll, canillasFechaLiq, canillasAccFechaLiq,
|
||||
remitos, ctrlDevoluciones, _, error
|
||||
) = await _reportesService.ObtenerReporteDistribucionCanillasAsync(fecha, idEmpresa);
|
||||
) = await _reportesService.ObtenerReporteDistribucionCanillasAsync(fecha, idEmpresa, esAccionista);
|
||||
|
||||
if (error != null) return BadRequest(new { message = error });
|
||||
|
||||
@@ -795,11 +806,11 @@ namespace GestionIntegral.Api.Controllers
|
||||
_, // canillasAll
|
||||
_, // canillasFechaLiq
|
||||
_, // canillasAccFechaLiq
|
||||
ctrlDevolucionesRemitosData, // Para SP_ObtenerCtrlDevoluciones -> DataSet "DSObtenerCtrlDevoluciones"
|
||||
ctrlDevolucionesParaDistCanData, // Para SP_DistCanillasCantidadEntradaSalida -> DataSet "DSCtrlDevoluciones"
|
||||
ctrlDevolucionesOtrosDiasData, // Para SP_DistCanillasCantidadEntradaSalidaOtrosDias -> DataSet "DSCtrlDevolucionesOtrosDias"
|
||||
ctrlDevolucionesRemitosData,
|
||||
ctrlDevolucionesParaDistCanData,
|
||||
ctrlDevolucionesOtrosDiasData,
|
||||
error
|
||||
) = await _reportesService.ObtenerReporteDistribucionCanillasAsync(fecha, idEmpresa); // Reutilizamos este método
|
||||
) = await _reportesService.ObtenerReporteDistribucionCanillasAsync(fecha, idEmpresa, null);
|
||||
|
||||
if (error != null) return BadRequest(new { message = error });
|
||||
|
||||
@@ -833,7 +844,7 @@ namespace GestionIntegral.Api.Controllers
|
||||
var (
|
||||
_, _, _, _, _, // Datos no utilizados
|
||||
remitos, detalles, otrosDias, error
|
||||
) = await _reportesService.ObtenerReporteDistribucionCanillasAsync(fecha, idEmpresa);
|
||||
) = await _reportesService.ObtenerReporteDistribucionCanillasAsync(fecha, idEmpresa, null);
|
||||
|
||||
if (error != null) return BadRequest(new { message = error });
|
||||
|
||||
|
||||
@@ -48,5 +48,7 @@ namespace GestionIntegral.Api.Data.Repositories.Reportes
|
||||
Task<IEnumerable<FacturasParaReporteDto>> GetDatosReportePublicidadAsync(string periodo);
|
||||
Task<IEnumerable<DistribucionSuscripcionDto>> GetDistribucionSuscripcionesActivasAsync(DateTime fechaDesde, DateTime fechaHasta);
|
||||
Task<IEnumerable<DistribucionSuscripcionDto>> GetDistribucionSuscripcionesBajasAsync(DateTime fechaDesde, DateTime fechaHasta);
|
||||
Task<IEnumerable<DetalleDistribucionCanillaDto>> GetDetalleDistribucionCanillasPubli_AllEmpresasAsync(DateTime fecha);
|
||||
Task<IEnumerable<DetalleDistribucionCanillaDto>> GetDetalleDistribucionCanillasAccPubli_AllEmpresasAsync(DateTime fecha);
|
||||
}
|
||||
}
|
||||
@@ -653,5 +653,39 @@ namespace GestionIntegral.Api.Data.Repositories.Reportes
|
||||
return Enumerable.Empty<DistribucionSuscripcionDto>();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<DetalleDistribucionCanillaDto>> GetDetalleDistribucionCanillasPubli_AllEmpresasAsync(DateTime fecha)
|
||||
{
|
||||
const string spName = "dbo.SP_DistCanillasEntradaSalidaPubli_AllEmpresas";
|
||||
var parameters = new DynamicParameters();
|
||||
parameters.Add("@fecha", fecha, DbType.DateTime);
|
||||
try
|
||||
{
|
||||
using var connection = _dbConnectionFactory.CreateConnection();
|
||||
return await connection.QueryAsync<DetalleDistribucionCanillaDto>(spName, parameters, commandType: CommandType.StoredProcedure, commandTimeout: 120);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error SP {SPName}", spName);
|
||||
return Enumerable.Empty<DetalleDistribucionCanillaDto>();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<DetalleDistribucionCanillaDto>> GetDetalleDistribucionCanillasAccPubli_AllEmpresasAsync(DateTime fecha)
|
||||
{
|
||||
const string spName = "dbo.SP_DistCanillasAccEntradaSalidaPubli_AllEmpresas";
|
||||
var parameters = new DynamicParameters();
|
||||
parameters.Add("@fecha", fecha, DbType.DateTime);
|
||||
try
|
||||
{
|
||||
using var connection = _dbConnectionFactory.CreateConnection();
|
||||
return await connection.QueryAsync<DetalleDistribucionCanillaDto>(spName, parameters, commandType: CommandType.StoredProcedure, commandTimeout: 120);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error SP {SPName}", spName);
|
||||
return Enumerable.Empty<DetalleDistribucionCanillaDto>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>4923d7ee-0944-456c-abcd-d6ce13ba8485</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -27,16 +27,16 @@ namespace GestionIntegral.Api.Services.Reportes
|
||||
|
||||
// Reporte Distribucion Canillas (MC005) - Este es un reporte más complejo
|
||||
Task<(
|
||||
IEnumerable<DetalleDistribucionCanillaDto> Canillas,
|
||||
IEnumerable<DetalleDistribucionCanillaDto> CanillasAcc,
|
||||
IEnumerable<DetalleDistribucionCanillaAllDto> CanillasAll,
|
||||
IEnumerable<DetalleDistribucionCanillaDto> CanillasFechaLiq,
|
||||
IEnumerable<DetalleDistribucionCanillaDto> CanillasAccFechaLiq,
|
||||
IEnumerable<ObtenerCtrlDevolucionesDto> CtrlDevolucionesRemitos, // Para SP_ObtenerCtrlDevoluciones
|
||||
IEnumerable<ControlDevolucionesReporteDto> CtrlDevolucionesParaDistCan, // Para SP_DistCanillasCantidadEntradaSalida
|
||||
IEnumerable<DevueltosOtrosDiasDto> CtrlDevolucionesOtrosDias, // <--- NUEVO para SP_DistCanillasCantidadEntradaSalidaOtrosDias
|
||||
string? Error
|
||||
)> ObtenerReporteDistribucionCanillasAsync(DateTime fecha, int idEmpresa);
|
||||
IEnumerable<DetalleDistribucionCanillaDto> Canillas,
|
||||
IEnumerable<DetalleDistribucionCanillaDto> CanillasAcc,
|
||||
IEnumerable<DetalleDistribucionCanillaAllDto> CanillasAll,
|
||||
IEnumerable<DetalleDistribucionCanillaDto> CanillasFechaLiq,
|
||||
IEnumerable<DetalleDistribucionCanillaDto> CanillasAccFechaLiq,
|
||||
IEnumerable<ObtenerCtrlDevolucionesDto> CtrlDevolucionesRemitos,
|
||||
IEnumerable<ControlDevolucionesReporteDto> CtrlDevolucionesParaDistCan,
|
||||
IEnumerable<DevueltosOtrosDiasDto> CtrlDevolucionesOtrosDias,
|
||||
string? Error
|
||||
)> ObtenerReporteDistribucionCanillasAsync(DateTime fecha, int idEmpresa, bool? esAccionista);
|
||||
|
||||
// Reporte Tiradas por Publicación y Secciones (RR008)
|
||||
Task<(IEnumerable<TiradasPublicacionesSeccionesDto> Data, string? Error)> ObtenerTiradasPublicacionesSeccionesAsync(int idPublicacion, DateTime fechaDesde, DateTime fechaHasta, int idPlanta);
|
||||
|
||||
@@ -218,30 +218,66 @@ namespace GestionIntegral.Api.Services.Reportes
|
||||
}
|
||||
|
||||
public async Task<(
|
||||
IEnumerable<DetalleDistribucionCanillaDto> Canillas,
|
||||
IEnumerable<DetalleDistribucionCanillaDto> CanillasAcc,
|
||||
IEnumerable<DetalleDistribucionCanillaAllDto> CanillasAll,
|
||||
IEnumerable<DetalleDistribucionCanillaDto> CanillasFechaLiq,
|
||||
IEnumerable<DetalleDistribucionCanillaDto> CanillasAccFechaLiq,
|
||||
IEnumerable<ObtenerCtrlDevolucionesDto> CtrlDevolucionesRemitos,
|
||||
IEnumerable<ControlDevolucionesReporteDto> CtrlDevolucionesParaDistCan,
|
||||
IEnumerable<DevueltosOtrosDiasDto> CtrlDevolucionesOtrosDias,
|
||||
string? Error
|
||||
)> ObtenerReporteDistribucionCanillasAsync(DateTime fecha, int idEmpresa)
|
||||
IEnumerable<DetalleDistribucionCanillaDto> Canillas,
|
||||
IEnumerable<DetalleDistribucionCanillaDto> CanillasAcc,
|
||||
IEnumerable<DetalleDistribucionCanillaAllDto> CanillasAll,
|
||||
IEnumerable<DetalleDistribucionCanillaDto> CanillasFechaLiq,
|
||||
IEnumerable<DetalleDistribucionCanillaDto> CanillasAccFechaLiq,
|
||||
IEnumerable<ObtenerCtrlDevolucionesDto> CtrlDevolucionesRemitos,
|
||||
IEnumerable<ControlDevolucionesReporteDto> CtrlDevolucionesParaDistCan,
|
||||
IEnumerable<DevueltosOtrosDiasDto> CtrlDevolucionesOtrosDias,
|
||||
string? Error
|
||||
)> ObtenerReporteDistribucionCanillasAsync(DateTime fecha, int idEmpresa, bool? esAccionista)
|
||||
{
|
||||
try
|
||||
{
|
||||
var canillasTask = _reportesRepository.GetDetalleDistribucionCanillasPubliAsync(fecha, idEmpresa);
|
||||
var canillasAccTask = _reportesRepository.GetDetalleDistribucionCanillasAccPubliAsync(fecha, idEmpresa);
|
||||
// Función helper para convertir fechas a UTC
|
||||
Func<IEnumerable<DetalleDistribucionCanillaDto>, IEnumerable<DetalleDistribucionCanillaDto>> toUtc =
|
||||
items => items?.Select(c => { if (c.Fecha.HasValue) c.Fecha = DateTime.SpecifyKind(c.Fecha.Value.Date, DateTimeKind.Utc); return c; }).ToList()
|
||||
?? Enumerable.Empty<DetalleDistribucionCanillaDto>();
|
||||
|
||||
// --- NUEVA LÓGICA PARA "TODAS LAS EMPRESAS" ---
|
||||
if (idEmpresa == 0)
|
||||
{
|
||||
Task<IEnumerable<DetalleDistribucionCanillaDto>> canillasTask = Task.FromResult(Enumerable.Empty<DetalleDistribucionCanillaDto>());
|
||||
Task<IEnumerable<DetalleDistribucionCanillaDto>> canillasAccTask = Task.FromResult(Enumerable.Empty<DetalleDistribucionCanillaDto>());
|
||||
|
||||
if (esAccionista == true) // Solo accionistas
|
||||
{
|
||||
canillasAccTask = _reportesRepository.GetDetalleDistribucionCanillasAccPubli_AllEmpresasAsync(fecha);
|
||||
}
|
||||
else // Solo canillitas (o si es null, por defecto canillitas)
|
||||
{
|
||||
canillasTask = _reportesRepository.GetDetalleDistribucionCanillasPubli_AllEmpresasAsync(fecha);
|
||||
}
|
||||
|
||||
await Task.WhenAll(canillasTask, canillasAccTask);
|
||||
|
||||
return (
|
||||
toUtc(await canillasTask),
|
||||
toUtc(await canillasAccTask),
|
||||
Enumerable.Empty<DetalleDistribucionCanillaAllDto>(), // El resumen no aplica
|
||||
Enumerable.Empty<DetalleDistribucionCanillaDto>(), // Liquidaciones de otras fechas no aplican en esta vista simplificada
|
||||
Enumerable.Empty<DetalleDistribucionCanillaDto>(),
|
||||
Enumerable.Empty<ObtenerCtrlDevolucionesDto>(), // Control de devoluciones no aplica
|
||||
Enumerable.Empty<ControlDevolucionesReporteDto>(),
|
||||
Enumerable.Empty<DevueltosOtrosDiasDto>(),
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
// --- LÓGICA ORIGINAL PARA UNA EMPRESA ESPECÍFICA ---
|
||||
var canillasTaskOriginal = _reportesRepository.GetDetalleDistribucionCanillasPubliAsync(fecha, idEmpresa);
|
||||
var canillasAccTaskOriginal = _reportesRepository.GetDetalleDistribucionCanillasAccPubliAsync(fecha, idEmpresa);
|
||||
var canillasAllTask = _reportesRepository.GetDetalleDistribucionCanillasAllPubliAsync(fecha, idEmpresa);
|
||||
var canillasFechaLiqTask = _reportesRepository.GetDetalleDistribucionCanillasPubliFechaLiqAsync(fecha, idEmpresa);
|
||||
var canillasAccFechaLiqTask = _reportesRepository.GetDetalleDistribucionCanillasAccPubliFechaLiqAsync(fecha, idEmpresa);
|
||||
var ctrlDevolucionesRemitosTask = _reportesRepository.GetReporteObtenerCtrlDevolucionesAsync(fecha, idEmpresa); // SP_ObtenerCtrlDevoluciones
|
||||
var ctrlDevolucionesParaDistCanTask = _reportesRepository.GetReporteCtrlDevolucionesParaDistCanAsync(fecha, idEmpresa); // SP_DistCanillasCantidadEntradaSalida
|
||||
var ctrlDevolucionesOtrosDiasTask = _reportesRepository.GetEntradaSalidaOtrosDiasAsync(fecha, idEmpresa); // SP_DistCanillasCantidadEntradaSalidaOtrosDias
|
||||
var ctrlDevolucionesRemitosTask = _reportesRepository.GetReporteObtenerCtrlDevolucionesAsync(fecha, idEmpresa);
|
||||
var ctrlDevolucionesParaDistCanTask = _reportesRepository.GetReporteCtrlDevolucionesParaDistCanAsync(fecha, idEmpresa);
|
||||
var ctrlDevolucionesOtrosDiasTask = _reportesRepository.GetEntradaSalidaOtrosDiasAsync(fecha, idEmpresa);
|
||||
|
||||
await Task.WhenAll(
|
||||
canillasTask, canillasAccTask, canillasAllTask,
|
||||
canillasTaskOriginal, canillasAccTaskOriginal, canillasAllTask,
|
||||
canillasFechaLiqTask, canillasAccFechaLiqTask,
|
||||
ctrlDevolucionesRemitosTask, ctrlDevolucionesParaDistCanTask,
|
||||
ctrlDevolucionesOtrosDiasTask
|
||||
@@ -250,13 +286,9 @@ namespace GestionIntegral.Api.Services.Reportes
|
||||
var detallesOriginales = await ctrlDevolucionesParaDistCanTask ?? Enumerable.Empty<ControlDevolucionesReporteDto>();
|
||||
var detallesOrdenados = detallesOriginales.OrderBy(d => d.Tipo).ToList();
|
||||
|
||||
Func<IEnumerable<DetalleDistribucionCanillaDto>, IEnumerable<DetalleDistribucionCanillaDto>> toUtc =
|
||||
items => items?.Select(c => { if (c.Fecha.HasValue) c.Fecha = DateTime.SpecifyKind(c.Fecha.Value.Date, DateTimeKind.Utc); return c; }).ToList()
|
||||
?? Enumerable.Empty<DetalleDistribucionCanillaDto>();
|
||||
|
||||
return (
|
||||
toUtc(await canillasTask),
|
||||
toUtc(await canillasAccTask),
|
||||
toUtc(await canillasTaskOriginal),
|
||||
toUtc(await canillasAccTaskOriginal),
|
||||
await canillasAllTask ?? Enumerable.Empty<DetalleDistribucionCanillaAllDto>(),
|
||||
toUtc(await canillasFechaLiqTask),
|
||||
toUtc(await canillasAccFechaLiqTask),
|
||||
|
||||
Reference in New Issue
Block a user