ventas.base
This commit is contained in:
@ -1,146 +1,139 @@
|
||||
@extends('layout.base')
|
||||
@extends('ventas.base')
|
||||
|
||||
@section('page_content')
|
||||
<div class="ui container">
|
||||
<div class="ui two column grid">
|
||||
<h1 class="four wide column header">
|
||||
<div class="content">
|
||||
<div class="ui dividing sub header">{{$venta->proyecto()->descripcion}}</div>
|
||||
<a href="{{$urls->base}}/venta/{{$venta->id}}">{{$venta->propiedad()->summary()}}</a>
|
||||
</div>
|
||||
</h1>
|
||||
</div>
|
||||
<h2>Cuotas - Pie</h2>
|
||||
<table class="ui table" id="cuotas">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Fecha</th>
|
||||
<th>Fecha ISO</th>
|
||||
<th>Banco</th>
|
||||
<th>Identificador</th>
|
||||
<th class="right aligned">Valor</th>
|
||||
<th class="right aligned">Valor UF</th>
|
||||
<th>Estado</th>
|
||||
<th>Fecha Estado</th>
|
||||
<th>Fecha Estado ISO</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>@php
|
||||
$now = new DateTimeImmutable();
|
||||
$uf_venta = $venta->uf === 0.0 ? $UF->get($venta->currentEstado()->fecha) : $venta->uf;
|
||||
@endphp
|
||||
@foreach ($venta->formaPago()->pie->cuotas() as $cuota)
|
||||
<tr data-pago="{{$cuota->pago->id}}"
|
||||
@if (in_array($cuota->pago->currentEstado->tipoEstadoPago->descripcion, ['anulado', 'reemplazado']))
|
||||
class="disabled"
|
||||
@endif >
|
||||
<td>{{$cuota->numero}}</td>
|
||||
<td>{{$cuota->pago->fecha->format('d-m-Y')}}</td>
|
||||
<td>{{$cuota->pago->fecha->format('Y-m-d')}}</td>
|
||||
<td>{{$cuota->pago->banco->nombre}}</td>
|
||||
<td>{{$cuota->pago->identificador}}</td>
|
||||
<td class="right aligned">{{$format->pesos($cuota->pago->valor)}}</td>
|
||||
<td class="right aligned">
|
||||
@if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'abonado' and $cuota->pago->currentEstado->fecha <= $now)
|
||||
{{$format->ufs($cuota->pago->valor())}}
|
||||
@endif
|
||||
</td>
|
||||
<td
|
||||
@if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'abonado')
|
||||
class="green"
|
||||
@elseif ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'depositado')
|
||||
class="yellow"
|
||||
@elseif ($cuota->pago->currentEstado->tipoEstadoPago->activo !== 1)
|
||||
class="red"
|
||||
@endif
|
||||
>{{ucwords($cuota->pago->currentEstado->tipoEstadoPago->descripcion)}}</td>
|
||||
<td>
|
||||
@if (in_array($cuota->pago->currentEstado->tipoEstadoPago->descripcion, ['abonado', 'anulado', 'reemplazado']))
|
||||
{{$cuota->pago->currentEstado->fecha->format('d-m-Y')}}
|
||||
@elseif (!in_array($cuota->pago->currentEstado->tipoEstadoPago->descripcion, ['anulado', 'reemplazado']))
|
||||
<div class="ui calendar fecha_estado" data-date="{{$cuota->pago->currentEstado->fecha->format('Y-m-d')}}">
|
||||
<div class="ui action left icon input">
|
||||
<i class="calendar icon"></i>
|
||||
<input type="text" name="fecha_estado" />
|
||||
<button class="ui green basic icon button accept_estado" data-pago="{{$cuota->pago->id}}" data-estado="{{$cuota->pago->currentEstado->tipoEstadoPago->descripcion}}">
|
||||
<i class="check icon"></i>
|
||||
</button>
|
||||
@if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'depositado')
|
||||
<button class="ui red basic icon button reject_estado" data-pago="{{$cuota->pago->id}}">
|
||||
<i class="remove icon"></i>
|
||||
</button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{$cuota->pago->currentEstado->fecha->format('Y-m-d')}}</td>
|
||||
<td>
|
||||
@if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion !== 'anulado')
|
||||
<button class="ui mini red icon basic button anular" data-pago="{{$cuota->pago->id}}">
|
||||
<i class="remove icon"></i>
|
||||
</button>
|
||||
@section('venta_subtitle')
|
||||
Cuotas - Pie
|
||||
@endsection
|
||||
|
||||
@section('venta_content')
|
||||
<table class="ui table" id="cuotas">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Fecha</th>
|
||||
<th>Fecha ISO</th>
|
||||
<th>Banco</th>
|
||||
<th>Identificador</th>
|
||||
<th class="right aligned">Valor</th>
|
||||
<th class="right aligned">Valor UF</th>
|
||||
<th>Estado</th>
|
||||
<th>Fecha Estado</th>
|
||||
<th>Fecha Estado ISO</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>@php
|
||||
$now = new DateTimeImmutable();
|
||||
$uf_venta = $venta->uf === 0.0 ? $UF->get($venta->currentEstado()->fecha) : $venta->uf;
|
||||
@endphp
|
||||
@foreach ($venta->formaPago()->pie->cuotas() as $cuota)
|
||||
<tr data-pago="{{$cuota->pago->id}}"
|
||||
@if (in_array($cuota->pago->currentEstado->tipoEstadoPago->descripcion, ['anulado', 'reemplazado']))
|
||||
class="disabled"
|
||||
@endif >
|
||||
<td>{{$cuota->numero}}</td>
|
||||
<td>{{$cuota->pago->fecha->format('d-m-Y')}}</td>
|
||||
<td>{{$cuota->pago->fecha->format('Y-m-d')}}</td>
|
||||
<td>{{$cuota->pago->banco->nombre}}</td>
|
||||
<td>{{$cuota->pago->identificador}}</td>
|
||||
<td class="right aligned">{{$format->pesos($cuota->pago->valor)}}</td>
|
||||
<td class="right aligned">
|
||||
@if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'abonado' and $cuota->pago->currentEstado->fecha <= $now)
|
||||
{{$format->ufs($cuota->pago->valor())}}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="5">TOTAL</th>
|
||||
<th class="right aligned">
|
||||
{{$format->pesos($total_pesos = array_reduce($venta->formaPago()->pie->cuotas(),
|
||||
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) {
|
||||
return $sum + $cuota->pago->valor;
|
||||
}, 0))}}
|
||||
</th>
|
||||
<th class="right aligned">
|
||||
{{$format->ufs($total = array_reduce($venta->formaPago()->pie->cuotas(),
|
||||
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) use ($now, $uf_venta) {
|
||||
return $sum + (($cuota->pago->fecha > $now or $cuota->pago->uf === null) ?
|
||||
$cuota->pago->valor / $uf_venta :
|
||||
$cuota->pago->valor());
|
||||
}, 0.0))}}
|
||||
</th>
|
||||
<th colspan="4"></th>
|
||||
</td>
|
||||
<td
|
||||
@if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'abonado')
|
||||
class="green"
|
||||
@elseif ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'depositado')
|
||||
class="yellow"
|
||||
@elseif ($cuota->pago->currentEstado->tipoEstadoPago->activo !== 1)
|
||||
class="red"
|
||||
@endif
|
||||
>{{ucwords($cuota->pago->currentEstado->tipoEstadoPago->descripcion)}}</td>
|
||||
<td>
|
||||
@if (in_array($cuota->pago->currentEstado->tipoEstadoPago->descripcion, ['abonado', 'anulado', 'reemplazado']))
|
||||
{{$cuota->pago->currentEstado->fecha->format('d-m-Y')}}
|
||||
@elseif (!in_array($cuota->pago->currentEstado->tipoEstadoPago->descripcion, ['anulado', 'reemplazado']))
|
||||
<div class="ui calendar fecha_estado" data-date="{{$cuota->pago->currentEstado->fecha->format('Y-m-d')}}">
|
||||
<div class="ui action left icon input">
|
||||
<i class="calendar icon"></i>
|
||||
<input type="text" name="fecha_estado" />
|
||||
<button class="ui green basic icon button accept_estado" data-pago="{{$cuota->pago->id}}" data-estado="{{$cuota->pago->currentEstado->tipoEstadoPago->descripcion}}">
|
||||
<i class="check icon"></i>
|
||||
</button>
|
||||
@if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'depositado')
|
||||
<button class="ui red basic icon button reject_estado" data-pago="{{$cuota->pago->id}}">
|
||||
<i class="remove icon"></i>
|
||||
</button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{$cuota->pago->currentEstado->fecha->format('Y-m-d')}}</td>
|
||||
<td>
|
||||
@if ($cuota->pago->currentEstado->tipoEstadoPago->descripcion !== 'anulado')
|
||||
<button class="ui mini red icon basic button anular" data-pago="{{$cuota->pago->id}}">
|
||||
<i class="remove icon"></i>
|
||||
</button>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="5">TOTAL PAGADO</th>
|
||||
<th class="right aligned">
|
||||
{{$format->pesos($pagado_pesos = array_reduce($venta->formaPago()->pie->cuotas(true),
|
||||
function(int $sum, Incoviba\Model\Venta\Cuota $cuota) {
|
||||
return $sum + $cuota->pago->valor;
|
||||
}, 0))}}
|
||||
</th>
|
||||
<th class="right aligned">
|
||||
{{$format->ufs($pagado = array_reduce($venta->formaPago()->pie->cuotas(true),
|
||||
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) {
|
||||
return $sum + $cuota->pago->valor();
|
||||
}, 0.0))}}
|
||||
</th>
|
||||
<th class="right aligned">
|
||||
{{$format->number($pagado / $total * 100, 2)}}%
|
||||
</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="5">POR PAGAR</th>
|
||||
<th class="right aligned">
|
||||
{{$format->pesos($total_pesos - $pagado_pesos)}}
|
||||
</th>
|
||||
<th class="right aligned">
|
||||
{{$format->ufs($total - $pagado)}}
|
||||
</th>
|
||||
<th class="right aligned">
|
||||
{{$format->number(($total - $pagado) / $total * 100, 2)}}%
|
||||
</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="5">TOTAL</th>
|
||||
<th class="right aligned">
|
||||
{{$format->pesos($total_pesos = array_reduce($venta->formaPago()->pie->cuotas(),
|
||||
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) {
|
||||
return $sum + $cuota->pago->valor;
|
||||
}, 0))}}
|
||||
</th>
|
||||
<th class="right aligned">
|
||||
{{$format->ufs($total = array_reduce($venta->formaPago()->pie->cuotas(),
|
||||
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) use ($now, $uf_venta) {
|
||||
return $sum + (($cuota->pago->fecha > $now or $cuota->pago->uf === null) ?
|
||||
$cuota->pago->valor / $uf_venta :
|
||||
$cuota->pago->valor());
|
||||
}, 0.0))}}
|
||||
</th>
|
||||
<th colspan="4"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="5">TOTAL PAGADO</th>
|
||||
<th class="right aligned">
|
||||
{{$format->pesos($pagado_pesos = array_reduce($venta->formaPago()->pie->cuotas(true),
|
||||
function(int $sum, Incoviba\Model\Venta\Cuota $cuota) {
|
||||
return $sum + $cuota->pago->valor;
|
||||
}, 0))}}
|
||||
</th>
|
||||
<th class="right aligned">
|
||||
{{$format->ufs($pagado = array_reduce($venta->formaPago()->pie->cuotas(true),
|
||||
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) {
|
||||
return $sum + $cuota->pago->valor();
|
||||
}, 0.0))}}
|
||||
</th>
|
||||
<th class="right aligned">
|
||||
{{$format->number($pagado / $total * 100, 2)}}%
|
||||
</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="5">POR PAGAR</th>
|
||||
<th class="right aligned">
|
||||
{{$format->pesos($total_pesos - $pagado_pesos)}}
|
||||
</th>
|
||||
<th class="right aligned">
|
||||
{{$format->ufs($total - $pagado)}}
|
||||
</th>
|
||||
<th class="right aligned">
|
||||
{{$format->number(($total - $pagado) / $total * 100, 2)}}%
|
||||
</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
@endsection
|
||||
|
||||
@include('layout.body.scripts.datatables')
|
||||
|
Reference in New Issue
Block a user