@extends('layouts.app') @section('title', $client->name) @section('content') @php $balance = $client->balance(); $limit = (float) $client->credit_limit; $usePct = $limit > 0 ? min(100, round(max(0, $balance) / $limit * 100)) : 0; @endphp

{{ $client->name }}

@if ($client->location()){{ $client->location() }}@endif @if ($client->phone){{ $client->phone }}@endif @if ($client->email){{ $client->email }}@endif {{ $client->is_active ? 'Active' : 'Inactive' }}
@can('orders.create') New order @endcan @can('payments.create') Receive payment @endcan @can('clients.edit') Edit @endcan @can('clients.delete') @endcan
Total billed
{{ money($client->billed()) }}
Received
{{ money($client->received()) }}
Balance due
{{ money($balance) }}
@if ($limit > 0)
{{ $usePct }}% of {{ money($limit) }} credit limit
@endif
Details
Contact
{{ $client->contact_person ?: '—' }}
Tax ID
{{ $client->tax_number ?: '—' }}
Billing
{!! nl2br(e($client->billing_address ?: '—')) !!}
Shipping
{!! nl2br(e($client->shipping_address ?: '—')) !!}
@if ($client->notes)
Notes
{!! nl2br(e($client->notes)) !!}
@endif
@can('orders.view')
Recent ordersView all
    @forelse ($orders->take(5) as $o)
  • {{ $o->order_no }}{{ $o->order_date->format('d M Y') }}
    {{ money($o->total) }}
  • @empty
  • No orders yet.
  • @endforelse
@endcan
@can('orders.view')
@forelse ($orders as $o) @empty @endforelse
OrderDateDeliveryStatusTotalPaymentDue
{{ $o->order_no }} {{ $o->order_date->format('d M Y') }} {{ $o->delivery_date?->format('d M Y') ?? '—' }} {{ money($o->total) }} {{ $o->isCancelled() ? '—' : money($o->due()) }}
New order
@endcan @can('payments.view')
@forelse ($payments as $p) @empty @endforelse
DateAgainstMethodReferenceAmount
{{ $p->paid_on->format('d M Y') }} @if ($p->order){{ $p->order->order_no }}@elseOn account@endif {{ \App\Models\Payment::METHODS[$p->method] ?? $p->method }} {{ $p->reference ?: '—' }} +{{ money($p->amount) }}
Receive payment
@endcan @can('payments.view')
Account statementFrom the general ledger · every line is a journal entry
@forelse ($statement as $r) @empty @endforelse @if ($statement->isNotEmpty())@endif
DateEntryReferenceDescriptionBilledReceivedBalance
{{ $r['date']->format('d M Y') }} {{ $r['entry'] }} {{ $r['ref'] }} {{ $r['desc'] }} {{ $r['debit'] ? money($r['debit']) : '' }} {{ $r['credit'] ? money($r['credit']) : '' }} {{ money($r['balance']) }}
Balance due{{ money($statement->last()['balance']) }}
@endcan
@endsection