@extends('layouts.app') @section('content')

Factura N° {{ $factura->numeroFormateado() }}

@if (session('status'))
{{ session('status') }}
@endif @if ($errors->any())
{{ $errors->first() }}
@endif @if ($factura->esAnulada())
Esta factura está anulada. El stock de sus productos fue repuesto.
@endif @if (auth()->user()->esAdmin())
@csrf @method('PATCH')
Anular repone el stock de cada línea; volver a Pendiente/Pagada desde Anulada lo vuelve a descontar (si hay stock disponible).
@endif
Cliente: {{ $factura->cliente->nombre }}
Cédula/RIF: {{ $factura->cliente->cedula }}
Teléfono: {{ $factura->cliente->telefono }}
Fecha: {{ $factura->created_at->format('d/m/Y H:i') }}
Cajero: {{ $factura->user->name }}
Estado: @if ($factura->esAnulada()) Anulada @elseif ($factura->esNotaCredito()) Pendiente @else Pagada @endif
@foreach ($factura->detalles as $detalle) @endforeach
Descripción Cantidad Precio unitario Impuesto Subtotal
{{ $detalle->descripcion }} {{ $detalle->cantidad }} {{ number_format($detalle->precio_unitario, 2) }} {{ $detalle->tipoImpuesto->nombre }} ({{ number_format($detalle->impuesto_porcentaje, 2) }}%) {{ number_format($detalle->subtotal, 2) }}
Subtotal
{{ number_format($factura->subtotal + $factura->descuento_monto, 2) }}
@if ($factura->descuento_monto > 0)
Descuento{{ $factura->descuento_porcentaje > 0 ? ' ('.number_format($factura->descuento_porcentaje, 2).'%)' : '' }} @if ($factura->cupon)
Cupón: {{ $factura->cupon->codigo }}@endif
-{{ number_format($factura->descuento_monto, 2) }}
@endif @foreach ($factura->impuestos_desglose ?? [] as $grupo)
{{ $grupo['nombre'] }} ({{ number_format($grupo['porcentaje'], 2) }}%)
{{ number_format($grupo['monto'], 2) }}
@endforeach
Total
{{ number_format($factura->total, 2) }}
Efectivo
{{ number_format($factura->efectivo, 2) }}
Débito
{{ number_format($factura->debito, 2) }}
Crédito
{{ number_format($factura->credito, 2) }}
Cheque
{{ number_format($factura->cheque, 2) }}
Vuelto
{{ number_format($factura->vuelto, 2) }}
@endsection