@extends('admin.layouts.app') @php $isExpense = $document->type === \App\Models\FinancialDocument::TYPE_EXPENSE; $typeLabel = $isExpense ? 'Despesa' : 'Receita'; $settledLabel = $isExpense ? 'Paga' : 'Recebida'; $pendingLabel = $isExpense ? 'Por pagar' : 'Por receber'; $documentUrl = $document->documentUrl(); $isPdfDocument = $documentUrl && \Illuminate\Support\Str::contains(\Illuminate\Support\Str::lower(parse_url($documentUrl, PHP_URL_PATH) ?: $documentUrl), '.pdf'); $vatBase = $document->vatLines->sum('amount'); $vatTotal = $document->vatLines->sum(function ($line) { return (float) $line->amount * (1 + ((float) $line->vat_rate / 100)); }); @endphp @section('content')

{{ $typeLabel }} {{ $document->invoice_number }}

{{ optional($document->invoice_date)->format('d/m/Y') }} ยท {{ optional($document->club)->name }}
Voltar @if(!$document->is_settled)
@csrf
@endif
@if(session('success'))
{{ session('success') }}
@endif
Total com IVA
{{ number_format($document->total_amount, 2, ',', '.') }} EUR
{{ $document->is_settled ? $settledLabel : $pendingLabel }}
Tipologia
{{ $document->typology }}
Prazo
{{ optional($document->due_date)->format('d/m/Y') ?: '-' }}
Categoria
{{ $document->category_code ? $document->category_code.' - '.$document->category_name : '-' }}
Criado por
{{ optional($document->admin)->name ?: '-' }}
Descricao
{{ $document->description }}
{{ $isExpense ? 'Fornecedor' : 'Cliente' }}
Nome
{{ optional($document->entity)->name ?: '-' }}
NIF
{{ optional($document->entity)->tax_id ?: '-' }}
Morada
{{ optional($document->entity)->address ?: '-' }}
@if(optional($document->entity)->description)
Descricao
{{ $document->entity->description }}
@endif
IVA
@forelse($document->vatLines as $line) @php $lineTotal = (float) $line->amount * (1 + ((float) $line->vat_rate / 100)); @endphp @empty @endforelse
Valor sem IVA Taxa Total linha
{{ number_format($line->amount, 2, ',', '.') }} EUR {{ number_format($line->vat_rate, 2, ',', '.') }}% {{ number_format($lineTotal, 2, ',', '.') }} EUR
Sem linhas de IVA.
@if($document->vatLines->isNotEmpty())
Base: {{ number_format($vatBase, 2, ',', '.') }} EUR Total com IVA: {{ number_format($vatTotal, 2, ',', '.') }} EUR
@endif
Reparticao por clubes
@forelse($document->splits as $split) @empty @endforelse
Clube Valor
{{ optional($split->club)->name ?: '-' }} {{ number_format($split->amount, 2, ',', '.') }} EUR
{{ optional($document->club)->name ?: '-' }} {{ number_format($document->total_amount, 2, ',', '.') }} EUR
@if($documentUrl && !$isPdfDocument) @endif @endsection @push('styles') @endpush @push('scripts') @if($documentUrl && !$isPdfDocument) @endif @endpush