From 062cc05fd00a484e43f8b4ff022e53ac49670a78 Mon Sep 17 00:00:00 2001 From: eldiadmolinari Date: Tue, 3 Jun 2025 13:45:20 -0300 Subject: [PATCH] =?UTF-8?q?Finalizaci=C3=B3n=20de=20Reportes=20y=20arreglo?= =?UTF-8?q?s=20varios=20de=20controles=20y=20comportamientos...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EntradasSalidasCanillaController.cs | 7 +- .../Distribucion/PublicacionesController.cs | 60 + .../RDLC/ReporteLiquidacionCanillas.rdlc | 1316 +++++++++++++++++ .../RDLC/ReporteLiquidacionCanillasAcc.rdlc | 992 +++++++++++++ .../Reportes/ReportesController.cs | 73 + .../EntradaSalidaCanillaRepository.cs | 10 +- .../Distribucion/IPublicacionRepository.cs | 3 + .../Distribucion/PublicacionRepository.cs | 70 +- .../Reportes/IReportesRepository.cs | 2 + .../Reportes/ReportesRepository.cs | 36 + .../Distribucion/PublicacionDiaSemana.cs | 10 + .../CreateBulkEntradaSalidaCanillaDto.cs | 42 +- .../EntradaSalidaCanillaItemDto.cs | 25 +- .../Distribucion/PublicacionDiaSemanaDto.cs | 10 + .../UpdateEntradaSalidaCanillaDto.cs | 27 +- .../UpdatePublicacionDiasSemanaRequestDto.cs | 10 + .../Reportes/LiquidacionCanillaDetalleDto.cs | 9 + .../Reportes/LiquidacionCanillaGananciaDto.cs | 5 + .../EntradaSalidaCanillaService.cs | 17 +- .../Distribucion/IPublicacionService.cs | 3 + .../Distribucion/PublicacionService.cs | 66 + .../Services/Reportes/IReportesService.cs | 6 + .../Services/Reportes/ReportesService.cs | 41 + .../appsettings.Development.json | 2 +- .../Debug/net9.0/appsettings.Development.json | 2 +- .../GestionIntegral.Api.AssemblyInfo.cs | 2 +- .../Debug/net9.0/rjsmcshtml.dswa.cache.json | 2 +- .../Debug/net9.0/rjsmrazor.dswa.cache.json | 2 +- .../obj/Debug/net9.0/rpswa.dswa.cache.json | 2 +- .../ControlDevolucionesFormModal.tsx | 4 +- .../EntradaSalidaCanillaFormModal.tsx | 421 ++++-- .../PublicacionDiasSemanaModal.tsx | 141 ++ Frontend/src/contexts/AuthContext.tsx | 3 + Frontend/src/layouts/MainLayout.tsx | 155 +- .../Distribucion/PublicacionDiaSemanaDto.ts | 6 + .../UpdatePublicacionDiasSemanaRequestDto.ts | 3 + .../Reportes/LiquidacionCanillaDetalleDto.ts | 8 + .../Reportes/LiquidacionCanillaGananciaDto.ts | 4 + .../pages/Contables/ContablesIndexPage.tsx | 52 +- .../pages/Contables/GestionarNotasCDPage.tsx | 4 +- .../GestionarPagosDistribuidorPage.tsx | 4 +- .../Contables/GestionarTiposPagoPage.tsx | 22 +- .../Distribucion/GestionarCanillitasPage.tsx | 9 +- .../GestionarControlDevolucionesPage.tsx | 166 ++- .../GestionarDistribuidoresPage.tsx | 12 +- .../Distribucion/GestionarEmpresasPage.tsx | 222 +-- .../GestionarEntradasSalidasCanillaPage.tsx | 312 +++- .../GestionarEntradasSalidasDistPage.tsx | 31 +- .../GestionarOtrosDestinosPage.tsx | 186 +-- .../GestionarPublicacionesPage.tsx | 126 +- .../GestionarSalidasOtrosDestinosPage.tsx | 181 ++- .../pages/Distribucion/GestionarZonasPage.tsx | 20 +- .../Impresion/GestionarEstadosBobinaPage.tsx | 26 +- .../pages/Impresion/GestionarPlantasPage.tsx | 26 +- .../Impresion/GestionarStockBobinasPage.tsx | 8 +- .../Impresion/GestionarTiposBobinaPage.tsx | 26 +- .../pages/Impresion/GestionarTiradasPage.tsx | 10 +- .../pages/Radios/GenerarListasRadioPage.tsx | 4 +- .../pages/Radios/GestionarCancionesPage.tsx | 4 +- .../src/pages/Radios/GestionarRitmosPage.tsx | 4 +- .../Usuarios/AsignarPermisosAPerfilPage.tsx | 7 +- .../GestionarAuditoriaUsuariosPage.tsx | 11 +- .../pages/Usuarios/GestionarPerfilesPage.tsx | 208 +-- .../pages/Usuarios/GestionarPermisosPage.tsx | 182 +-- .../pages/Usuarios/GestionarUsuariosPage.tsx | 17 +- .../Distribucion/publicacionService.ts | 19 + .../src/services/Reportes/reportesService.ts | 20 + 67 files changed, 4523 insertions(+), 993 deletions(-) create mode 100644 Backend/GestionIntegral.Api/Controllers/Reportes/RDLC/ReporteLiquidacionCanillas.rdlc create mode 100644 Backend/GestionIntegral.Api/Controllers/Reportes/RDLC/ReporteLiquidacionCanillasAcc.rdlc create mode 100644 Backend/GestionIntegral.Api/Models/Distribucion/PublicacionDiaSemana.cs create mode 100644 Backend/GestionIntegral.Api/Models/Dtos/Distribucion/PublicacionDiaSemanaDto.cs create mode 100644 Backend/GestionIntegral.Api/Models/Dtos/Distribucion/UpdatePublicacionDiasSemanaRequestDto.cs create mode 100644 Backend/GestionIntegral.Api/Models/Dtos/Reportes/LiquidacionCanillaDetalleDto.cs create mode 100644 Backend/GestionIntegral.Api/Models/Dtos/Reportes/LiquidacionCanillaGananciaDto.cs create mode 100644 Frontend/src/components/Modals/Distribucion/PublicacionDiasSemanaModal.tsx create mode 100644 Frontend/src/models/dtos/Distribucion/PublicacionDiaSemanaDto.ts create mode 100644 Frontend/src/models/dtos/Distribucion/UpdatePublicacionDiasSemanaRequestDto.ts create mode 100644 Frontend/src/models/dtos/Reportes/LiquidacionCanillaDetalleDto.ts create mode 100644 Frontend/src/models/dtos/Reportes/LiquidacionCanillaGananciaDto.ts diff --git a/Backend/GestionIntegral.Api/Controllers/Distribucion/EntradasSalidasCanillaController.cs b/Backend/GestionIntegral.Api/Controllers/Distribucion/EntradasSalidasCanillaController.cs index e3d40c7..f614e1b 100644 --- a/Backend/GestionIntegral.Api/Controllers/Distribucion/EntradasSalidasCanillaController.cs +++ b/Backend/GestionIntegral.Api/Controllers/Distribucion/EntradasSalidasCanillaController.cs @@ -83,7 +83,10 @@ namespace GestionIntegral.Api.Controllers.Distribucion public async Task UpdateMovimiento(int idParte, [FromBody] UpdateEntradaSalidaCanillaDto updateDto) { if (!TienePermiso(PermisoModificarMovimiento)) return Forbid(); - if (!ModelState.IsValid) return BadRequest(ModelState); + + // Esta línea es la que dispara la validación del modelo 'updateDto' + if (!ModelState.IsValid) return BadRequest(ModelState); + var userId = GetCurrentUserId(); if (userId == null) return Unauthorized(); @@ -91,7 +94,7 @@ namespace GestionIntegral.Api.Controllers.Distribucion if (!exito) { if (error == "Movimiento no encontrado." || error == "No se puede modificar un movimiento ya liquidado.") - return NotFound(new { message = error }); // Podría ser 404 o 400 dependiendo del error + return NotFound(new { message = error }); return BadRequest(new { message = error }); } return NoContent(); diff --git a/Backend/GestionIntegral.Api/Controllers/Distribucion/PublicacionesController.cs b/Backend/GestionIntegral.Api/Controllers/Distribucion/PublicacionesController.cs index 6195731..a44e593 100644 --- a/Backend/GestionIntegral.Api/Controllers/Distribucion/PublicacionesController.cs +++ b/Backend/GestionIntegral.Api/Controllers/Distribucion/PublicacionesController.cs @@ -117,5 +117,65 @@ namespace GestionIntegral.Api.Controllers.Distribucion } return NoContent(); } + + // Endpoint para obtener las configuraciones de días para una publicación + [HttpGet("{idPublicacion:int}/dias-semana")] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status403Forbidden)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public async Task GetConfiguracionDiasPublicacion(int idPublicacion) + { + // Podrías usar el mismo permiso de ver publicaciones o uno específico + if (!TienePermiso(PermisoVer)) return Forbid(); + + var publicacion = await _publicacionService.ObtenerPorIdAsync(idPublicacion); + if (publicacion == null) return NotFound(new { message = "Publicación no encontrada." }); + + var configs = await _publicacionService.ObtenerConfiguracionDiasAsync(idPublicacion); + return Ok(configs); + } + + // Endpoint para actualizar las configuraciones de días para una publicación + [HttpPut("{idPublicacion:int}/dias-semana")] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status403Forbidden)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public async Task UpdateConfiguracionDiasPublicacion(int idPublicacion, [FromBody] UpdatePublicacionDiasSemanaRequestDto requestDto) + { + // Podrías usar el mismo permiso de modificar publicaciones o uno específico + if (!TienePermiso(PermisoModificar)) return Forbid(); + if (!ModelState.IsValid) return BadRequest(ModelState); + + var userId = GetCurrentUserId(); + if (userId == null) return Unauthorized(); + + var (exito, error) = await _publicacionService.ActualizarConfiguracionDiasAsync(idPublicacion, requestDto, userId.Value); + if (!exito) + { + if (error == "Publicación no encontrada.") return NotFound(new { message = error }); + return BadRequest(new { message = error }); + } + return NoContent(); + } + + // Endpoint para obtener publicaciones por día de la semana (para el modal de canillitas) + [HttpGet("por-dia-semana")] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status403Forbidden)] + public async Task GetPublicacionesPorDia([FromQuery] byte dia) // dia: 0=Domingo, 1=Lunes... + { + // Generalmente, este endpoint no necesitaría un permiso estricto si solo devuelve datos públicos + // pero puedes añadirlo si es necesario. + // if (!TienePermiso(PermisoVer)) return Forbid(); + + if (dia > 6) // byte no puede ser negativo + { + return BadRequest(new { message = "El día de la semana debe estar entre 0 (Domingo) y 6 (Sábado)." }); + } + var publicaciones = await _publicacionService.ObtenerPublicacionesPorDiaSemanaAsync(dia); + return Ok(publicaciones); + } } } \ No newline at end of file diff --git a/Backend/GestionIntegral.Api/Controllers/Reportes/RDLC/ReporteLiquidacionCanillas.rdlc b/Backend/GestionIntegral.Api/Controllers/Reportes/RDLC/ReporteLiquidacionCanillas.rdlc new file mode 100644 index 0000000..6c0fbdb --- /dev/null +++ b/Backend/GestionIntegral.Api/Controllers/Reportes/RDLC/ReporteLiquidacionCanillas.rdlc @@ -0,0 +1,1316 @@ + + + 0 + + + + System.Data.DataSet + /* Local Connection */ + + ee328c50-edc3-4726-92dc-19ec72ac5a56 + + + + + + DSLiquidacionCanillas + /* Local Query */ + + + + Publicacion + System.String + + + Canilla + System.String + + + TotalCantSalida + System.Int32 + + + TotalCantEntrada + System.Int32 + + + TotalRendir + System.Decimal + + + PrecioEjemplar + System.Decimal + + + + DSLiquidacionCanillas + C:\Users\dmolinari\source\repos\Cobol-VBNet\Distribucion\Tickets\DSLiquidacionCanillas.xsd + SP_DistCanillasLiquidacion + Fill + GetData + SP_DistCanillasLiquidacionTableAdapter + + + + + DSLiquidacionCanillas + /* Local Query */ + + + + Publicacion + System.String + + + TotalRendir + System.Decimal + + + + DSLiquidacionCanillas + C:\Users\dmolinari\source\repos\Cobol-VBNet\Distribucion\Tickets\DSLiquidacionCanillas.xsd + SP_DistCanillasLiquidacionGanancias + Fill + GetData + SP_DistCanillasLiquidacionGananciasTableAdapter + + + + + + + + + + + + 3.53124cm + + + 3.10854cm + + + 3.55834cm + + + + + 0.5cm + + + + + true + true + + + + + ="Vendedor: " & First(Fields!Canilla.Value, "DSLiquidacionCanillas") + + + + + + 2pt + 2pt + 2pt + 2pt + + + 3 + + + + + + + + 0.5cm + + + + + true + true + + + + + =Fields!Publicacion.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Retirados + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!TotalCantSalida.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.5cm + + + + + true + true + + + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Devueltos + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!TotalCantEntrada.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.5cm + + + + + true + true + + + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Vendidos + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!TotalCantSalida.Value-Fields!TotalCantEntrada.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.5cm + + + + + true + true + + + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Precio Unitario + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!PrecioEjemplar.Value + + + + + + 2pt + 2pt + 2pt + 2pt + es-AR + + + + + + + + 0.5cm + + + + + true + true + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Importe Vendido + + + + + + + Black + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!TotalRendir.Value + + + + + + + Black + 2pt + + 2pt + 2pt + 2pt + 2pt + es-AR + + + + + + + + 0.5cm + + + + + true + true + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Total A Rendir + + + + + + + Black + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Sum(Fields!TotalRendir.Value, "DSLiquidacionCanillas") + + + + + + + Black + 2pt + + 2pt + 2pt + 2pt + 2pt + es-AR + + + + + + + + + + + + + + + + + + + After + + + + + =Fields!Publicacion.Value + + + + + =Fields!Publicacion.Value + + + + + + + + + + + + Before + + + + DSLiquidacionCanillas + 1.07592cm + 2.09225cm + 3.5cm + 10.19812cm + + + 8pt + + + + true + true + + + + + EL DIA S.A.I.C. y F. + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Liquidación venta de diarios del: + + + + + + + Textbox39 + 0.53236cm + 2.09225cm + 0.5cm + 4.43198cm + 2 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!FechaLiqui.Value + + + + + + + Textbox41 + 0.53236cm + 6.44662cm + 0.5cm + 3.86292cm + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + 3.53124cm + + + 3.10854cm + + + 3.55834cm + + + + + 0.5cm + + + + + true + true + + + + + Comisiones Acreditadas + + + + + + 2pt + 2pt + 2pt + 2pt + + + 3 + + + + + + + + 0.5cm + + + + + true + true + + + + + =Fields!Publicacion.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + 2 + + + + + + + true + true + + + + + =Fields!TotalRendir.Value + + + + + + 2pt + 2pt + 2pt + 2pt + es-AR + + + true + + + + + + 0.5cm + + + + + true + true + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Total Comisiones + + + + + + + Black + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Sum(Fields!TotalRendir.Value, "DSLiquidacionCanillasGanancias") + + + + + + + Black + 2pt + + 2pt + 2pt + 2pt + 2pt + es-AR + + + + + + + + + + + + + + + + + + + After + + + + + =Fields!Publicacion.Value + + + + + =Fields!Publicacion.Value + + + + + + + + Before + + + + DSLiquidacionCanillasGanancias + 4.65706cm + 2.09225cm + 1.5cm + 10.19812cm + 4 + + + 8pt + + + + 6.30708cm + + + + + + 2pt + 2pt + 2pt + 2pt + + + 3 + + + + + + + + 0.5cm + + + + + true + true + + + + + =Fields!Publicacion.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Retirados + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!TotalCantSalida.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.5cm + + + + + true + true + + + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Devueltos + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!TotalCantEntrada.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.5cm + + + + + true + true + + + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Vendidos + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!TotalCantSalida.Value-Fields!TotalCantEntrada.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.5cm + + + + + true + true + + + + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Precio Unitario + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!PrecioEjemplar.Value + + + + + + 2pt + 2pt + 2pt + 2pt + es-AR + + + + + + + + 0.5cm + + + + + true + true + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Importe Vendido + + + + + + + Black + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!TotalRendir.Value + + + + + + + Black + 2pt + + 2pt + 2pt + 2pt + 2pt + es-AR + + + + + + + + 0.5cm + + + + + true + true + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Total A Rendir + + + + + + + Black + 2pt + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Sum(Fields!TotalRendir.Value, "DSLiquidacionCanillas") + + + + + + + Black + 2pt + + 2pt + 2pt + 2pt + 2pt + es-AR + + + + + + + + + + + + + + + + + + + After + + + + + =Fields!Publicacion.Value + + + + + =Fields!Publicacion.Value + + + + + + + + + + + + Before + + + + DSLiquidacionCanillas + 1.07592cm + 2.09225cm + 3.5cm + 10.19813cm + + + 8pt + + + + true + true + + + + + EL DIA S.A.I.C. y F. + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Liquidación venta de diarios del: + + + + + + + Textbox39 + 0.53236cm + 2.09225cm + 0.5cm + 4.43198cm + 2 + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!FechaLiqui.Value + + + + + + + Textbox41 + 0.53236cm + 6.44662cm + 0.5cm + 3.86292cm + 3 + + + 2pt + 2pt + 2pt + 2pt + + + + 4.66667cm +