This commit is contained in:
Juan Pablo Vial
2024-10-03 21:11:06 -03:00
parent 196c5b947f
commit 2592794a49
2 changed files with 31 additions and 8 deletions

View File

@ -13,6 +13,13 @@
return "<a href=\"{$urls->base}/venta/{$venta->id}\">{$venta->propiedad()->departamentos()[0]->descripcion}</a>"; return "<a href=\"{$urls->base}/venta/{$venta->id}\">{$venta->propiedad()->departamentos()[0]->descripcion}</a>";
}, $asociadas)) !!} }, $asociadas)) !!}
</div> </div>
@if ($venta->formaPago()->pie->asociado !== null)
<div class="row">
<div class="ui tiny basic segment">
* Este pie no es la base para el cálculo de las cuotas
</div>
</div>
@endif
</div> </div>
@endif @endif
<div class="ui grid"> <div class="ui grid">
@ -113,13 +120,13 @@
<tr> <tr>
<th colspan="5">TOTAL</th> <th colspan="5">TOTAL</th>
<th class="right aligned"> <th class="right aligned">
{{$format->pesos($total_pesos = array_reduce($venta->formaPago()->pie->cuotas(), {{$format->pesos($total_pesos = array_reduce($venta->formaPago()->pie->cuotas(vigentes: true),
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) { function(int $sum, Incoviba\Model\Venta\Cuota $cuota) {
return $sum + $cuota->pago->valor; return $sum + $cuota->pago->valor;
}, 0))}} }, 0))}}
</th> </th>
<th class="right aligned"> <th class="right aligned">
{{$format->ufs($total = array_reduce($venta->formaPago()->pie->cuotas(), {{$format->ufs($total = array_reduce($venta->formaPago()->pie->cuotas(vigentes: true),
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) use ($now, $uf_venta) { function(float $sum, Incoviba\Model\Venta\Cuota $cuota) use ($now, $uf_venta) {
return $sum + (($cuota->pago->fecha > $now or $cuota->pago->uf === null) ? return $sum + (($cuota->pago->fecha > $now or $cuota->pago->uf === null) ?
$cuota->pago->valor / $uf_venta : $cuota->pago->valor / $uf_venta :
@ -131,13 +138,13 @@
<tr> <tr>
<th colspan="5">TOTAL PAGADO</th> <th colspan="5">TOTAL PAGADO</th>
<th class="right aligned"> <th class="right aligned">
{{$format->pesos($pagado_pesos = array_reduce($venta->formaPago()->pie->cuotas(true), {{$format->pesos($pagado_pesos = array_reduce($venta->formaPago()->pie->cuotas(pagadas: true, vigentes: true),
function(int $sum, Incoviba\Model\Venta\Cuota $cuota) { function(int $sum, Incoviba\Model\Venta\Cuota $cuota) {
return $sum + $cuota->pago->valor; return $sum + $cuota->pago->valor;
}, 0))}} }, 0))}}
</th> </th>
<th class="right aligned"> <th class="right aligned">
{{$format->ufs($pagado = array_reduce($venta->formaPago()->pie->cuotas(true), {{$format->ufs($pagado = array_reduce($venta->formaPago()->pie->cuotas(pagadas: true, vigentes: true),
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) { function(float $sum, Incoviba\Model\Venta\Cuota $cuota) {
return $sum + $cuota->pago->valor(); return $sum + $cuota->pago->valor();
}, 0.0))}} }, 0.0))}}
@ -156,12 +163,15 @@
{{$format->ufs($total - $pagado)}} {{$format->ufs($total - $pagado)}}
</th> </th>
<th class="right aligned"> <th class="right aligned">
{{$format->number(($total > 0) ? ($total - $pagado) / $total * 100 : 0, 2)}}% {{$format->percent(($total > 0) ? ($total - $pagado) / $total * 100 : 0, 2)}}*
</th> </th>
<th colspan="3"></th> <th colspan="3"></th>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
<div class="ui tiny basic right aligned segment">
* Porcentaje calculado sobre el valor de la venta
</div>
@endsection @endsection
@include('layout.head.styles.datatables') @include('layout.head.styles.datatables')
@ -303,13 +313,26 @@
columnDefs: [ columnDefs: [
{ {
target: 1, target: 1,
orderData: [2] orderData: [2],
className: 'dt-center'
}, },
{ {
target: 2, target: 2,
visible: false, visible: false,
searchable: false searchable: false
}, },
{
target: 3,
className: 'dt-center'
},
{
targets: [5, 6],
className: 'dt-right'
},
{
target: 7,
className: 'dt-center'
},
{ {
target: 8, target: 8,
orderData: [9] orderData: [9]

View File

@ -14,7 +14,7 @@
<td class="right aligned">Cuotas</td> <td class="right aligned">Cuotas</td>
<td> <td>
<a href="{{$urls->base}}/venta/{{$venta->id}}/pie/cuotas"> <a href="{{$urls->base}}/venta/{{$venta->id}}/pie/cuotas">
<span data-tooltip="Pagadas">{{count($pie->cuotas(true))}}</span>/{{$pie->cuotas}} <span data-tooltip="Pagadas">{{count($pie->cuotas(true, true))}}</span>/{{$pie->cuotas}}
</a> </a>
@if (count($pie->cuotas(vigentes: true)) < $pie->cuotas) @if (count($pie->cuotas(vigentes: true)) < $pie->cuotas)
<a href="{{$urls->base}}/ventas/pie/{{$pie->id}}/cuotas/add"> <a href="{{$urls->base}}/ventas/pie/{{$pie->id}}/cuotas/add">