@extends('layouts.admin') @section('title', 'Accounts') @section('content') @php $canEdit = (bool) auth()->user()?->hasPermission('accounting.edit'); $chartMax = max([1, ...array_map(fn ($m) => max($m['incoming_cents'], $m['outgoing_cents']), $trend)]); $spend = ['Order costs (COGS)' => $totals['order_costs_cents'], ...$totals['expenses_by_category']]; arsort($spend); $spend = array_filter($spend); $spendMax = max([1, ...array_values($spend)]); $compact = fn (int $cents): string => abs($cents) >= 100000 ? number_format(abs($cents) / 100000, 1).'k' : number_format(abs($cents) / 100); @endphp @if($canEdit) Income Expense @endif @include('admin.accounts.partials.period') @include('admin.accounts.partials.kpis')

Last 12 months

Incoming vs outgoing each month

Incoming Outgoing
@foreach($trend as $month)
{{ \Illuminate\Support\Str::before($month['label'], ' ') }}
{{ $month['profit_cents'] === 0 ? '—' : ($month['profit_cents'] < 0 ? '−' : '').$compact($month['profit_cents']) }}
@endforeach

Where the money goes

{{ $period['label'] }}

All outgoing
@forelse($spend as $name => $cents)
{{ $name }}{{ $accounts->money($cents) }}
@empty

Nothing spent in this period yet.

@endforelse

Latest entries

Income and expenses you've recorded

    @forelse($recentEntries as $entry)
  • {{ $entry->description }}
    {{ $entry->entry_date->format('j M Y') }} · {{ $entry->category }}
    {{ $entry->isExpense() ? '−' : '+' }}{{ $accounts->money($entry->amount_cents) }}
  • @empty
  • No entries yet. Add your first expense to start tracking profit.
  • @endforelse
@endsection