From 9be20ab1cd196c69b75dab8325a95e997c06a759 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Wed, 26 Mar 2025 16:54:53 -0300 Subject: [PATCH] UF 0 o nula actualizadas para Pago y Pie --- app/src/Service/Venta/Pago.php | 8 ++++++-- app/src/Service/Venta/Pie.php | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/Service/Venta/Pago.php b/app/src/Service/Venta/Pago.php index a6a3c8a..2f33edc 100644 --- a/app/src/Service/Venta/Pago.php +++ b/app/src/Service/Venta/Pago.php @@ -217,11 +217,15 @@ class Pago return $uf; } if ($uf !== 0.0) { - $this->pagoRepository->edit($pago, ['uf' => $uf]); + try { + $this->pagoRepository->edit($pago, ['uf' => $uf]); + } catch (EmptyResult) {} return $uf; } } elseif ($pago->uf === 0.0) { - $this->pagoRepository->edit($pago, ['uf' => null]); + try { + $this->pagoRepository->edit($pago, ['uf' => null]); + } catch (EmptyResult) {} return null; } return $pago->uf; diff --git a/app/src/Service/Venta/Pie.php b/app/src/Service/Venta/Pie.php index 0d1382f..954de9b 100644 --- a/app/src/Service/Venta/Pie.php +++ b/app/src/Service/Venta/Pie.php @@ -77,6 +77,12 @@ class Pie if (isset($pie->asociado)) { $pie->asociado = $this->getById($pie->asociado->id); } + if (($pie->uf === null or $pie->uf === 0.0) and $pie->fecha <= new DateTimeImmutable()) { + $pie->uf = $this->ufService->get($pie->fecha); + try { + $this->pieRepository->edit($pie, ['uf' => $pie->uf]); + } catch (EmptyResult) {} + } return $pie; } }