@php use App\Support\Money; $customer = $customer ?? $document->customer; $isCreditNote = $title === 'Avoir'; $sign = $isCreditNote ? '− ' : ''; $countries = config('renard-rouge.shipping.countries'); $taxes = collect($document->lines)->groupBy(fn ($line) => (string) (float) $line['tax_rate']) ->map(fn ($lines, $rate) => ['rate' => (float) $rate, 'total' => $total = round($lines->sum('total'), 2), 'tax' => Money::taxIncluded($total, (float) $rate)]); @endphp {{ $title }} {{ $document->number }}
@php $logo = $settings->get('invoicing.logo'); $logo = is_array($logo) ? collect($logo)->first() : $logo; $logoPath = $logo && \Illuminate\Support\Facades\Storage::disk('public')->exists($logo) ? \Illuminate\Support\Facades\Storage::disk('public')->path($logo) : null; @endphp @if ($logoPath) {{ $settings->get('company') }} @else
Le Renard Rouge
@endif
{{ $settings->get('company') }}
{{ $settings->get('address.street') }}
{{ $settings->get('address.postcode') }} {{ $settings->get('address.city') }}
{{ $settings->get('phone') }} · {{ $settings->get('email') }}
{{ $title }}

N° {{ $document->number }}
Date : {{ $document->issued_at->format('d/m/Y') }}
@if ($reference){{ $reference }}@endif

{{ $isCreditNote ? 'Client' : 'Facturé à' }}
@if (! empty($customer['company'])){{ $customer['company'] }}
@endif {{ trim(($customer['first_name'] ?? '').' '.($customer['last_name'] ?? '')) }}
@if (! empty($customer['line1'])){{ $customer['line1'] }}
@endif @if (! empty($customer['line2'])){{ $customer['line2'] }}
@endif @if (! empty($customer['postcode'])){{ $customer['postcode'] }} {{ $customer['city'] ?? '' }}
@endif @if (! empty($customer['country']) && $customer['country'] !== 'FR'){{ $countries[$customer['country']] ?? $customer['country'] }}
@endif {{ $customer['email'] ?? '' }}
@foreach ($document->lines as $line) @endforeach
Désignation Qté PU TTC TVA Total TTC
{{ $line['label'] }} {{ rtrim(rtrim(number_format((float) $line['quantity'], 2, ',', ''), '0'), ',') }} {{ $sign }}{{ Money::format($line['unit_price']) }} {{ str_replace('.', ',', (string) (float) $line['tax_rate']) }} % {{ $sign }}{{ Money::format($line['total']) }}
@foreach ($taxes as $tax) @endforeach
Total HT{{ $sign }}{{ Money::format($document->total_excl_tax) }}
TVA {{ str_replace('.', ',', (string) $tax['rate']) }} % (base {{ Money::format($tax['total'] - $tax['tax']) }}){{ $sign }}{{ Money::format($tax['tax']) }}
{{ $isCreditNote ? 'Montant de l\'avoir TTC' : 'Total TTC' }}{{ $sign }}{{ Money::format($document->total) }}
@if (! $isCreditNote)

Règlement : {{ $document->payment_method ?: $settings->get('invoicing.payment_terms') }}

@endif

{{ $settings->get('invoicing.footer') }}