@extends('layouts.app') @section('titulo', 'Facturación Electrónica') @section('contenido')
{{-- ========================================================= CABECERA MEJORADA ========================================================== --}}

Facturación Electrónica

Gestión de comprobantes, notas de crédito y envío a SUNAT

Ir al POS
{{-- ========================================================= RESUMEN MEJORADO CON ANIMACIONES ========================================================== --}}
{{-- Pendientes --}}

Pendientes de Envío

{{ $resumen['pendientes'] ?? 0 }}

Pendientes de envío a SUNAT

{{-- Aceptados --}}

Aceptados por SUNAT

{{ $resumen['aceptados'] ?? 0 }}

Comprobantes aceptados

{{-- Errores --}}

Con Errores

{{ $resumen['errores'] ?? 0 }}

Requieren revisión

{{-- ========================================================= TABS MEJORADOS ========================================================== --}}
{{-- TAB COMPROBANTES --}} {{-- TAB NOTAS DE CREDITO --}}
{{-- ========================================================= TAB COMPROBANTES ========================================================== --}}
{{-- ===================================================== FILTROS MEJORADOS ====================================================== --}}
{{-- Buscar --}}
{{-- Tipo --}}
{{-- Estado --}}
Limpiar
{{-- ===================================================== TABLA COMPROBANTES MEJORADA ====================================================== --}}

Listado de Comprobantes

Facturas y boletas generadas desde el POS

{{ $ventas->total() }} registros {{-- Exportar --}}
@forelse($ventas as $venta) @php $tipoVenta = strtoupper( trim($venta->tipo_comprobante ?? '') ); $estadoSunat = strtoupper( trim($venta->sunat_estado ?? '') ); $cliente = $venta->cliente; $nombreCliente = $cliente ? trim( ($cliente->nombre ?? '') . ' ' . ($cliente->apellido_paterno ?? '') . ' ' . ($cliente->apellido_materno ?? '') ) : 'Cliente general'; if ($nombreCliente === '') { $nombreCliente = 'Cliente general'; } $numeroComprobante = $venta->numero_comprobante ?? '-'; $hasNotaCredito = ((int) ($venta->notas_credito_count ?? 0)) > 0; $docCliente = $cliente ? ($cliente->numero_documento ?? '') : ''; @endphp {{-- Fecha --}} {{-- Comprobante --}} {{-- Cliente --}} {{-- Total --}} {{-- Estado --}} {{-- Acciones --}} @empty @endforelse
Fecha Comprobante Cliente Total SUNAT Acciones
{{ optional($venta->created_at)->format('d/m/Y') }}
{{ optional($venta->created_at)->format('H:i:s') }}
{{ $tipoVenta ?: 'DOC' }} {{ $numeroComprobante }}
Venta #{{ $venta->id }}
{{ $nombreCliente }}
@if($docCliente)
{{ $docCliente }}
@endif
S/ {{ number_format((float) $venta->total, 2) }} @if(in_array($estadoSunat, ['ACEPTADO', 'ACEPTADA', 'OK'])) ACEPTADO @elseif($estadoSunat === 'ERROR') ERROR @elseif($estadoSunat === 'PENDIENTE' || $estadoSunat === '') PENDIENTE @else {{ $estadoSunat }} @endif
{{-- Ver --}} {{-- Enviar --}} @if(!in_array($estadoSunat, ['ACEPTADO', 'ACEPTADA', 'OK'])) @endif {{-- Reenviar --}} @if($estadoSunat === 'ERROR') @endif {{-- Nota de crédito --}} @if(in_array($estadoSunat, ['ACEPTADO', 'ACEPTADA', 'OK'])) @if(!$hasNotaCredito) @else ✓ @endif @endif

No hay comprobantes

No se encontraron facturas o boletas con los filtros seleccionados.

{{-- Paginación --}} @if($ventas->hasPages())
{{ $ventas->links() }}
@endif
{{-- ========================================================= TAB NOTAS DE CREDITO MEJORADO ========================================================== --}}

Notas de Crédito

Notas de crédito generadas sobre facturas y boletas aceptadas

{{ isset($notasCredito) ? $notasCredito->total() : 0 }} registros
@forelse(($notasCredito ?? []) as $nota) @php $estadoNC = strtoupper( trim($nota->sunat_estado ?? $nota->estado ?? '') ); $clienteNC = $nota->cliente; $nombreClienteNC = $clienteNC ? trim( ($clienteNC->nombre ?? '') . ' ' . ($clienteNC->apellido_paterno ?? '') . ' ' . ($clienteNC->apellido_materno ?? '') ) : 'Cliente general'; if ($nombreClienteNC === '') { $nombreClienteNC = 'Cliente general'; } $ventaOriginal = $nota->venta; $numeroOriginal = $ventaOriginal ? ($ventaOriginal->numero_comprobante ?? '-') : '-'; $numeroNC = $nota->numero_comprobante ?? '-'; $docClienteNC = $clienteNC ? ($clienteNC->numero_documento ?? '') : ''; @endphp {{-- Fecha --}} {{-- NC --}} {{-- Original --}} {{-- Cliente --}} {{-- Motivo --}} {{-- Total --}} {{-- Estado SUNAT --}} {{-- Stock --}} {{-- Acciones --}} @empty @endforelse
Fecha Nota de Crédito Documento Original Cliente Motivo Total SUNAT Stock Acciones
{{ optional($nota->created_at)->format('d/m/Y') }}
{{ optional($nota->created_at)->format('H:i:s') }}
NC {{ $numeroNC }}
NC #{{ $nota->id }}
{{ $numeroOriginal }}
@if($ventaOriginal)
Venta #{{ $ventaOriginal->id }}
@endif
{{ $nombreClienteNC }}
@if($docClienteNC)
{{ $docClienteNC }}
@endif
{{ $nota->motivo_codigo ?? '-' }}
{{ $nota->motivo ?? '' }}
S/ {{ number_format((float) $nota->total, 2) }} @if(in_array($estadoNC, ['ACEPTADO', 'ACEPTADA', 'OK'])) ACEPTADO @elseif($estadoNC === 'ERROR') ERROR @elseif($estadoNC === 'PENDIENTE' || $estadoNC === '') PENDIENTE @else {{ $estadoNC }} @endif @if(!$nota->devolver_stock) No @elseif($nota->stock_devuelto) ✓ Devuelto @elseif(in_array($estadoNC, ['ACEPTADO', 'ACEPTADA', 'OK'])) @else Esperando SUNAT @endif

No hay Notas de Crédito

Las Notas de Crédito creadas aparecerán aquí.

{{-- Paginación NC --}} @if(isset($notasCredito) && $notasCredito->hasPages())
{{ $notasCredito->links() }}
@endif
{{-- ========================================================= MODAL DETALLE COMPROBANTE MEJORADO ========================================================== --}}

Detalle del comprobante

Cargando detalle...

Comprobante

Tipo

Cliente

Total

Estado SUNAT

Productos

Producto Cant. P. Unit. Subtotal
Importe bruto
Descuento
Subtotal neto
IGV (18%)
Total
{{-- ========================================================= MODAL CREAR NOTA DE CREDITO MEJORADO ========================================================== --}}

Crear Nota de Crédito

Documento original:

⚠

Documento original

Selecciona los productos y cantidades que serán incluidos en la Nota de Crédito.

{{-- Loading --}}
Cargando productos...
{{-- Productos --}}

Productos a acreditar

Incluir Producto Vendido Cantidad NC P. Unit. Importe
{{-- Motivo + resumen --}}
Importe bruto
Descuento proporcional
Subtotal NC
IGV (18%)
Total NC
{{-- Observación --}}
{{-- Devolución de stock --}}
{{-- Botones --}}
{{-- ========================================================= MODAL DETALLE NOTA DE CREDITO MEJORADO ========================================================== --}}

Detalle de Nota de Crédito

Cargando detalle...

Nota de Crédito

Documento original

Motivo

Total

{{-- SUNAT --}}

Estado SUNAT

{{-- Productos --}}

Productos

Producto Cant. P. Unit. Subtotal
{{-- Totales --}}
Importe bruto
Descuento
Subtotal neto
IGV (18%)
Total
{{-- Descripción --}}

Observación

{{-- ========================================================= TOAST MEJORADO ========================================================== --}}
{{-- ============================================================= ALPINE JS - EXPORTACIÓN PROFESIONAL A EXCEL (SIN XML PROBLEMÁTICO) ============================================================= --}} @endsection