FormaPago Service

This commit is contained in:
Juan Pablo Vial
2024-03-13 14:38:44 -03:00
parent c7dd309185
commit 98953cce42
21 changed files with 261 additions and 71 deletions

View File

@ -4,13 +4,14 @@ namespace Incoviba\Model;
use DateTimeInterface;
use Incoviba\Common\Ideal;
use Incoviba\Controller\Ventas;
use Incoviba\Model\Venta\FormaPago;
use Incoviba\Model\Venta\Pago;
class Venta extends Ideal\Model
{
protected Venta\Propietario $propietario;
protected Venta\Propiedad $propiedad;
protected Venta\FormaPago $formaPago;
protected ?Venta\FormaPago $formaPago;
public DateTimeInterface $fecha;
public DateTimeInterface $fechaIngreso;
public float $valor;
@ -36,7 +37,7 @@ class Venta extends Ideal\Model
}
return $this->propiedad;
}
public function formaPago(): Venta\FormaPago
public function formaPago(): ?Venta\FormaPago
{
if (!isset($this->formaPago)) {
$this->formaPago = $this->runFactory('formaPago');
@ -104,7 +105,7 @@ class Venta extends Ideal\Model
return array_merge(parent::jsonSerialize(), [
'propietario' => $this->propietario(),
'propiedad' => $this->propiedad(),
'forma_pago' => $this->formaPago()->ids(),
'forma_pago' => $this->formaPago()?->ids(),
'fecha' => $this->fecha->format('Y-m-d'),
'fecha_ingreso' => $this->fechaIngreso->format('Y-m-d'),
'valor' => $this->valor,

View File

@ -5,12 +5,12 @@ use JsonSerializable;
class FormaPago implements JsonSerializable
{
public ?Pie $pie;
public ?Escritura $escritura;
public ?BonoPie $bonoPie;
public ?Subsidio $subsidio;
public ?Credito $credito;
public ?Pago $devolucion;
public ?Pie $pie = null;
public ?Escritura $escritura = null;
public ?BonoPie $bonoPie = null;
public ?Subsidio $subsidio = null;
public ?Credito $credito = null;
public ?Pago $devolucion = null;
public function anticipo(string $moneda = Pago::UF): float
{