2024-06-18
This commit is contained in:
@ -4,8 +4,8 @@ namespace Incoviba\Model\Contabilidad;
|
||||
use DateTimeInterface;
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Common\Implement\Exception\EmptyResult;
|
||||
use Incoviba\Model\Contabilidad\Movimiento\Detalle;
|
||||
use Incoviba\Model\Inmobiliaria;
|
||||
use Incoviba\Model\Movimiento\Detalle;
|
||||
|
||||
class Movimiento extends Ideal\Model
|
||||
{
|
||||
@ -21,15 +21,20 @@ class Movimiento extends Ideal\Model
|
||||
public function getDetalles(): ?Detalle
|
||||
{
|
||||
if (!isset($this->detalles)) {
|
||||
try {
|
||||
$this->detalles = $this->runFactory('detalles');
|
||||
} catch (EmptyResult) {
|
||||
$this->detalles = null;
|
||||
}
|
||||
$this->detalles = $this->runFactory('detalles');
|
||||
}
|
||||
return $this->detalles;
|
||||
}
|
||||
|
||||
protected ?array $auxiliares;
|
||||
public function getAuxiliares(): ?array
|
||||
{
|
||||
if (!isset($this->auxiliares)) {
|
||||
$this->auxiliares = $this->runFactory('auxiliares');
|
||||
}
|
||||
return $this->auxiliares;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return array_merge(parent::jsonSerialize(), [
|
||||
@ -40,7 +45,8 @@ class Movimiento extends Ideal\Model
|
||||
'cargo' => $this->cargo,
|
||||
'abono' => $this->abono,
|
||||
'saldo' => $this->saldo,
|
||||
'detalles' => $this->getDetalles() ?? null
|
||||
'detalles' => $this->getDetalles(),
|
||||
'auxiliares' => $this->getAuxiliares()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
36
app/src/Model/Contabilidad/Movimiento/Auxiliar.php
Normal file
36
app/src/Model/Contabilidad/Movimiento/Auxiliar.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?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()
|
||||
]);
|
||||
}
|
||||
}
|
39
app/src/Model/Contabilidad/Movimiento/Auxiliar/Detalle.php
Normal file
39
app/src/Model/Contabilidad/Movimiento/Auxiliar/Detalle.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?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(),
|
||||
];
|
||||
}
|
||||
}
|
39
app/src/Model/Contabilidad/Movimiento/Detalle.php
Normal file
39
app/src/Model/Contabilidad/Movimiento/Detalle.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
namespace Incoviba\Model\Contabilidad\Movimiento;
|
||||
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Model;
|
||||
|
||||
class Detalle extends Ideal\Model
|
||||
{
|
||||
public Model\Contabilidad\Movimiento $movimiento;
|
||||
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 [
|
||||
'movimiento_id' => $this->movimiento->id,
|
||||
'centro_costo' => $this->centroCosto,
|
||||
'rut' => $this->rut,
|
||||
'digito' => $this->digito,
|
||||
'nombre' => $this->nombre,
|
||||
'categoria' => $this->categoria,
|
||||
'detalle' => $this->detalle,
|
||||
'rutFormatted' => $this->rutFormatted()
|
||||
];
|
||||
}
|
||||
}
|
32
app/src/Model/DatosPersona.php
Normal file
32
app/src/Model/DatosPersona.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace Incoviba\Model;
|
||||
|
||||
use DateTimeInterface;
|
||||
use Incoviba\Common\Ideal;
|
||||
|
||||
class DatosPersona extends Ideal\Model
|
||||
{
|
||||
public Persona $persona;
|
||||
public ?Direccion $direccion;
|
||||
public ?int $telefono;
|
||||
public ?string $email;
|
||||
public ?DateTimeInterface $fechaNacimiento;
|
||||
public ?string $sexo;
|
||||
public ?string $estadoCivil;
|
||||
public ?string $nacionalidad;
|
||||
public ?string $profesion;
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return [
|
||||
'direccion' => $this->direccion,
|
||||
'telefono' => $this->telefono,
|
||||
'email' => $this->email,
|
||||
'fechaNacimiento' => $this->fechaNacimiento,
|
||||
'sexo' => $this->sexo,
|
||||
'estadoCivil' => $this->estadoCivil,
|
||||
'nacionalidad' => $this->nacionalidad,
|
||||
'profesion' => $this->profesion,
|
||||
];
|
||||
}
|
||||
}
|
29
app/src/Model/Inmobiliaria/Proveedor.php
Normal file
29
app/src/Model/Inmobiliaria/Proveedor.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace Incoviba\Model\Inmobiliaria;
|
||||
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Model;
|
||||
|
||||
class Proveedor extends Ideal\Model
|
||||
{
|
||||
public Model\Inmobiliaria $inmobiliaria;
|
||||
public Model\Sociedad $sociedad;
|
||||
|
||||
protected array $tipos;
|
||||
public function tipos(): array
|
||||
{
|
||||
if (!isset($this->tipos)) {
|
||||
$this->tipos = $this->runFactory('tipos');
|
||||
}
|
||||
return $this->tipos;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return array_merge(parent::jsonSerialize(), [
|
||||
'inmobiliaria' => $this->inmobiliaria,
|
||||
'sociedad' => $this->sociedad,
|
||||
'tipos' => $this->tipos(),
|
||||
]);
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
<?php
|
||||
namespace Incoviba\Model\Movimiento;
|
||||
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Model;
|
||||
|
||||
class Detalle extends Ideal\Model
|
||||
{
|
||||
public Model\Contabilidad\Movimiento $movimiento;
|
||||
public ?Model\Contabilidad\CentroCosto $centroCosto;
|
||||
public ?string $detalle;
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return [
|
||||
'movimiento_id' => $this->movimiento->id,
|
||||
'centro_costo' => $this->centroCosto,
|
||||
'detalle' => $this->detalle
|
||||
];
|
||||
}
|
||||
}
|
46
app/src/Model/Persona.php
Normal file
46
app/src/Model/Persona.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace Incoviba\Model;
|
||||
|
||||
use Incoviba\Common\Ideal;
|
||||
|
||||
class Persona extends Ideal\Model
|
||||
{
|
||||
public int $rut;
|
||||
public string $digito;
|
||||
public string $nombres;
|
||||
public string $apellidoPaterno;
|
||||
public string $apellidoMaterno;
|
||||
|
||||
public function nombreCompleto(): string
|
||||
{
|
||||
return $this->nombres . ' ' . $this->apellidoPaterno . ' ' . $this->apellidoMaterno;
|
||||
}
|
||||
|
||||
public function rutCompleto(): string
|
||||
{
|
||||
return number_format($this->rut, 0, ',', '.') . '-' . $this->digito;
|
||||
}
|
||||
|
||||
protected ?DatosPersona $datos;
|
||||
public function datos(): ?DatosPersona
|
||||
{
|
||||
if (!isset($this->datos)) {
|
||||
$this->datos = $this->runFactory('datos');
|
||||
}
|
||||
return $this->datos;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return [
|
||||
'rut' => $this->rut,
|
||||
'digito' => $this->digito,
|
||||
'nombres' => $this->nombres,
|
||||
'apellidoPaterno' => $this->apellidoPaterno,
|
||||
'apellidoMaterno' => $this->apellidoMaterno,
|
||||
'nombreCompleto' => $this->nombreCompleto(),
|
||||
'rutCompleto' => $this->rutCompleto(),
|
||||
'datos' => $this->datos(),
|
||||
];
|
||||
}
|
||||
}
|
33
app/src/Model/Sociedad.php
Normal file
33
app/src/Model/Sociedad.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace Incoviba\Model;
|
||||
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Model\Inmobiliaria\TipoSociedad;
|
||||
|
||||
class Sociedad extends Ideal\Model
|
||||
{
|
||||
public int $rut;
|
||||
public string $digito;
|
||||
public string $nombre;
|
||||
public string $razonSocial;
|
||||
public TipoSociedad $tipoSociedad;
|
||||
public Persona $contacto;
|
||||
|
||||
public function nombreCompleto(): string
|
||||
{
|
||||
return implode(' ', [$this->razonSocial, $this->tipoSociedad->descripcion]);
|
||||
}
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return [
|
||||
'rut' => $this->rut,
|
||||
'digito' => $this->digito,
|
||||
'nombre' => $this->nombre,
|
||||
'razonSocial' => $this->razonSocial,
|
||||
'tipoSociedad' => $this->tipoSociedad,
|
||||
'contacto' => $this->contacto,
|
||||
'nombreCompleto' => $this->nombreCompleto(),
|
||||
];
|
||||
}
|
||||
}
|
86
app/src/Model/Venta/Factura.php
Normal file
86
app/src/Model/Venta/Factura.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
namespace Incoviba\Model\Venta;
|
||||
|
||||
use DateTimeInterface;
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Model;
|
||||
|
||||
class Factura extends Ideal\Model
|
||||
{
|
||||
public Model\Venta $venta;
|
||||
public int $index;
|
||||
public float $proporcion;
|
||||
public string $emisorRut;
|
||||
public string $emisorNombre;
|
||||
public string $emisorDireccion;
|
||||
public string $receptorRut;
|
||||
public string $receptorNombre;
|
||||
public string $receptorDireccion;
|
||||
public string $receptorComuna;
|
||||
public DateTimeInterface $fecha;
|
||||
public array $unidades;
|
||||
public int $detalleBase;
|
||||
public int $detalleTerreno;
|
||||
public int $detalleNeto;
|
||||
public int $detalleIva;
|
||||
public int $detalleBruto;
|
||||
public float $detalleDescuento;
|
||||
public int $detalleTotal;
|
||||
public int $totalNeto;
|
||||
public int $totalExento;
|
||||
public int $totalIva;
|
||||
public int $totalTotal;
|
||||
public DateTimeInterface $fechaUF;
|
||||
public float $valorUF;
|
||||
|
||||
protected array $estados;
|
||||
public function estados(): array
|
||||
{
|
||||
if (!isset($this->estados)) {
|
||||
$this->estados = $this->runFactory('estados');
|
||||
}
|
||||
return $this->estados ?? [];
|
||||
}
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return array_merge(parent::jsonSerialize(), [
|
||||
'venta_id' => $this->venta->id,
|
||||
'index' => $this->index,
|
||||
'proporcion' => $this->proporcion,
|
||||
'emisor' => [
|
||||
'rut' => $this->emisorRut,
|
||||
'nombre' => $this->emisorNombre,
|
||||
'direccion' => $this->emisorDireccion
|
||||
],
|
||||
'receptor' => [
|
||||
'rut' => $this->receptorRut,
|
||||
'nombre' => $this->receptorNombre,
|
||||
'direccion' => $this->receptorDireccion,
|
||||
'comuna' => $this->receptorComuna
|
||||
],
|
||||
'fecha' => $this->fecha->format('Y-m-d'),
|
||||
'unidades' => $this->unidades,
|
||||
'detalle' => [
|
||||
'base' => $this->detalleBase,
|
||||
'terreno' => $this->detalleTerreno,
|
||||
'neto' => $this->detalleNeto,
|
||||
'iva' => $this->detalleIva,
|
||||
'bruto' => $this->detalleBruto,
|
||||
'descuento' => $this->detalleDescuento,
|
||||
'total' => $this->detalleTotal
|
||||
],
|
||||
'total' => [
|
||||
'neto' => $this->totalNeto,
|
||||
'exento' => $this->totalExento,
|
||||
'iva' => $this->totalIva,
|
||||
'total' => $this->totalTotal
|
||||
],
|
||||
'uf' => [
|
||||
'fecha' => $this->fechaUF->format('Y-m-d'),
|
||||
'valor' => $this->valorUF
|
||||
],
|
||||
'estados' => $this->estados()
|
||||
]);
|
||||
}
|
||||
}
|
22
app/src/Model/Venta/Factura/Estado.php
Normal file
22
app/src/Model/Venta/Factura/Estado.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace Incoviba\Model\Venta\Factura;
|
||||
|
||||
use DateTimeInterface;
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Model;
|
||||
|
||||
class Estado extends Ideal\Model
|
||||
{
|
||||
public Model\Venta\Factura $factura;
|
||||
public DateTimeInterface $fecha;
|
||||
public Model\Venta\Factura\Estado\Tipo $tipo;
|
||||
|
||||
public function jsonSerialize(): mixed
|
||||
{
|
||||
return array_merge(parent::jsonSerialize(), [
|
||||
'factura_id' => $this->factura->id,
|
||||
'fecha' => $this->fecha->format('Y-m-d'),
|
||||
'tipo' => $this->tipo
|
||||
]);
|
||||
}
|
||||
}
|
7
app/src/Model/Venta/Factura/Estado/Tipo.php
Normal file
7
app/src/Model/Venta/Factura/Estado/Tipo.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
namespace Incoviba\Model\Venta\Factura\Estado;
|
||||
|
||||
use Incoviba\Model\Tipo as Base;
|
||||
|
||||
class Tipo extends Base
|
||||
{}
|
Reference in New Issue
Block a user