@extends('layouts.app') @section('title', 'Reporte de Caja Chica por Cliente') @section('content')
{{-- Header --}}

Reporte de Caja Chica por Cliente

{{-- Filtro de fechas --}}
@if($fechaDesde || $fechaHasta) @endif
{{-- Encabezado impresión --}}
Logo

Cornejo & Cubas Abogados

Gestión de Expedientes Judiciales

Reporte General de Caja Chica

@if($fechaDesde || $fechaHasta)

Período: {{ $fechaDesde ? \Carbon\Carbon::parse($fechaDesde)->format('d/m/Y') : '—' }} al {{ $fechaHasta ? \Carbon\Carbon::parse($fechaHasta)->format('d/m/Y') : '—' }}

@endif

Generado el {{ now()->format('d/m/Y H:i') }}

{{-- Total General --}} @if($totalGeneral > 0)
TOTAL GENERAL CAJA CHICA
S/ {{ number_format($totalGeneral, 2) }}
{{ count($clienteData) }} cliente(s) con gastos
@endif {{-- Tabla resumen por cliente --}} @if(count($clienteData) > 0)
Resumen por Cliente
@foreach($clienteData as $row) @endforeach
Cliente DNI / RUC Expedientes con Gastos N° Registros Total Gastos Detalle
{{ $row['cliente']->nombre_completo }} {{ $row['cliente']->dni_ruc ?? '—' }} {{ $row['expedientes']->count() }} {{ $row['gastos_directos']->count() + $row['expedientes']->sum(fn($e) => $e['gastos']->count()) }} S/ {{ number_format($row['total'], 2) }} Ver
TOTAL GENERAL: S/ {{ number_format($totalGeneral, 2) }}
{{-- Detalle por cliente (solo impresión) --}}
@foreach($clienteData as $row)

{{ $row['cliente']->nombre_completo }}

@if($row['cliente']->dni_ruc)

DNI/RUC: {{ $row['cliente']->dni_ruc }}

@endif
@foreach($row['expedientes'] as $expData)
Expediente N° {{ $expData['expediente']->numero_expediente }} — {{ $expData['expediente']->materia }}
@foreach($expData['gastos'] as $gas) @endforeach
FechaConceptoCategoríaMonto
{{ $gas->fecha->format('d/m/Y') }} {{ $gas->concepto }} {{ $gas->categoria }} S/ {{ number_format($gas->monto, 2) }}
Subtotal: S/ {{ number_format($expData['subtotal'], 2) }}
@endforeach @if($row['gastos_directos']->count() > 0)
Gastos Generales (sin expediente)
@foreach($row['gastos_directos'] as $gas) @endforeach
FechaConceptoCategoríaMonto
{{ $gas->fecha->format('d/m/Y') }} {{ $gas->concepto }} {{ $gas->categoria }} S/ {{ number_format($gas->monto, 2) }}
@endif
Total {{ $row['cliente']->nombre_completo }}: S/ {{ number_format($row['total'], 2) }}
@endforeach
@else

No se encontraron gastos registrados para ningún cliente en el período seleccionado.

Ir al Registro de Gastos
@endif
@endsection