@php $granTotal = $facturas->sum('total'); $grupos = $facturas->groupBy('aul_curso_tipo'); $tipos = [ 1 => 'REGULARES', 2 => 'NO REGULARES', 4 => 'EVALUACIONES', 6 => 'ROCO', ]; $labelsTexto = [ 1 => 'regulares', 2 => 'no regulares', 4 => 'evaluaciones', 6 => 'ROCO', ]; $presentTypes = $grupos ->keys() ->sort() ->map(fn($id) => $labelsTexto[$id] ?? null) ->filter() ->values() ->toArray(); if (count($presentTypes) > 1) { $last = array_pop($presentTypes); $textoTipos = implode(', ', $presentTypes) . ' y ' . $last; } else { $textoTipos = $presentTypes[0] ?? 'cursos'; } $sexo = $directores->dir_sexo == 1 ? 'Director' : 'Directora'; $unidad_oficio = strtoupper(substr($unidad_corto, 0, 3)); @endphp @php $totalEstatal = $facturas->sum('fac_monto_estatal'); $totalFederal = $facturas->sum('fac_monto_federal'); $totalIP = $facturas->sum('fac_monto_ip'); if ($totalIP > 0) { $textoFuentes = 'Federal e IP'; } else { $sources = []; if ($totalEstatal > 0) { $sources[] = 'Estatal'; } if ($totalFederal > 0) { $sources[] = 'Federal'; } if (count($sources) == 2) { $textoFuentes = 'Estatal y Federal'; } elseif (count($sources) == 1) { $textoFuentes = $sources[0]; } else { $textoFuentes = 'Estatal y Federal'; // Default } } $consecutivo = rand(1, 9999); @endphp
OFICIO NÚM. U.{{ $unidad_oficio }}-{{ $folio }}-{{ str_pad($mes, 2, '0', STR_PAD_LEFT) }}-{{ $anio }}

UNIDAD {{ $unidad }}

{{ str_ireplace([' De ', ' Del '], [' de ', ' del '], mb_convert_case($unidad, MB_CASE_TITLE, 'UTF-8')) }}, Pue, {{ $dia }}

ASUNTO: Solicitud de pago de facturas por fuente de financiamiento {{ $textoFuentes }}

CRISTINA SANCHEZ REYES

DIRECTORA ADMINISTRATIVA

PRESENTE

Por medio del presente le solicito el pago a los prestadores de servicios, por concepto de honorarios de los cursos {{ $textoTipos }} del mes de {{ $mesTexto }}, por un importe total de ${{ number_format($granTotal, 2) }}, mismas que a continuación se detallan:

@foreach ($tipos as $key => $titulo) @if (isset($grupos[$key]))

{{ $key == 4 || $key == 6 ? '' : 'CURSOS' }} {{ $titulo }}

@php $subtotalImporte = 0; $subtotalEstatal = 0; $subtotalFederal = 0; $subtotalIP = 0; @endphp @foreach ($grupos[$key] as $index => $f) @php $subtotalImporte += $f->total; $subtotalEstatal += $f->fac_monto_estatal; $subtotalFederal += $f->fac_monto_federal; $subtotalIP += $f->fac_monto_ip; @endphp @endforeach
No. INSTRUCTOR NOMBRE DEL CURSO FOLIO FISCAL FACTURA No. CONTRATO IMPORTE A PAGAR MONTO ESTATAL MONTO FEDERAL MONTO IP
{{ $index + 1 }} {{ $f->ins_ape_pat }} {{ $f->ins_ape_mat }} {{ $f->ins_nombre }} {{ $f->aul_curso_nombre }} {{ $f->folio_factura }} {{ $f->aul_clave_registro }} ${{ number_format($f->total, 2) }} ${{ number_format($f->fac_monto_estatal, 2) }} ${{ number_format($f->fac_monto_federal, 2) }} ${{ number_format($f->fac_monto_ip, 2) }}
SUBTOTAL: ${{ number_format($subtotalImporte, 2) }} ${{ number_format($subtotalEstatal, 2) }} ${{ number_format($subtotalFederal, 2) }} ${{ number_format($subtotalIP, 2) }}
@endif @endforeach @php $totalEstatal = $facturas->sum('fac_monto_estatal'); $totalFederal = $facturas->sum('fac_monto_federal'); $totalIP = $facturas->sum('fac_monto_ip'); @endphp

GRAN TOTAL

IMPORTE A PAGAR MONTO ESTATAL MONTO FEDERAL MONTO IP
${{ number_format($granTotal, 2) }} ${{ number_format($totalEstatal, 2) }} ${{ number_format($totalFederal, 2) }} ${{ number_format($totalIP, 2) }}

Sin más por el momento quedo de usted.