@include('helpers.ChiffresEnLettres') @php $company = auth()->user()->company; @endphp
@foreach($data->sale->commands as $command) @endforeach @if($company->tva) @else @endif @php $paidSum = $data->payments()->sum('amount'); $discount = $data->discount ?? 0; $totalDue = max(0, ($data->total ?? $data->amount) - $discount); $remaining = max(0, $totalDue - $paidSum); @endphp @php $paymentDate = ($data->payments && $data->payments->count() > 0) ? ' (' . $data->payments->first()->payment_date->translatedFormat('d/m/Y') . ')' : ''; @endphp
@if($company->logo) @endif
{{ $company->name }}
{{ $company->tel }}
{{ $company->address }}
{{ $company->city ?? 'Lomé' }}, le {{ $data->date->format('d') }} {{ $data->monthToFr() }} {{ $data->date->format('Y') }}
Achat Médicaments

FACTURE Nº {{ $data->no() }}

Désignation Quantité Prix Unitaire Prix Total
{{ $command->product->name }} {{ $command->qte }} {{ number_format($command->product->selling_price, 0, '', ' ') }} {!! htmlentities($company->currency_symbol, ENT_NOQUOTES, 'UTF-8') !!} {{ number_format($command->qte * $command->product->selling_price, 0, '', ' ') }} {!! htmlentities($company->currency_symbol, ENT_NOQUOTES, 'UTF-8') !!}
Total HT {{ number_format($data->amount, 0, '', ' ') }} {!! htmlentities($company->currency_symbol, ENT_NOQUOTES, 'UTF-8') !!}
Montant TVA {{ number_format($data->tva_amount, 0, '', ' ') }} {!! htmlentities($company->currency_symbol, ENT_NOQUOTES, 'UTF-8') !!}
Total TTC {{ number_format($data->total, 0, '', ' ') }} {!! htmlentities($company->currency_symbol, ENT_NOQUOTES, 'UTF-8') !!}
Total Général {{ number_format($data->amount, 0, '', ' ') }} {!! htmlentities($company->currency_symbol, ENT_NOQUOTES, 'UTF-8') !!}
Total à payer {{ number_format($totalDue, 0, '', ' ') }} {!! htmlentities($company->currency_symbol, ENT_NOQUOTES, 'UTF-8') !!}
({{ convertCurrencyToWords($totalDue) }} {{ $company->currency }})
@if($remaining > 0) Facture partiellement payée{{ $paymentDate }} @else Facture payée{{ $paymentDate }} @endif
Montant payé {{ number_format($paidSum, 0, '', ' ') }} {!! htmlentities($company->currency_symbol, ENT_NOQUOTES, 'UTF-8') !!}
Reste à payer {{ number_format($remaining, 0, '', ' ') }} {!! htmlentities($company->currency_symbol, ENT_NOQUOTES, 'UTF-8') !!}
Signature du Client Signature @if($company->signature)
@endif
Dr. {{ $company->doctor }}

{!! $company->header !!} {!! $company->footer !!}