@isset($exportar) @php echo pack("CCC",0xef,0xbb,0xbf); // BOM para UTF-8 en Excel header("Cache-Control: maxage=1"); header("Pragma: public"); header('Content-type: application/vnd.ms-excel'); header("Content-Disposition: attachment; filename=Balance_Prueba.xls"); header("Pragma: no-cache"); header("Expires: 0"); @endphp @endisset @isset($Balance) @php $fmt = function($val) { $rounded = round($val, 2); if (request()->has('exportar')) { return sprintf("%.2f", $rounded); } return number_format($rounded, 0, ',', '.'); }; $numStyle = request()->has('exportar') ? 'style="mso-number-format:\'\#\,\#\#0\.00\';"' : ''; $decStyle = 'style="mso-number-format:\'0\.00\';"'; // Para la columna C $tipoBalance = $tipoBalance ?? 'prueba'; $titulo = ($tipoBalance == 'general') ? 'ESTADO DE SITUACIÓN FINANCIERA (BALANCE GENERAL)' : 'BALANCE DE PRUEBA'; @endphp
Periodo: {{ $fi }} al {{ $ff }}
| T | C | CUENTA | NOMBRE CUENTA | @if($tipoBalance == 'prueba')Saldo Inicial | Débitos | Créditos | Saldo Final | @elseVALOR | @endif
|---|---|---|---|---|---|---|---|---|
| {{ $b->t }} | {{ $b->c }} | @if($b->t == 'Auxiliar') @endif {{ $b->cuentaNum }} | {!! $indent !!} {{ $b->NombreCuenta }} | @if($tipoBalance == 'prueba'){{ $fmt($b->saldo_inicial) }} | {{ $fmt($b->debito) }} | {{ $fmt(abs($b->credito)) }} | {{ $fmt($b->saldo_final) }} | @else @php // Inversión de Naturaleza para Pasivo y Patrimonio $clase = substr($b->cuentaNum, 0, 1); $valorFinal = $b->saldo_final; if (in_array($clase, ['2', '3'])) { $valorFinal = -$b->saldo_final; } @endphp{{ $fmt($valorFinal) }} | @endif
| @if($tipoBalance == 'prueba') TOTAL SUMA CLASES 1-9 (NETO) @else DIFERENCIA (ACTIVO - PASIVO - PATRIMONIO) @endif | @if($tipoBalance == 'prueba') @php $clases = $Balance->where('t', 'Clase'); @endphp{{ $fmt($clases->sum('si_c') / 100) }} | {{ $fmt($clases->sum('deb_c') / 100) }} | {{ $fmt($clases->sum('cre_c') / 100) }} | {{ $fmt($clases->sum('sf_c') / 100) }} | @else @php $sf_total = $Balance->where('t', 'Clase')->sum('sf_c'); @endphp{{ $fmt($sf_total / 100) }} | @endif|||