Mostrar alertas en inicio

This commit is contained in:
2023-10-19 18:20:37 -03:00
parent c2a3192b32
commit 02e1f3e091
25 changed files with 915 additions and 225 deletions

View File

@ -69,15 +69,12 @@ class Pago
public function getById(int $pago_id): Model\Venta\Pago
{
$pago = $this->pagoRepository->fetchById($pago_id);
$pago->estados = $this->estadoPagoRepository->fetchByPago($pago_id);
$pago->currentEstado = $this->estadoPagoRepository->fetchCurrentByPago($pago_id);
if (($pago->uf === null or $pago->uf === 0.0) and $pago->fecha < new DateTimeImmutable()) {
$pago->uf = $this->moneyService->getUF($pago->fecha);
if ($pago->uf !== 0.0) {
$this->pagoRepository->edit($pago, ['uf' => $pago->uf]);
}
}
return $pago;
return $this->process($pago);
}
public function getByVenta(int $venta_id): array
{
return array_map([$this, 'process'], $this->pagoRepository->fetchByVenta($venta_id));
}
public function getPendientes(): array
@ -121,4 +118,17 @@ class Pago
$pago->currentEstado = $estado;
return $pago;
}
protected function process($pago): Model\Venta\Pago
{
$pago->estados = $this->estadoPagoRepository->fetchByPago($pago->id);
$pago->currentEstado = $this->estadoPagoRepository->fetchCurrentByPago($pago->id);
if (($pago->uf === null or $pago->uf === 0.0) and $pago->fecha < new DateTimeImmutable()) {
$pago->uf = $this->moneyService->getUF($pago->fecha);
if ($pago->uf !== 0.0) {
$this->pagoRepository->edit($pago, ['uf' => $pago->uf]);
}
}
return $pago;
}
}