diff --git a/app/resources/views/ventas/pies/cuotas.blade.php b/app/resources/views/ventas/pies/cuotas.blade.php
index a7546f7..c7794c3 100644
--- a/app/resources/views/ventas/pies/cuotas.blade.php
+++ b/app/resources/views/ventas/pies/cuotas.blade.php
@@ -79,14 +79,20 @@
TOTAL |
- {{$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))}}
|
- {{$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))}}
|
@@ -95,18 +101,34 @@
TOTAL PAGADO |
- {{$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))}}
|
- {{$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))}}
|
- |
+
+ {{$format->number($pagado / $total * 100, 2)}}%
+ |
+ |
+
+
+ POR PAGAR |
+
+ {{$format->pesos($total_pesos - $pagado_pesos)}}
+ |
+
+ {{$format->ufs($total - $pagado)}}
+ |
+
+ {{$format->number(($total - $pagado) / $total * 100, 2)}}%
+ |
+ |