@php use Illuminate\Support\Str; @endphp Outstanding Sales Report
Outstanding Sales Report
Company Information
@if($company && $company->logo_path) Company Logo @endif
Name: {{ $company->name ?? 'Company Name' }}
Address: {{ $company->address ?? 'Company Address' }}
Phone: {{ $company->phone ?? 'Company Phone' }}
Email: {{ $company->email ?? 'Company Email' }}
@if($company && $company->vat_no)
VAT No: {{ $company->vat_no }}
@endif @if($company && $company->tin_no)
TIN No: {{ $company->tin_no }}
@endif
Report Information
Report Type: {{ ucfirst($reportType) }}
Period: {{ $fromDate }} to {{ $toDate }}
Report Date: {{ date('d M Y') }}
Total Outstanding: USD{{ number_format($totalOutstanding, 2) }}
@if($reportType === 'summary') @foreach($invoiceBalances as $item) @endforeach
Date Customer Code Name Balance (USD)
{{ \Carbon\Carbon::parse($item['invoice']->document_date)->format('d/m/Y') }} {{ $item['invoice']->customer->customer_code }} {{ $item['invoice']->customer->customer_account }} {{ number_format($item['balance'], 2) }}
Total Outstanding: USD{{ number_format($totalOutstanding, 2) }}
@else @foreach($customerInvoices as $customerData)

Customer: {{ $customerData['customer']->customer_account }} | Code: {{ $customerData['customer']->customer_code }}

@php $customerBalance = 0; @endphp @foreach($customerData['invoices'] as $item) @php $customerBalance += $item['balance']; @endphp @endforeach
Date Invoice Amount (USD) Tax Discount Amount Paid (USD) Balance (USD)
{{ \Carbon\Carbon::parse($item['invoice']->document_date)->format('d/m/Y') }} {{ $item['invoice']->document_number }} {{ number_format($item['invoice']->inclusive_total, 2) }} {{ number_format($item['invoice']->tax_amount, 2) }} {{ number_format($item['invoice']->discount_total, 2) }} {{ number_format($item['amount_paid'], 2) }} {{ number_format($item['balance'], 2) }}
Closing balance for {{ strtoupper($customerData['customer']->customer_account) }} : USD{{ number_format($customerBalance, 2) }}

@endforeach
Total Outstanding: USD{{ number_format($totalOutstanding, 2) }}
@endif