Informe escritura
This commit is contained in:
@ -2,5 +2,6 @@
|
||||
use Incoviba\Controller\Ventas\Escrituras;
|
||||
|
||||
$app->group('/escritura/{venta_id}', function($app) {
|
||||
$app->get('/informe[/]', [Escrituras::class, 'informe']);
|
||||
$app->get('[/]', [Escrituras::class, 'show']);
|
||||
});
|
||||
|
91
app/resources/views/ventas/escrituras/informe.blade.php
Normal file
91
app/resources/views/ventas/escrituras/informe.blade.php
Normal file
@ -0,0 +1,91 @@
|
||||
@extends('layout.base')
|
||||
|
||||
@section('page_content')
|
||||
<div class="ui container">
|
||||
<h1 class="ui header">
|
||||
Escritura -
|
||||
{{$venta->proyecto()->descripcion}} -
|
||||
<a href="{{$urls->base}}/venta/{{$venta->id}}">{{$venta->propiedad()->summary()}}</a>
|
||||
</h1>
|
||||
<div class="ui segment">
|
||||
El departamento {{$venta->propiedad()->departamentos()[0]->descripcion}}:<br />
|
||||
@php
|
||||
$estacionamientos = $venta->propiedad()->estacionamientos();
|
||||
@endphp
|
||||
@if (count($estacionamientos) === 0)
|
||||
no tiene estacionamientos
|
||||
@else
|
||||
tiene
|
||||
{{count($estacionamientos) === 1 ? 'el' : 'los'}}
|
||||
estacionamiento{{count($estacionamientos) === 1 ? '': 's'}}
|
||||
{{implode(', ', array_map(function(Incoviba\Model\Venta\Unidad $unidad) {
|
||||
return $unidad->descripcion;
|
||||
}, $estacionamientos))}}
|
||||
@endif
|
||||
y
|
||||
@php
|
||||
$bodegas = $venta->propiedad()->bodegas();
|
||||
@endphp
|
||||
@if (count($bodegas) === 0)
|
||||
no tiene bodegas
|
||||
@else
|
||||
tiene
|
||||
{{count($bodegas) === 1 ? 'la' : 'las'}}
|
||||
bodega{{count($bodegas) === 1 ? '' : 's'}}
|
||||
{{implode(', ', array_map(function(Incoviba\Model\Venta\Unidad $unidad) {
|
||||
return $unidad->descripcion;
|
||||
}, $bodegas))}}
|
||||
@endif
|
||||
<br />
|
||||
<br />
|
||||
<strong>PRECIO</strong>
|
||||
{{$format->ufs($venta->valor)}}
|
||||
<div class="ui fitted divider"></div>
|
||||
<br />
|
||||
@if (isset($venta->formaPago()->pie))
|
||||
@php($pie = $venta->formaPago()->pie)
|
||||
<strong>PIE</strong>
|
||||
{{$pie->cuotas}} cuotas que suman
|
||||
{{$format->pesos($pie->pagado('pesos'))}}
|
||||
equivalente a
|
||||
{{$format->ufs($pie->pagado())}}.
|
||||
<br />
|
||||
@endif
|
||||
@if (isset($venta->formaPago()->escritura))
|
||||
@php($escritura = $venta->formaPago()->escritura)
|
||||
<strong>ESCRITURA</strong>
|
||||
{{$format->pesos($escritura->pago->valor)}}
|
||||
el
|
||||
{{$escritura->fecha->format('d-m-Y')}}
|
||||
equivalente a
|
||||
{{$format->ufs($escritura->pago->valor())}}
|
||||
<br />
|
||||
@endif
|
||||
<div class="ui fitted divider"></div>
|
||||
<strong>TOTAL ANTICIPO</strong>
|
||||
{{$format->ufs($venta->formaPago()->anticipo())}}
|
||||
<br />
|
||||
@if (isset($venta->formaPago()->bonoPie))
|
||||
@php($bono = $venta->formaPago()->bonoPie)
|
||||
<strong>BONO PIE</strong>
|
||||
{{$format->ufs($bono->pago->valor())}}
|
||||
<br />
|
||||
@endif
|
||||
@if (isset($venta->formaPago()->credito))
|
||||
@php($credito = $venta->formaPago()->credito)
|
||||
<strong>CRÉDITO</strong>
|
||||
{{$format->ufs($credito->pago->valor())}}
|
||||
en Banco {{$credito->pago->banco->nombre}}
|
||||
<br />
|
||||
@endif
|
||||
<div class="ui fitted divider"></div>
|
||||
<strong>TOTAL</strong>
|
||||
{{$format->ufs($venta->formaPago()->total())}}
|
||||
@if (($venta->formaPago()->total() - $venta->valor) !== 0)
|
||||
<br />
|
||||
<br />
|
||||
Diferencia {{$format->ufs($venta->formaPago()->total() - $venta->valor)}}. ({{$format->percent(($venta->formaPago()->total() - $venta->valor) / $venta->valor * 100)}})
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
@ -9,7 +9,7 @@
|
||||
<i class="small edit icon"></i>
|
||||
</a>
|
||||
</sub>
|
||||
<a href="{{$urls->base}}/venta/{{$venta->id}}/escritura/informe">
|
||||
<a href="{{$urls->base}}/ventas/escritura/{{$venta->id}}/informe">
|
||||
Informe
|
||||
<i class="right chevron icon"></i>
|
||||
</a>
|
||||
|
@ -8,9 +8,16 @@ use Incoviba\Service;
|
||||
|
||||
class Escrituras
|
||||
{
|
||||
public function show(ServerRequestInterface $request, ResponseInterface $response, View $view, Service\Venta $ventaService, int $venta_id): ResponseInterface
|
||||
public function show(ServerRequestInterface $request, ResponseInterface $response, View $view,
|
||||
Service\Venta $ventaService, int $venta_id): ResponseInterface
|
||||
{
|
||||
$venta = $ventaService->getById($venta_id);
|
||||
return $view->render($response, 'ventas.escrituras.show', compact('venta'));
|
||||
}
|
||||
public function informe(ServerRequestInterface $request, ResponseInterface $response, View $view,
|
||||
Service\Venta $ventaService, int $venta_id): ResponseInterface
|
||||
{
|
||||
$venta = $ventaService->getById($venta_id);
|
||||
return $view->render($response, 'ventas.escrituras.informe', compact('venta'));
|
||||
}
|
||||
}
|
||||
|
@ -21,12 +21,16 @@ class Format
|
||||
{
|
||||
return number_format($number, $decimal_places, ',', '.');
|
||||
}
|
||||
public function percent(float|string $number, int $decimal_places = 2): string
|
||||
{
|
||||
return "{$this->number($number, $decimal_places)}%";
|
||||
}
|
||||
public function pesos(string $valor): string
|
||||
{
|
||||
return '$ ' . $this->number($valor);
|
||||
return "$ {$this->number($valor)}";
|
||||
}
|
||||
public function ufs(string $valor): string
|
||||
{
|
||||
return $this->number($valor, 2) . ' UF';
|
||||
return "{$this->number($valor, 2)} UF";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user