Porcentajes en cuotas
This commit is contained in:
@ -79,14 +79,20 @@
|
||||
<tr>
|
||||
<th colspan="5">TOTAL</th>
|
||||
<th class="right aligned">
|
||||
{{$format->pesos(array_reduce($venta->formaPago()->pie->cuotas(),
|
||||
{{$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(array_reduce($venta->formaPago()->pie->cuotas(),
|
||||
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) {
|
||||
@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))}}
|
||||
</th>
|
||||
@ -95,18 +101,34 @@
|
||||
<tr>
|
||||
<th colspan="5">TOTAL PAGADO</th>
|
||||
<th class="right aligned">
|
||||
{{$format->pesos(array_reduce($venta->formaPago()->pie->cuotas(true),
|
||||
function(float $sum, Incoviba\Model\Venta\Cuota $cuota) {
|
||||
{{$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(array_reduce($venta->formaPago()->pie->cuotas(true),
|
||||
{{$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.0))}}
|
||||
</th>
|
||||
<th colspan="3"></th>
|
||||
<th class="right aligned">
|
||||
{{$format->number($pagado / $total * 100, 2)}}%
|
||||
</th>
|
||||
<th colspan="2"></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="2"></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
Reference in New Issue
Block a user