@extends('layouts.admin') @section('title', $sale->invoice_no) @section('content') @php // Settings theke company info (auto) $co = \App\Models\CompanySetting::current(); $arNum = fn ($v) => \App\Models\CompanySetting::arDigits($v); $fmt = fn ($v) => number_format((float) $v, 2); $methods = ['cash' => 'Cash', 'card' => 'Card', 'bank' => 'Bank Transfer']; $payLabel = $methods[$sale->payment_method] ?? ucfirst((string) $sale->payment_method); $statusColor = ['paid' => '#15803d', 'partial' => '#b45309', 'due' => '#b91c1c']; $vatRate = rtrim(rtrim(number_format($sale->vat_rate, 2), '0'), '.'); $totalQty = $sale->items->sum('quantity'); $minRows = 14; $blank = max(0, $minRows - $sale->items->count()); $mobiles = $co->mobiles ?? []; @endphp {{-- Breadcrumb + buttons --}}
Sales/ {{ $sale->invoice_no }}
+ New Sale
@if (session('success'))
{{ session('success') }}
@endif {{-- ================= INVOICE ================= --}}
{{-- Header: English | Logo + Title | Arabic --}}
{{ $co->name }}
@foreach (preg_split('/\r\n|\r|\n/', (string) $co->tagline) as $line) @if (trim($line) !== '')
{{ $line }}
@endif @endforeach @if ($co->address)
{{ $co->address }}
@endif @if ($co->telephone)
Tel: {{ $co->telephone }}
@endif @foreach ($mobiles as $m)
Mobile: {{ $m }}
@endforeach @if ($co->email)
{{ $co->email }}
@endif
TAX INVOICE فاتورة الضريبة
@if ($co->trn)
TRN: {{ $co->trn }}
@endif
@if ($co->name_ar)
{{ $co->name_ar }}
@endif @foreach (preg_split('/\r\n|\r|\n/', (string) $co->tagline_ar) as $line) @if (trim($line) !== '')
{{ $line }}
@endif @endforeach @if ($co->address_ar)
{{ $co->address_ar }}
@endif @if ($co->telephone)
{{ $arNum($co->telephone) }}
@endif @foreach ($mobiles as $m)
{{ $arNum($m) }}
@endforeach
{{-- Invoice info --}}
Invoice No.:{{ $sale->invoice_no }}
Bill Type:{{ $payLabel }}
Payment Term:{{ strtoupper($payLabel) }}
Invoice Date:{{ $sale->date->format('d/m/Y') }}
Due Date:{{ $sale->date->format('d/m/Y') }}
{{-- Customer --}}
Customer Name & Billing Address
{{ $sale->customer_name }}
@if ($sale->customer_trn)
TRN: {{ $sale->customer_trn }}
@endif @if ($sale->customer_phone)
Tel: {{ $sale->customer_phone }}
@endif
Delivery Address
{{-- Items --}} @foreach ($sale->items as $i => $item) @php $lineTotal = (float) $item->line_total + (float) $item->vat_amount; @endphp @endforeach @for ($b = 0; $b < $blank; $b++) @endfor
S No Description Qty Unit Unit
Price
Taxable
Amount
VAT % VAT
Amount
Amount
(AED)
{{ $i + 1 }} {{ $item->product_name }} {{ rtrim(rtrim(number_format((float) $item->quantity, 2), '0'), '.') }} {{ $item->unit ?? '' }} {{ $fmt($item->unit_price) }} {{ $fmt($item->line_total) }} {{ $vatRate }} % {{ $fmt($item->vat_amount) }} {{ $fmt($lineTotal) }}
 
Total {{ rtrim(rtrim(number_format((float) $totalQty, 2), '0'), '.') }}
{{-- Bill amount in words + totals (Discount nai) --}}
Bill Amount : AED {{ $sale->total_in_words }}
Total Amount{{ $fmt($sale->subtotal) }}
VAT {{ $vatRate }} %{{ $fmt($sale->vat_amount) }}
Amount
Including VAT
{{ $fmt($sale->total) }}
{{-- Paid / Due --}}
Payment: {{ $payLabel }} Paid: AED {{ $fmt($sale->paid_amount) }} Due: AED {{ $fmt($sale->due_amount) }} {{ $sale->payment_status }}
@if ($sale->note)
Note: {{ $sale->note }}
@endif {{-- Signatures --}}
Receiver's Signature
For {{ strtoupper($co->name) }} Authorised Signatory
{{-- Footer image (Settings theke) --}} @if ($co->footer_url)
Brands
@endif
@endsection