FIX: Pie cuotas valores uf

This commit is contained in:
2024-01-08 13:16:12 -03:00
parent 675b3843ea
commit bc2333bc95
4 changed files with 25 additions and 16 deletions

View File

@ -26,7 +26,10 @@
<th>Fecha Estado ISO</th>
</tr>
</thead>
<tbody>@php $now = new DateTimeImmutable(); @endphp
<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>
<td>{{$cuota->numero}}</td>
@ -85,16 +88,12 @@
}, 0))}}
</th>
<th class="right aligned">
@php
$now = new DateTimeImmutable();
@endphp
{{$format->ufs($total = array_reduce($venta->formaPago()->pie->cuotas(),
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) use ($now, $venta) {
if ($cuota->pago->fecha > $now) {
return $sum + $cuota->pago->valor / $venta->uf;
}
return $sum + $cuota->pago->valor();
}, 0))}}
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="3"></th>
</tr>