@php use Illuminate\Support\Str; @endphp Customer Statements @foreach($allStatements as $statement)
Customer Statement
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
Currency: {{ $currency->code }}
Customer Information
Customer: {{ $statement['customer']->customer_account }}
Code: {{ $statement['customer']->customer_code }}
Address: {{ $statement['customer']->address }}
Email: {{ $statement['customer']->email }}
Phone: {{ $statement['customer']->phone }}
@if($statement['customer']->city)
City: {{ $statement['customer']->city }}
@endif @if($statement['customer']->province)
Province: {{ $statement['customer']->province }}
@endif @if($statement['customer']->vat)
VAT: {{ $statement['customer']->vat }}
@endif @if($statement['customer']->tin)
TIN: {{ $statement['customer']->tin }}
@endif
Currency: {{ $currency->code }}
Period: {{ $dateFrom }} to {{ $dateTo }}
Statement Date: {{ date('d M Y') }}
@php $balance = $statement['openingBalance']; $grandBalance = $balance; $hasOpeningBalance = false; @endphp @if(!$hasOpeningBalance) @php $hasOpeningBalance = true; @endphp @endif @foreach($statement['statementData'] as $row) @php $balance += ($row['dr'] - $row['cr']); $grandBalance = $balance; @endphp @endforeach
Date Description Reference DR CR Balance
{{ $dateFrom }} Opening Balance {{ number_format($balance > 0 ? $balance : 0, 2) }} {{ number_format($balance < 0 ? abs($balance) : 0, 2) }} @if($balance < 0) ({{ number_format(abs($balance), 2) }}) @else {{ number_format($balance, 2) }} @endif
{{ $row['date'] }} {{ $row['description'] }} {{ $row['reference'] }} {{ number_format($row['dr'], 2) }} {{ number_format($row['cr'], 2) }} @if($balance < 0) ({{ number_format(abs($balance), 2) }}) @else {{ number_format($balance, 2) }} @endif
Grand Total: @if($grandBalance < 0) ({{ number_format(abs($grandBalance), 2) }}) @else {{ number_format($grandBalance, 2) }} @endif
@endforeach