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>";
}, $asociadas)) !!}
</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>
@endif
<div class="ui grid">
@ -113,13 +120,13 @@
<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) {
{{$format->pesos($total_pesos = array_reduce($venta->formaPago()->pie->cuotas(vigentes: true),
function(int $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(),
{{$format->ufs($total = array_reduce($venta->formaPago()->pie->cuotas(vigentes: true),
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 :
@ -131,13 +138,13 @@
<tr>
<th colspan="5">TOTAL PAGADO</th>
<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) {
return $sum + $cuota->pago->valor;
}, 0))}}
</th>
<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) {
return $sum + $cuota->pago->valor();
}, 0.0))}}
@ -156,12 +163,15 @@
{{$format->ufs($total - $pagado)}}
</th>
<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 colspan="3"></th>
</tr>
</tfoot>
</table>
<div class="ui tiny basic right aligned segment">
* Porcentaje calculado sobre el valor de la venta
</div>
@endsection
@include('layout.head.styles.datatables')
@ -303,13 +313,26 @@
columnDefs: [
{
target: 1,
orderData: [2]
orderData: [2],
className: 'dt-center'
},
{
target: 2,
visible: false,
searchable: false
},
{
target: 3,
className: 'dt-center'
},
{
targets: [5, 6],
className: 'dt-right'
},
{
target: 7,
className: 'dt-center'
},
{
target: 8,
orderData: [9]

View File

@ -14,7 +14,7 @@
<td class="right aligned">Cuotas</td>
<td>
<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>
@if (count($pie->cuotas(vigentes: true)) < $pie->cuotas)
<a href="{{$urls->base}}/ventas/pie/{{$pie->id}}/cuotas/add">