Proveedores en movimientos
This commit is contained in:
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
namespace Incoviba\Model\Contabilidad\Movimiento;
|
||||
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Common\Implement;
|
||||
use Incoviba\Model;
|
||||
|
||||
class Auxiliar extends Ideal\Model
|
||||
{
|
||||
public Model\Contabilidad\Movimiento $movimiento;
|
||||
public int $cargo;
|
||||
public int $abono;
|
||||
|
||||
protected ?Model\Contabilidad\Movimiento\Auxiliar\Detalle $detalles;
|
||||
public function getDetalles(): ?Model\Contabilidad\Movimiento\Auxiliar\Detalle
|
||||
{
|
||||
if (!isset($this->detalles)) {
|
||||
try {
|
||||
$this->detalles = $this->runFactory('detalles');
|
||||
} catch (Implement\Exception\EmptyResult) {
|
||||
$this->detalles = null;
|
||||
}
|
||||
}
|
||||
return $this->detalles;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return array_merge(parent::jsonSerialize(), [
|
||||
'movimiento_id' => $this->movimiento->id,
|
||||
'cargo' => $this->cargo,
|
||||
'abono' => $this->abono,
|
||||
'detalles' => $this->getDetalles()
|
||||
]);
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
<?php
|
||||
namespace Incoviba\Model\Contabilidad\Movimiento\Auxiliar;
|
||||
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Model;
|
||||
|
||||
class Detalle extends Ideal\Model
|
||||
{
|
||||
public Model\Contabilidad\Movimiento\Auxiliar $auxiliar;
|
||||
public ?Model\Contabilidad\CentroCosto $centroCosto;
|
||||
public ?int $rut;
|
||||
public ?string $digito;
|
||||
public ?string $nombre;
|
||||
public ?string $categoria;
|
||||
public ?string $detalle;
|
||||
|
||||
public function rut(): string
|
||||
{
|
||||
return $this->rut . '-' . $this->digito;
|
||||
}
|
||||
public function rutFormatted(): string
|
||||
{
|
||||
return number_format($this->rut, 0, ',', '.') . '-' . $this->digito;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return [
|
||||
'auxiliar_id' => $this->auxiliar->id,
|
||||
'centro_costo' => $this->centroCosto,
|
||||
'rut' => $this->rut,
|
||||
'digito' => $this->digito,
|
||||
'nombre' => $this->nombre,
|
||||
'categoria' => $this->categoria,
|
||||
'detalle' => $this->detalle,
|
||||
'rutFormatted' => $this->rutFormatted(),
|
||||
];
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Incoviba\Model\Contabilidad\Movimiento;
|
||||
|
||||
use Incoviba\Common\Define;
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Model;
|
||||
|
||||
@ -24,6 +25,9 @@ class Detalle extends Ideal\Model
|
||||
return number_format($this->rut, 0, ',', '.') . '-' . $this->digito;
|
||||
}
|
||||
|
||||
public ?Define\Model $relacionado;
|
||||
public ?string $relacionadoType;
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return [
|
||||
@ -35,7 +39,9 @@ class Detalle extends Ideal\Model
|
||||
'categoria' => $this->categoria,
|
||||
'detalle' => $this->detalle,
|
||||
'identificador' => $this->identificador,
|
||||
'rutFormatted' => $this->rutFormatted()
|
||||
'rutFormatted' => $this->rutFormatted(),
|
||||
'relacionado' => $this->relacionado ?? null,
|
||||
'relacionadoType' => $this->relacionadoType ?? null
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user