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 +