38 lines
988 B
PHP
38 lines
988 B
PHP
<?php
|
|
namespace Incoviba\Model\Contabilidad;
|
|
|
|
use DateTimeInterface;
|
|
use Incoviba\Common\Ideal;
|
|
use Incoviba\Model\Inmobiliaria;
|
|
|
|
class Deposito extends Ideal\Model
|
|
{
|
|
public Inmobiliaria\Cuenta $cuenta;
|
|
public int $capital;
|
|
public int $futuro;
|
|
public DateTimeInterface $inicio;
|
|
public DateTimeInterface $termino;
|
|
|
|
public function plazo(): int
|
|
{
|
|
return $this->termino->diff($this->inicio)->days;
|
|
}
|
|
public function tasa(): float
|
|
{
|
|
return ($this->futuro - $this->capital) / $this->capital;
|
|
}
|
|
|
|
public function jsonSerialize(): mixed
|
|
{
|
|
return array_merge(parent::jsonSerialize(), [
|
|
'cuenta_id' => $this->cuenta->id,
|
|
'capital' => $this->capital,
|
|
'futuro' => $this->futuro,
|
|
'inicio' => $this->inicio->format('Y-m-d'),
|
|
'termino' => $this->termino->format('Y-m-d'),
|
|
'plazo' => $this->plazo(),
|
|
'tasa' => $this->tasa()
|
|
]);
|
|
}
|
|
}
|