Escriturar

This commit is contained in:
2023-12-20 08:44:49 -03:00
parent 1ba53c9e12
commit 379a33a4da
11 changed files with 430 additions and 16 deletions

View File

@ -4,6 +4,7 @@ namespace Incoviba\Model;
use DateTimeInterface;
use Incoviba\Common\Ideal;
use Incoviba\Controller\Ventas;
use Incoviba\Model\Venta\Pago;
class Venta extends Ideal\Model
{
@ -84,9 +85,10 @@ class Venta extends Ideal\Model
}
return $this->valor_util;
}
public function saldo(): float
public function saldo(string $moneda = Pago::UF): float
{
return $this->valor - $this->formaPago->total();
$valor = $this->valor * (($moneda === Pago::UF) ? 1 : $this->uf);
return $valor - $this->formaPago()->total($moneda);
}
public function jsonSerialize(): mixed