@php use App\Models\PuntosVentas; $puntosVentas = new PuntosVentas(); use App\Models\DTEAbonosPagos; $dteAbonosPagos = new DTEAbonosPagos; $fecha = isset($fechaBusqueda) && !empty($fechaBusqueda) ? $fechaBusqueda : NULL; @endphp @php if(isset($sucursales) && !empty($sucursales)): @endphp @foreach ($sucursales as $sucursal) @if (isset($formasDePago) && !empty($formasDePago)) {{ $sucursal->sucursal_nombre}} @php $cont = 1; @endphp @foreach ($formasDePago as $formaDePago) @php $totalMensualPorFormaDePago = $puntosVentas->totalMensualPorSucursal($sucursal->sucursal_id, $formaDePago->forma_pago_id, $fecha); $totalAbonadoPorFormaDePago = $dteAbonosPagos->obtenerAbonosPagos($sucursal->sucursal_id, $formaDePago->forma_pago_id, NULL, $fecha); $totalPorFormaDePago = ($totalMensualPorFormaDePago + $totalAbonadoPorFormaDePago); @endphp @if ($cont == 1) @php $totalMensual = $puntosVentas->totalMensualPorSucursal($sucursal->sucursal_id, NULL, $fecha); $totalAbonado = $dteAbonosPagos->obtenerAbonosPagos($sucursal->sucursal_id, NULL, NULL, $fecha); $totalPorDia = ($totalMensual + $totalAbonado); @endphp ${{ \FCR::num_cl($totalPorDia) }} @endif ${{ \FCR::num_cl($totalPorFormaDePago) }} @php $cont++; @endphp @endforeach @endif @endforeach @php endif; @endphp