FIX: Pie cuotas valores uf

This commit is contained in:
2024-01-08 13:16:12 -03:00
parent 675b3843ea
commit bc2333bc95
4 changed files with 25 additions and 16 deletions

View File

@ -136,14 +136,23 @@ class Pago
{
$pago->estados = $this->estadoPagoRepository->fetchByPago($pago->id);
$pago->currentEstado = $this->estadoPagoRepository->fetchCurrentByPago($pago->id);
$pago->uf = $this->getUF($pago);
return $pago;
}
protected function getUF(Model\Venta\Pago $pago): ?float
{
if (($pago->uf === null or $pago->uf === 0.0)
and $pago->currentEstado->tipoEstadoPago->descripcion === 'abonado'
and $pago->currentEstado->fecha <= new DateTimeImmutable()) {
$pago->uf = $this->moneyService->getUF($pago->currentEstado->fecha);
if ($pago->uf !== 0.0) {
$this->pagoRepository->edit($pago, ['uf' => $pago->uf]);
$uf = $this->moneyService->getUF($pago->currentEstado->fecha);
if ($uf !== 0.0) {
$this->pagoRepository->edit($pago, ['uf' => $uf]);
return $uf;
}
} elseif ($pago->uf === 0.0) {
$this->pagoRepository->edit($pago, ['uf' => null]);
return null;
}
return $pago;
return $pago->uf;
}
}