Cambios en formato
This commit is contained in:
@ -30,19 +30,19 @@ class Factura extends Ideal\Model
|
||||
|
||||
public function total(): int
|
||||
{
|
||||
return round($this->venta->valor * $this->uf->valor * $this->proporcion);
|
||||
return $this->venta->valor * $this->uf->valor * $this->proporcion;
|
||||
}
|
||||
public function bruto(): int
|
||||
{
|
||||
return round($this->total() - $this->terreno * $this->proporcion);
|
||||
return $this->total() - $this->terreno * $this->proporcion;
|
||||
}
|
||||
public function iva(): int
|
||||
{
|
||||
return round($this->bruto() / 1.19 * .19);
|
||||
return $this->neto() * .19;
|
||||
}
|
||||
public function neto(): int
|
||||
{
|
||||
return round($this->bruto() / 1.19);
|
||||
return $this->bruto() / 1.19;
|
||||
}
|
||||
public function base(): int
|
||||
{
|
||||
@ -83,7 +83,7 @@ class Factura extends Ideal\Model
|
||||
'emisor' => [
|
||||
'rut' => $this->venta->proyecto()->inmobiliaria()->rut(),
|
||||
'nombre' => $this->venta->proyecto()->inmobiliaria()->nombreCompleto(),
|
||||
'direccion' => $this->venta->proyecto()->direccion(),
|
||||
'direccion' => $this->venta->proyecto()->direccion()->simple(),
|
||||
'comuna' => $this->venta->proyecto()->direccion()->comuna->descripcion
|
||||
],
|
||||
'receptor' => [
|
||||
@ -96,9 +96,12 @@ class Factura extends Ideal\Model
|
||||
'unidades' => $this->unidades,
|
||||
'detalle' => $this->detalle(),
|
||||
'total' => $this->totales(),
|
||||
'uf' => $this->uf,
|
||||
'ipc' => $this->ipc,
|
||||
'uf' => [
|
||||
'fecha' => $this->uf->fecha->format('Y-m-d'),
|
||||
'valor' => $this->uf->valor
|
||||
],
|
||||
'estados' => $this->estados()
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,7 +40,11 @@ class Factura extends Ideal\Repository
|
||||
try {
|
||||
$result = $this->getDatos($factura->venta->id);
|
||||
$factura->fecha = new DateTimeImmutable($result['fecha']);
|
||||
$factura->unidades = array_map(function($datos) {
|
||||
$factura->uf = json_decode($result['uf']);
|
||||
$factura->uf->fecha = new DateTimeImmutable($factura->uf->fecha);
|
||||
$factura->ipc = json_decode($result['ipc']);
|
||||
$factura->ipc->fecha = new DateTimeImmutable($factura->ipc->fecha);
|
||||
$factura->unidades = array_map(function($datos) use ($factura) {
|
||||
$unidad = $this->unidadRepository->fetchById($datos->unidad_id);
|
||||
return (object) [
|
||||
'unidad' => $unidad,
|
||||
@ -50,8 +54,6 @@ class Factura extends Ideal\Repository
|
||||
];
|
||||
}, json_decode($result['unidades']));
|
||||
$factura->terreno = $result['terreno'];
|
||||
$factura->uf = json_decode($result['uf']);
|
||||
$factura->ipc = json_decode($result['ipc']);
|
||||
} catch (EmptyResult) {}
|
||||
|
||||
return $factura;
|
||||
|
Reference in New Issue
Block a user