@php $totalMontoInicial = 0; $totalPago = 0; $totalDescuento = 0; $totalSaldo = 0; @endphp @foreach($itemsFinal as $k => $item) @if ($item instanceof \Illuminate\Database\Eloquent\Collection) @foreach($item as $k2 => $item2) @php $totalMontoInicial += $item2->monto_inicial; $totalPago += $item2->pago; $totalDescuento += $item2->descuento; $totalSaldo += $item2->saldo; @endphp @endforeach @endif @if (is_array($item)) @foreach($item as $k3 => $collection) @foreach($collection as $k4 => $item4) @php $totalMontoInicial += $item4->monto_inicial; $totalPago += $item4->pago; $totalDescuento += $item4->descuento; $totalSaldo += $item4->saldo; @endphp @endforeach @endforeach @endif @if($item instanceof \App\Models\Item) @if ($item->monto_inicial > 0) @php $totalMontoInicial += $item->monto_inicial; $totalPago += $item->pago; $totalDescuento += $item->descuento; $totalSaldo += $item->saldo; @endphp @endif @endif @endforeach
Concepto Valor Pago Descuento Saldo Fecha Cancelacion Estado
  Periodo Dias Tasa            
TOTAL {{ \App\Helper\ViewerHelper::formatNumber($totalMontoInicial) }} {{ \App\Helper\ViewerHelper::formatNumber($totalPago) }} {{ \App\Helper\ViewerHelper::formatNumber($totalDescuento) }} {{ \App\Helper\ViewerHelper::formatNumber($totalSaldo) }}