@extends('master.app') @section('title', 'Customer Overview') @section('pageCSS') @endsection @section('body')
{{-- Header --}}

{{ $customer->name }}

{{ $customer->phone }} • {{ $customer->address }}
{{-- KPI Cards --}}
{{-- Total Sale --}}
Total Sale
@foreach ($currencies as $c)
{{ $c->title_en }} {{ number_format((float) ($saleTotals[$c->id] ?? 0), 2) }}
@endforeach
{{-- Total Received --}}
Total Received
@foreach ($currencies as $c)
{{ $c->title_en }} {{ number_format((float) ($receivedTotals[$c->id] ?? 0), 2) }}
@endforeach
{{-- Total Advance --}}
Total Advance
@foreach ($currencies as $c)
{{ $c->title_en }} {{ number_format((float) ($advanceTotals[$c->id] ?? 0), 2) }}
@endforeach
{{-- Balance --}}
Balance
@foreach ($currencies as $c) @php $sale = (float) ($saleTotals[$c->id] ?? 0); $recv = (float) ($receivedTotals[$c->id] ?? 0); $adv = (float) ($advanceTotals[$c->id] ?? 0); $bal = $sale - ($recv + $adv); @endphp
{{ $c->title_en }} {{ number_format($bal, 2) }}
@endforeach Balance = Sale - (Received + Advance)
{{-- Recent Transactions Overview --}}
Recent Invoices Last 8
@forelse($recentBills as $i => $r) @empty @endforelse
# Date Title Amount
{{ $i + 1 }} {{ $r->invoice_date ?? ($r->date ?? '-') }} {{ $r->title ?? '-' }} {{ number_format((float) ($r->final_amount ?? ($r->grand_total ?? 0)), 2) }} {{ optional($r->currency)->title_en ?? '' }}
No data
Recent Received Last 8
@forelse($recentReceived as $i => $r) @empty @endforelse
# Date Ref Amount
{{ $i + 1 }} {{ $r->date ?? '-' }} {{ $r->recieved_number ?? ($r->details ?? '-') }} {{ number_format((float) ($r->amount ?? 0), 2) }} {{ optional($r->currency)->title_en ?? '' }}
No data
Recent Advance Last 8
@forelse($recentAdvance as $i => $r) @empty @endforelse
# Date Title Amount
{{ $i + 1 }} {{ $r->date ?? '-' }} {{ $r->title ?? '-' }} {{ number_format((float) ($r->amount ?? 0), 2) }} {{ optional($r->currency)->title_en ?? '' }}
No data
Recent Return Last 8
@forelse($recentReturn as $i => $r) @empty @endforelse
# Date Title Amount
{{ $i + 1 }} {{ $r->invoice_date ?? ($r->date ?? '-') }} {{ $r->title ?? '-' }} {{ number_format((float) ($r->amount ?? 0), 2) }} {{ optional($r->currency)->title_en ?? '' }}
No data
{{-- Charts --}}
Sale (Monthly) Last 12 months
Received (Monthly) Last 12 months
Advance (Monthly) Last 12 months
Return (Monthly) Last 12 months
Balance (Monthly) Sale - (Received + Advance)
@endsection @section('pageJs') @endsection