@include('header') @php $nro_meses = [ 'enero' => '01', 'febrero' => '02', 'marzo' => '03', 'abril' => '04', 'mayo' => '05', 'junio' => '06', 'julio' => '07', 'agosto' => '08', 'septiembre' => '09', 'octubre' => '10', 'noviembre' => '11', 'diciembre' => '12' ]; @endphp

Caja Interna

Año: @php $anioActual = date('Y'); $anioSeleccionado = request('year', $anioActual); $inicio = date('2018'); $fin = $anioActual; @endphp
@php $sumatoria_anual = 0; @endphp @foreach ($viajesAgrupadosPorMes as $mes => $viajes)
@php $sumatoria_mensual = 0; @endphp @foreach ($viajes as $viaje) @if ($viaje->rendiciones->where('tipo', 'exc_gastos')->count() || $viaje->rendiciones->where('tipo', 'exc_ventas')->count()) @php $exc_ventas = $viaje->rendiciones ->where('tipo', 'exc_ventas') ->sum(function ($rend) { return (float) $rend->cant * (float) $rend->costo * ($rend->tipo_cambio ?? 1); }); $exc_gastos = $viaje->rendiciones ->where('tipo', 'exc_gastos') ->sum(function ($rend) { return (float) $rend->cant * (float) $rend->costo * ($rend->tipo_cambio ?? 1); }); $exc_coord = 0; if ($viaje->rendicionescoord->count()) { $exc_coord = $viaje->rendicionescoord[0]->monto_exc ?? 0; } $monto_final_exc = $exc_ventas - $exc_gastos - $exc_coord; @endphp @endif @php $sumatoria_mensual += $viaje->monto_rendiciones; if ($viaje->rendiciones->where('tipo', 'exc_gastos')->count() || $viaje->rendiciones->where('tipo', 'exc_ventas')->count()) { $sumatoria_mensual += $monto_final_exc; } @endphp @endforeach @if ($viajes->count() > 0) @endif @php $sumatoria_anual += $sumatoria_mensual; @endphp
{{ $mes }}
@endforeach
Total Anual: ${{ number_format($sumatoria_anual, 2, ',', '.') }}
@include('footer')