|
rend_finalizada == 1 ? 'checked' : '' }} onclick="cambiarRendFinalizada({{ $viaje->id }})">
|
{{ date('d/m/Y', strtotime($viaje->fecha_hora_salida)) }} |
{{ $viaje->destino->ciudad ?? '-' }} |
${{ number_format($viaje->monto_rendiciones ?? 0, 2, ',', '.') }}
|
@if ($viaje->rendiciones->where('tipo', 'exc_gastos')->count() || $viaje->rendiciones->where('tipo', 'exc_ventas')->count())
|
{{ date('d/m/Y', strtotime($viaje->fecha_hora_salida)) }} |
Exc. {{ $viaje->destino->ciudad ?? '-' }}
|
@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
${{ number_format($monto_final_exc ?? 0, 2, ',', '.') }}
|
@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)
| Total Final: |
${{ number_format($sumatoria_mensual, 2, ',', '.') }}
|
@endif
@php $sumatoria_anual += $sumatoria_mensual; @endphp