{{-- resources/views/livewire/gastos/index.blade.php --}}
{{-- ── HEADER ──────────────────────────────────── --}}
📥 Gastos · XML de Hacienda
Facturas de compra recibidas · IVA acreditable · inventario automático
{{-- ── MENSAJES ─────────────────────────────────── --}} @if($mensaje_exito)
✅ {{ $mensaje_exito }}
@endif @if($mensaje_error)
❌ {{ $mensaje_error }}
@endif {{-- ── KPIs DEL PERÍODO ────────────────────────── --}}
Total gastos
{{ number_format($totales->total) }}
Monto total
₡{{ number_format($totales->monto_total ?? 0, 0) }}
IVA acreditable
₡{{ number_format($totales->iva_acreditable ?? 0, 0) }}
📦 Con inventario
{{ number_format($totales->con_inventario ?? 0) }}
{{-- ── SUBIR XML ────────────────────────────────── --}}
Subir XML manualmente
@if($upload_error)
❌ {{ $upload_error }}
@endif @if($upload_exito)
✅ {{ $upload_exito }}
@endif
{{-- ── FILTROS ──────────────────────────────────── --}}
{{-- ── TABLA DE GASTOS ──────────────────────────── --}}
@forelse($gastos as $gasto) {{-- Proveedor --}} {{-- Clave --}} {{-- Fecha --}} {{-- Categoría --}} {{-- Base gravada --}} {{-- IVA pagado --}} {{-- IVA acreditable --}} {{-- Total --}} {{-- Inventario --}} {{-- CxP --}} {{-- Estado Hacienda --}} {{-- Acciones --}} @empty @endforelse
Proveedor Clave Hacienda Fecha Categoría Base gravada IVA pagado Acreditable Total Inventario CxP Estado Acciones
{{ $gasto->proveedor_nombre }}
{{ $gasto->proveedor_cedula_tipo }}-{{ $gasto->proveedor_cedula }}
{{ substr($gasto->clave_hacienda, 0, 12) }}…
Consec: {{ $gasto->consecutivo_proveedor }}
{{ \Carbon\Carbon::parse($gasto->fecha_emision)->format('d M Y') }} @php $cat_labels = [ 'mercancia' => '📦', 'servicio' => '🔧', 'alquiler' => '🏢', 'activo_fijo' => '🏭', 'otro' => '📄', ]; @endphp {{ $cat_labels[$gasto->categoria] ?? '📄' }} {{ ucfirst($gasto->categoria) }} @if($gasto->subcategoria)
{{ $gasto->subcategoria }}
@endif
₡{{ number_format( $gasto->base_gravada_13 + $gasto->base_gravada_4 + $gasto->base_gravada_2 + $gasto->base_gravada_1, 2 ) }} ₡{{ number_format($gasto->total_iva, 2) }} @if($gasto->iva_acreditable > 0) ₡{{ number_format($gasto->iva_acreditable, 2) }} @else No aplica @endif ₡{{ number_format($gasto->total_comprobante, 2) }} @if($gasto->afecta_inventario && $gasto->inventario_procesado) 📦 Actualizado @elseif($gasto->afecta_inventario && !$gasto->inventario_procesado) ⏳ Pendiente @else Servicio @endif @if($gasto->condicion_venta === '02') {{ match($gasto->estado_cxp) { 'pagado' => '✓ Pagada', 'vencido' => '🔴 Vencida', 'parcial' => '◑ Parcial', 'pendiente'=> '⏳ Pendiente', default => 'Contado', } }} @if($gasto->fecha_vencimiento_cxp)
Vence: {{ \Carbon\Carbon::parse($gasto->fecha_vencimiento_cxp)->format('d/m/Y') }}
@endif @else Contado @endif
{{ match($gasto->estado_hacienda) { 'validado' => '✓ Validado', 'invalido' => '✕ Inválido', default => '⏳ Pendiente', } }}
@if($gasto->iva_acreditable > 0) @endif
No hay gastos registrados con los filtros seleccionados
{{-- Paginación --}} @if($gastos->hasPages())
{{ $gastos->links() }}
@endif
{{-- ── MODAL CLASIFICACIÓN ─────────────────────── --}} @if($clasificando_id)
🏷️ Clasificar gasto
La categoría afecta la declaración D-104 y los reportes contables.
@endif