| | | 1 | | using FAU.Entidades; |
| | | 2 | | using FAU.Logica.DTOs; |
| | | 3 | | using FAU.Logica.Exceptions; |
| | | 4 | | using FAU.Logica.Services; |
| | | 5 | | using Microsoft.AspNetCore.Authorization; |
| | | 6 | | using Microsoft.AspNetCore.Mvc; |
| | | 7 | | |
| | | 8 | | namespace FAU.API.Controllers; |
| | | 9 | | |
| | | 10 | | [ApiController] |
| | | 11 | | [Route("api/liquidacion/[controller]")] |
| | | 12 | | [Authorize] |
| | | 13 | | [Produces("application/json")] |
| | | 14 | | public class PeriodosController : ControllerBase |
| | | 15 | | { |
| | | 16 | | private readonly IPeriodoService _periodoService; |
| | | 17 | | private readonly ILiquidacionService _liquidacionService; |
| | | 18 | | private readonly ILogger<PeriodosController> _logger; |
| | | 19 | | |
| | 19 | 20 | | public PeriodosController( |
| | 19 | 21 | | IPeriodoService periodoService, |
| | 19 | 22 | | ILiquidacionService liquidacionService, |
| | 19 | 23 | | ILogger<PeriodosController> logger) |
| | | 24 | | { |
| | 19 | 25 | | _periodoService = periodoService; |
| | 19 | 26 | | _liquidacionService = liquidacionService; |
| | 19 | 27 | | _logger = logger; |
| | 19 | 28 | | } |
| | | 29 | | |
| | | 30 | | [HttpPost] |
| | | 31 | | [Authorize(Roles = "Administrador,Supervisor,Usuario")] |
| | | 32 | | [ProducesResponseType(typeof(ApiResponse<PeriodoDto>), StatusCodes.Status201Created)] |
| | | 33 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status400BadRequest)] |
| | | 34 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status409Conflict)] |
| | | 35 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status500InternalServerError)] |
| | | 36 | | public async Task<IActionResult> AbrirPeriodo([FromBody] AbrirPeriodoRequest request) |
| | | 37 | | { |
| | | 38 | | try |
| | | 39 | | { |
| | 3 | 40 | | if (!ModelState.IsValid) |
| | | 41 | | { |
| | 0 | 42 | | return BadRequest(ApiResponse<string>.ErrorResult("Solicitud de apertura de período inválida")); |
| | | 43 | | } |
| | | 44 | | |
| | 3 | 45 | | var (success, periodo, error) = await _periodoService.AbrirPeriodoAsync(request.Anio, request.Mes); |
| | | 46 | | |
| | 3 | 47 | | if (!success) |
| | | 48 | | { |
| | 2 | 49 | | if (error?.Contains("Ya existe un período activo", StringComparison.OrdinalIgnoreCase) == true) |
| | | 50 | | { |
| | 1 | 51 | | return Conflict(ApiResponse<string>.ErrorResult(error)); |
| | | 52 | | } |
| | | 53 | | |
| | 1 | 54 | | return BadRequest(ApiResponse<string>.ErrorResult(error ?? "Error al abrir el período")); |
| | | 55 | | } |
| | | 56 | | |
| | 1 | 57 | | var periodoFinal = await _periodoService.ObtenerPorIdAsync(periodo!.Id); |
| | 1 | 58 | | return CreatedAtAction(nameof(GetPeriodo), new { id = periodo.Id }, ApiResponse<PeriodoDto>.SuccessResult(Ma |
| | | 59 | | } |
| | 0 | 60 | | catch (Exception ex) |
| | | 61 | | { |
| | 0 | 62 | | _logger.LogError(ex, "Error al abrir período"); |
| | 0 | 63 | | return StatusCode(500, ApiResponse<string>.ErrorResult("Error interno del servidor")); |
| | | 64 | | } |
| | 3 | 65 | | } |
| | | 66 | | |
| | | 67 | | [HttpGet] |
| | | 68 | | [Authorize(Roles = "Administrador,Supervisor,Usuario")] |
| | | 69 | | [ProducesResponseType(typeof(ApiResponse<List<PeriodoDto>>), StatusCodes.Status200OK)] |
| | | 70 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status500InternalServerError)] |
| | | 71 | | public async Task<IActionResult> GetUltimos([FromQuery] int cantidad = 6) |
| | | 72 | | { |
| | | 73 | | try |
| | | 74 | | { |
| | 0 | 75 | | var periodos = await _periodoService.ObtenerUltimosAsync(Math.Min(cantidad, 12)); |
| | 0 | 76 | | return Ok(ApiResponse<List<PeriodoDto>>.SuccessResult(periodos.Select(MapearPeriodo).ToList())); |
| | | 77 | | } |
| | 0 | 78 | | catch (Exception ex) |
| | | 79 | | { |
| | 0 | 80 | | _logger.LogError(ex, "Error al obtener últimos períodos"); |
| | 0 | 81 | | return StatusCode(500, ApiResponse<string>.ErrorResult("Error interno del servidor")); |
| | | 82 | | } |
| | 0 | 83 | | } |
| | | 84 | | |
| | | 85 | | [HttpGet("activo")] |
| | | 86 | | [Authorize(Roles = "Administrador,Supervisor,Usuario")] |
| | | 87 | | [ProducesResponseType(typeof(ApiResponse<PeriodoDto>), StatusCodes.Status200OK)] |
| | | 88 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status404NotFound)] |
| | | 89 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status500InternalServerError)] |
| | | 90 | | public async Task<IActionResult> GetPeriodoActivo() |
| | | 91 | | { |
| | | 92 | | try |
| | | 93 | | { |
| | 2 | 94 | | var periodo = await _periodoService.ObtenerEnCursoAsync(); |
| | 2 | 95 | | if (periodo == null) |
| | | 96 | | { |
| | 1 | 97 | | return NotFound(ApiResponse<string>.ErrorResult("No hay un período activo")); |
| | | 98 | | } |
| | | 99 | | |
| | 1 | 100 | | return Ok(ApiResponse<PeriodoDto>.SuccessResult(MapearPeriodo(periodo))); |
| | | 101 | | } |
| | 0 | 102 | | catch (Exception ex) |
| | | 103 | | { |
| | 0 | 104 | | _logger.LogError(ex, "Error al obtener período activo"); |
| | 0 | 105 | | return StatusCode(500, ApiResponse<string>.ErrorResult("Error interno del servidor")); |
| | | 106 | | } |
| | 2 | 107 | | } |
| | | 108 | | |
| | | 109 | | [HttpGet("{id}")] |
| | | 110 | | [Authorize(Roles = "Administrador,Supervisor,Usuario")] |
| | | 111 | | [ProducesResponseType(typeof(ApiResponse<PeriodoDto>), StatusCodes.Status200OK)] |
| | | 112 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status404NotFound)] |
| | | 113 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status500InternalServerError)] |
| | | 114 | | public async Task<IActionResult> GetPeriodo(long id) |
| | | 115 | | { |
| | | 116 | | try |
| | | 117 | | { |
| | 2 | 118 | | var periodo = await _periodoService.ObtenerPorIdAsync(id); |
| | 2 | 119 | | if (periodo == null) |
| | | 120 | | { |
| | 1 | 121 | | return NotFound(ApiResponse<string>.ErrorResult("Período no encontrado")); |
| | | 122 | | } |
| | | 123 | | |
| | 1 | 124 | | return Ok(ApiResponse<PeriodoDto>.SuccessResult(MapearPeriodo(periodo))); |
| | | 125 | | } |
| | 0 | 126 | | catch (Exception ex) |
| | | 127 | | { |
| | 0 | 128 | | _logger.LogError(ex, "Error al obtener período {Id}", id); |
| | 0 | 129 | | return StatusCode(500, ApiResponse<string>.ErrorResult("Error interno del servidor")); |
| | | 130 | | } |
| | 2 | 131 | | } |
| | | 132 | | |
| | | 133 | | [HttpGet("{id}/precondiciones")] |
| | | 134 | | [Authorize(Roles = "Administrador,Supervisor,Usuario")] |
| | | 135 | | [ProducesResponseType(typeof(ApiResponse<PrecondicionesDto>), StatusCodes.Status200OK)] |
| | | 136 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status404NotFound)] |
| | | 137 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status500InternalServerError)] |
| | | 138 | | public async Task<IActionResult> GetPrecondiciones(long id) |
| | | 139 | | { |
| | | 140 | | try |
| | | 141 | | { |
| | 0 | 142 | | var precondiciones = await _periodoService.ObtenerPrecondicionesAsync(id); |
| | 0 | 143 | | if (precondiciones == null) |
| | 0 | 144 | | return NotFound(ApiResponse<string>.ErrorResult("Período no encontrado")); |
| | 0 | 145 | | return Ok(ApiResponse<PrecondicionesDto>.SuccessResult(precondiciones)); |
| | | 146 | | } |
| | 0 | 147 | | catch (Exception ex) |
| | | 148 | | { |
| | 0 | 149 | | _logger.LogError(ex, "Error al obtener precondiciones del período {Id}", id); |
| | 0 | 150 | | return StatusCode(500, ApiResponse<string>.ErrorResult("Error interno del servidor")); |
| | | 151 | | } |
| | 0 | 152 | | } |
| | | 153 | | |
| | | 154 | | [HttpGet("{id}/validar-insumos")] |
| | | 155 | | [Authorize(Roles = "Administrador,Supervisor,Usuario")] |
| | | 156 | | [ProducesResponseType(typeof(ApiResponse<ValidacionInsumosDto>), StatusCodes.Status200OK)] |
| | | 157 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status404NotFound)] |
| | | 158 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status500InternalServerError)] |
| | | 159 | | public async Task<IActionResult> ValidarInsumos(long id) |
| | | 160 | | { |
| | | 161 | | try |
| | | 162 | | { |
| | 0 | 163 | | var validacion = await _periodoService.ValidarInsumosAsync(id); |
| | 0 | 164 | | if (validacion == null) |
| | 0 | 165 | | return NotFound(ApiResponse<string>.ErrorResult("Período no encontrado")); |
| | 0 | 166 | | return Ok(ApiResponse<ValidacionInsumosDto>.SuccessResult(validacion)); |
| | | 167 | | } |
| | 0 | 168 | | catch (Exception ex) |
| | | 169 | | { |
| | 0 | 170 | | _logger.LogError(ex, "Error al validar insumos del período {Id}", id); |
| | 0 | 171 | | return StatusCode(500, ApiResponse<string>.ErrorResult("Error interno del servidor")); |
| | | 172 | | } |
| | 0 | 173 | | } |
| | | 174 | | |
| | | 175 | | [HttpPost("{id}/cerrar-insumos")] |
| | | 176 | | [Authorize(Roles = "Administrador,Supervisor,Usuario")] |
| | | 177 | | [ProducesResponseType(typeof(ApiResponse<PeriodoDto>), StatusCodes.Status200OK)] |
| | | 178 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status404NotFound)] |
| | | 179 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status409Conflict)] |
| | | 180 | | [ProducesResponseType(typeof(ValidacionInsumosDto), StatusCodes.Status422UnprocessableEntity)] |
| | | 181 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status500InternalServerError)] |
| | | 182 | | public async Task<IActionResult> CerrarInsumos(long id, [FromBody] CerrarInsumosRequest? request = null) |
| | | 183 | | { |
| | | 184 | | try |
| | | 185 | | { |
| | 4 | 186 | | var (success, periodo, validacion, error) = |
| | 4 | 187 | | await _periodoService.CerrarInsumosAsync(id, request?.Confirmaciones); |
| | | 188 | | |
| | 4 | 189 | | if (!success) |
| | | 190 | | { |
| | 3 | 191 | | if (error?.Contains("no encontrado", StringComparison.OrdinalIgnoreCase) == true) |
| | 1 | 192 | | return NotFound(ApiResponse<string>.ErrorResult(error)); |
| | 2 | 193 | | if (error?.Contains("Solo se puede", StringComparison.OrdinalIgnoreCase) == true) |
| | 1 | 194 | | return Conflict(ApiResponse<string>.ErrorResult(error)); |
| | 1 | 195 | | if (validacion != null) |
| | 1 | 196 | | return UnprocessableEntity(validacion); |
| | 0 | 197 | | return UnprocessableEntity(ApiResponse<string>.ErrorResult(error ?? "Error al cerrar insumos")); |
| | | 198 | | } |
| | | 199 | | |
| | 1 | 200 | | var periodoFinal = await _periodoService.ObtenerPorIdAsync(id); |
| | 1 | 201 | | return Ok(ApiResponse<PeriodoDto>.SuccessResult(MapearPeriodo(periodoFinal!), "Insumos cerrados. Período lis |
| | | 202 | | } |
| | 0 | 203 | | catch (Exception ex) |
| | | 204 | | { |
| | 0 | 205 | | _logger.LogError(ex, "Error al cerrar insumos del período {Id}", id); |
| | 0 | 206 | | return StatusCode(500, ApiResponse<string>.ErrorResult("Error interno del servidor")); |
| | | 207 | | } |
| | 4 | 208 | | } |
| | | 209 | | |
| | | 210 | | [HttpPost("{id}/reabrir-insumos")] |
| | | 211 | | [Authorize(Roles = "Administrador,Supervisor")] |
| | | 212 | | [ProducesResponseType(typeof(ApiResponse<PeriodoDto>), StatusCodes.Status200OK)] |
| | | 213 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status404NotFound)] |
| | | 214 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status409Conflict)] |
| | | 215 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status500InternalServerError)] |
| | | 216 | | public async Task<IActionResult> ReabrirInsumos(long id) |
| | | 217 | | { |
| | | 218 | | try |
| | | 219 | | { |
| | 2 | 220 | | var (success, periodo, error) = await _periodoService.ReabrirInsumosAsync(id); |
| | | 221 | | |
| | 2 | 222 | | if (!success) |
| | | 223 | | { |
| | 1 | 224 | | if (error?.Contains("no encontrado", StringComparison.OrdinalIgnoreCase) == true) |
| | 0 | 225 | | return NotFound(ApiResponse<string>.ErrorResult(error)); |
| | 1 | 226 | | return Conflict(ApiResponse<string>.ErrorResult(error ?? "Error al reabrir insumos")); |
| | | 227 | | } |
| | | 228 | | |
| | 1 | 229 | | var periodoFinal = await _periodoService.ObtenerPorIdAsync(id); |
| | 1 | 230 | | return Ok(ApiResponse<PeriodoDto>.SuccessResult(MapearPeriodo(periodoFinal!), "Insumos reabiertos. Período e |
| | | 231 | | } |
| | 0 | 232 | | catch (Exception ex) |
| | | 233 | | { |
| | 0 | 234 | | _logger.LogError(ex, "Error al reabrir insumos del período {Id}", id); |
| | 0 | 235 | | return StatusCode(500, ApiResponse<string>.ErrorResult("Error interno del servidor")); |
| | | 236 | | } |
| | 2 | 237 | | } |
| | | 238 | | |
| | | 239 | | [HttpPost("{id}/reabrir")] |
| | | 240 | | [Authorize(Roles = "Administrador,Supervisor")] |
| | | 241 | | [ProducesResponseType(typeof(ApiResponse<PeriodoDto>), StatusCodes.Status200OK)] |
| | | 242 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status404NotFound)] |
| | | 243 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status409Conflict)] |
| | | 244 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status500InternalServerError)] |
| | | 245 | | public async Task<IActionResult> ReabrirDesdeCalculada(long id) |
| | | 246 | | { |
| | | 247 | | try |
| | | 248 | | { |
| | 0 | 249 | | var (success, periodo, error) = await _periodoService.ReabrirDesdeCalculadaAsync(id); |
| | | 250 | | |
| | 0 | 251 | | if (!success) |
| | | 252 | | { |
| | 0 | 253 | | if (error?.Contains("no encontrado", StringComparison.OrdinalIgnoreCase) == true) |
| | 0 | 254 | | return NotFound(ApiResponse<string>.ErrorResult(error)); |
| | 0 | 255 | | return Conflict(ApiResponse<string>.ErrorResult(error ?? "Error al reabrir período")); |
| | | 256 | | } |
| | | 257 | | |
| | 0 | 258 | | var periodoFinal = await _periodoService.ObtenerPorIdAsync(id); |
| | 0 | 259 | | return Ok(ApiResponse<PeriodoDto>.SuccessResult( |
| | 0 | 260 | | MapearPeriodo(periodoFinal!), |
| | 0 | 261 | | "Período reabierto. Realizá las correcciones y volvé a calcular. El próximo cálculo generará una nueva v |
| | | 262 | | } |
| | 0 | 263 | | catch (Exception ex) |
| | | 264 | | { |
| | 0 | 265 | | _logger.LogError(ex, "Error al reabrir período {Id}", id); |
| | 0 | 266 | | return StatusCode(500, ApiResponse<string>.ErrorResult("Error interno del servidor")); |
| | | 267 | | } |
| | 0 | 268 | | } |
| | | 269 | | |
| | | 270 | | [HttpPost("{id}/calcular")] |
| | | 271 | | [Authorize(Roles = "Administrador,Supervisor,Usuario")] |
| | | 272 | | [ProducesResponseType(typeof(ApiResponse<PeriodoDto>), StatusCodes.Status200OK)] |
| | | 273 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status404NotFound)] |
| | | 274 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status409Conflict)] |
| | | 275 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status500InternalServerError)] |
| | | 276 | | public async Task<IActionResult> Calcular(long id) |
| | | 277 | | { |
| | | 278 | | try |
| | | 279 | | { |
| | | 280 | | // 1. Marcar período como EN_CALCULO |
| | 3 | 281 | | var (success, periodo, error) = await _periodoService.IniciarCalculoAsync(id); |
| | 3 | 282 | | if (!success) |
| | | 283 | | { |
| | 2 | 284 | | if (error?.Contains("no encontrado", StringComparison.OrdinalIgnoreCase) == true) |
| | 1 | 285 | | return NotFound(ApiResponse<string>.ErrorResult(error)); |
| | 1 | 286 | | return Conflict(ApiResponse<string>.ErrorResult(error ?? "Error al iniciar cálculo")); |
| | | 287 | | } |
| | | 288 | | |
| | | 289 | | // 2. Ejecutar el cálculo — la versión se determina automáticamente (max+1) |
| | 1 | 290 | | var (exitoCalculo, errorCalculo, version) = await _liquidacionService.GenerarLiquidacionAsync(id); |
| | | 291 | | |
| | | 292 | | // 3. Finalizar — éxito o error vuelve a LISTA_CALCULO para reintentar |
| | 1 | 293 | | await _periodoService.FinalizarCalculoAsync(id, exitoCalculo); |
| | | 294 | | |
| | 1 | 295 | | if (!exitoCalculo) |
| | 0 | 296 | | return StatusCode(500, ApiResponse<string>.ErrorResult(errorCalculo ?? "Error durante el cálculo")); |
| | | 297 | | |
| | 1 | 298 | | var periodoFinal = await _periodoService.ObtenerPorIdAsync(id); |
| | 1 | 299 | | return Ok(ApiResponse<PeriodoDto>.SuccessResult( |
| | 1 | 300 | | MapearPeriodo(periodoFinal!), |
| | 1 | 301 | | $"Liquidación versión {version} generada correctamente.")); |
| | | 302 | | } |
| | 0 | 303 | | catch (Exception ex) |
| | | 304 | | { |
| | 0 | 305 | | await _periodoService.FinalizarCalculoAsync(id, exitoso: false).ConfigureAwait(false); |
| | 0 | 306 | | _logger.LogError(ex, "Error al calcular período {Id}", id); |
| | 0 | 307 | | return StatusCode(500, ApiResponse<string>.ErrorResult("Error interno del servidor")); |
| | | 308 | | } |
| | 3 | 309 | | } |
| | | 310 | | |
| | | 311 | | [HttpPost("{id}/cerrar")] |
| | | 312 | | [Authorize(Roles = "Administrador,Supervisor")] |
| | | 313 | | [ProducesResponseType(typeof(ApiResponse<PeriodoDto>), StatusCodes.Status200OK)] |
| | | 314 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status404NotFound)] |
| | | 315 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status409Conflict)] |
| | | 316 | | [ProducesResponseType(typeof(ApiResponse<string>), StatusCodes.Status500InternalServerError)] |
| | | 317 | | public async Task<IActionResult> Cerrar(long id) |
| | | 318 | | { |
| | | 319 | | try |
| | | 320 | | { |
| | 3 | 321 | | var (success, periodo, error) = await _periodoService.CerrarAsync(id); |
| | | 322 | | |
| | 3 | 323 | | if (!success) |
| | | 324 | | { |
| | 2 | 325 | | if (error?.Contains("no encontrado", StringComparison.OrdinalIgnoreCase) == true) |
| | 1 | 326 | | return NotFound(ApiResponse<string>.ErrorResult(error)); |
| | 1 | 327 | | return Conflict(ApiResponse<string>.ErrorResult(error ?? "Error al cerrar período")); |
| | | 328 | | } |
| | | 329 | | |
| | 1 | 330 | | var periodoFinal = await _periodoService.ObtenerPorIdAsync(id); |
| | 1 | 331 | | return Ok(ApiResponse<PeriodoDto>.SuccessResult(MapearPeriodo(periodoFinal!), "Período cerrado definitivamen |
| | | 332 | | } |
| | 0 | 333 | | catch (Exception ex) |
| | | 334 | | { |
| | 0 | 335 | | _logger.LogError(ex, "Error al cerrar período {Id}", id); |
| | 0 | 336 | | return StatusCode(500, ApiResponse<string>.ErrorResult("Error interno del servidor")); |
| | | 337 | | } |
| | 3 | 338 | | } |
| | | 339 | | |
| | | 340 | | private static PeriodoDto MapearPeriodo(Periodo periodo) |
| | | 341 | | { |
| | 7 | 342 | | return new PeriodoDto |
| | 7 | 343 | | { |
| | 7 | 344 | | Id = periodo.Id, |
| | 7 | 345 | | Anio = periodo.Anio, |
| | 7 | 346 | | Mes = periodo.Mes, |
| | 7 | 347 | | Estado = periodo.Estado, |
| | 7 | 348 | | SnapshotId = periodo.SnapshotId, |
| | 7 | 349 | | FechaApertura = periodo.FechaApertura, |
| | 7 | 350 | | UsuarioApertura = periodo.UsuarioAperturaUsername, |
| | 7 | 351 | | HashSnapshot = periodo.HashSnapshot, |
| | 7 | 352 | | FechaCierreInsumos = periodo.FechaCierreInsumos, |
| | 7 | 353 | | UsuarioCierreInsumos = periodo.UsuarioCierreInsumos?.Username, |
| | 7 | 354 | | FechaCalculo = periodo.FechaCalculo, |
| | 7 | 355 | | UsuarioCalculo = periodo.UsuarioCalculo?.Username, |
| | 7 | 356 | | FechaCierre = periodo.FechaCierre, |
| | 7 | 357 | | UsuarioCierre = periodo.UsuarioCierre?.Username |
| | 7 | 358 | | }; |
| | | 359 | | } |
| | | 360 | | } |