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:
@@ -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 });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user