@php /** * Month-End Summary pack (FRS §7) as a branded document. Same figures as * /month-end, same order; this is the copy that gets handed to a director or * an accountant. $preview = true renders for an on-screen browser view. */ $preview = $preview ?? false; $accent = $setting?->primary_color ?: '#124a61'; $ink = '#111827'; $muted = '#6b7280'; $soft = '#9ca3af'; $line = '#e5e7eb'; $wash = '#f8fafc'; $good = '#047857'; $bad = '#be123c'; $font = $setting?->font_family ? $setting->font_family.', Arial, sans-serif' : 'Arial, Helvetica, sans-serif'; $logoData = null; if ($setting?->logo_path) { try { $logoFull = \Illuminate\Support\Facades\Storage::disk('public')->path($setting->logo_path); if (is_file($logoFull)) { $logoData = 'data:'.(mime_content_type($logoFull) ?: 'image/png').';base64,'.base64_encode(file_get_contents($logoFull)); } } catch (\Throwable $e) { $logoData = null; } } $companyName = $setting?->company_name ?: $team?->name; $base = $pack['base']; $money = fn ($v) => trim(($symbol ?: ($base.' ')).number_format((float) $v, 2)); $signed = fn ($v) => ((float) $v >= 0 ? '+ ' : '− ').trim(($symbol ?: ($base.' ')).number_format(abs((float) $v), 2)); $income = $pack['income']; $bridge = $pack['bridge']; $profit = $pack['profit']; $cash = $pack['cash']; $equity = $pack['equity']; $snapshot = $pack['snapshot']; @endphp {{ __('Month-End Pack') }}, {{ $pack['period']['label'] }} {{-- A closed month is a signed-off month; the document says so on every page. --}} @if ($pack['is_closed'])
{{ __('Closed') }}
@endif
@if ($logoData) @else
{{ $companyName }}
@endif
@if ($logoData){{ $companyName }}
@endif @if ($setting?->address){{ $setting->address }}
@endif @if ($setting?->phone){{ $setting->phone }}@endif @if ($setting?->email) · {{ $setting->email }}@endif @if ($setting?->tin_number)
{{ __('TIN') }}: {{ $setting->tin_number }}@endif
{{ __('Month-End Summary') }}
{{ __('Period') }}: {{ $pack['period']['label'] }}
{{ __('Prepared') }}: {{ $preparedOn->format('d M Y, H:i') }}
{{ $base }}
{{-- Period status --------------------------------------------------- --}} @if ($pack['is_closed'])
{{ __('Period closed') }} — {{ __('closed by :who on :when. The cash figures below are read from the frozen snapshot, not recomputed.', [ 'who' => $snapshot->closer?->name ?? __('the system'), 'when' => optional($snapshot->locked_at)->timezone(config('app.display_timezone'))->format('j M Y, H:i') ?? '—', ]) }}
@else
{{ __('Period open') }} — {{ __('these figures are provisional. Anything back-dated into :month still changes them.', ['month' => $pack['period']['label']]) }} @if ($snapshot?->reopened_at) {{ __('This month was reopened by :who: “:reason”.', [ 'who' => $snapshot->reopener?->name ?? __('an administrator'), 'reason' => $snapshot->reopen_reason ?: __('no reason given'), ]) }} @endif
@endif {{-- Headline ---------------------------------------------------------- --}}
{{ __('Gross Sales') }}
{{ $money($income['gross_sales']) }}
{{ __('Invoiced') }}
{{ __('Cash Collected') }}
{{ $money($profit['cash_collected']) }}
{{ __('Mgmt revenue') }}
{{ __('Gross Profit') }}
{{ $money($profit['gross_profit']) }}
{{ number_format($profit['gross_margin_pct'], 1) }}% {{ __('margin') }}
{{ __('Net Profit') }}
{{ $money($profit['net_profit']) }}
{{ number_format($profit['net_margin_pct'], 1) }}% {{ __('margin') }}
{{ __('Closing Cash') }}
{{ $money($cash['closing']) }}
{{ $cash['source'] === 'snapshot' ? __('Frozen') : __('Live') }}
{{-- The bridge -------------------------------------------------------- --}} @foreach ($bridge['steps'] as $step) @endforeach @if (abs($bridge['residual']) >= 0.01) @endif
{{ __('Gross Sales → Cash Collected') }}
{{ __('Gross Sales (invoiced)') }} {{ __('Total value of invoices raised in the month. This is what "Gross Sales" means on the directors\' sheet.') }} {{ $money($bridge['gross_sales']) }}
{{ $step['label'] }}{{ $step['hint'] }} {{ $signed($step['amount']) }}
{{ __('Cash Collected (management revenue)') }} {{ __('The revenue basis behind every profit figure in this pack.') }} {{ $money($bridge['cash_collected']) }}
{{ __('Unreconciled difference, please report this') }} {{ $money($bridge['residual']) }}
{{-- 1 · Income + 3 · Profit ------------------------------------------- --}}
@if ($income['refunds_paid'] > 0) @endif
{{ __('1 · Income') }}
{{ __('Gross Sales (invoiced)') }} {{ $money($income['gross_sales']) }}
{{ __('Deposits Received') }}{{ __('First payment on an invoice') }} {{ $money($income['deposits_received']) }}
{{ __('Balances Received') }}{{ __('Every later payment') }} {{ $money($income['balances_received']) }}
{{ __('Sales cash collected (gross)') }} {{ $money($income['gross_collected']) }}
{{ __('Less: refunds paid') }} − {{ $money($income['refunds_paid']) }}
{{ __('Other Income') }}{{ __('Rent, WiFi, services') }} {{ $money($income['other_income']) }}
{{ __('Total money in') }} {{ $money($income['total_received']) }}
@if ($profit['other_opex'] != 0.0) @endif @if ($profit['cancelled_costs'] != 0.0) @endif
{{ __('3 · Profit') }}
{{ __('Cash Collected') }} {{ $money($profit['cash_collected']) }}
{{ __('Less: cost of sales') }} − {{ $money($profit['cogs']) }}
{{ __('Gross Profit') }}{{ number_format($profit['gross_margin_pct'], 1) }}% {{ __('margin') }} {{ $money($profit['gross_profit']) }}
{{ __('Less: overheads') }} − {{ $money($profit['overheads']) }}
{{ __('Less: other operating costs') }} − {{ $money($profit['other_opex']) }}
{{ __('Less: costs on cancelled sales') }} − {{ $money($profit['cancelled_costs']) }}
{{ __('Net Profit') }}{{ number_format($profit['net_margin_pct'], 1) }}% {{ __('margin') }} {{ $money($profit['net_profit']) }}
{{-- 2 · Expenses ------------------------------------------------------ --}} @foreach ($pack['expenses']['lines'] as $l) @endforeach
{{ __('2 · Expenses recorded') }}
{{ __('Line') }} {{ __('Categories included') }} {{ __('Amount') }}
{{ $l['label'] }} {{ $l['categories'] ? implode(', ', array_keys($l['categories'])) : '—' }} {{ $money($l['amount']) }}
{{ __('Total expenses recorded') }} {{ $money($pack['expenses']['total']) }}
{{ __('This total does not equal the costs in the Profit block, and is not meant to. The profit and loss takes production cost from the job cost ledger and overheads from the agreed monthly run rate; this table is every expense keyed against the month.') }}
{{-- 4 · Cash ---------------------------------------------------------- --}}
{{ __('4 · Cash') }}
{{ __('Opening') }} {{ __('In') }} {{ __('Out') }} {{ __('Closing') }}
{{ $money($cash['opening']) }} {{ $money($cash['in']) }} {{ $money($cash['out']) }} {{ $money($cash['closing']) }}
{{-- 5 · Receivables / Payables ---------------------------------------- --}} @foreach ([['receivables', __('5 · Receivables')], ['payables', __('6 · Payables')]] as $i => $side) @php $d = $pack[$side[0]]; @endphp @endforeach
@foreach ($buckets as $key => $label) @endforeach
{{ $side[1] }}
{{ $label }}{{ $key === 'current' ? '' : ' '.__('days') }} {{ $money($d['bucketTotals'][$key]) }}
{{ __('Total outstanding') }}{{ __('Of which overdue') }}: {{ $money($d['overdue']) }} {{ $money($d['grandTotal']) }}
{{-- 7 · Inventory / 8 · Owner equity ---------------------------------- --}}
{{ __('7 · Inventory Summary') }}
{{ __('Stock Value') }}{{ __('On hand × weighted average cost') }} {{ $money($pack['inventory']['stock_value']) }}
{{ __('Stocked items') }} {{ number_format($pack['inventory']['variant_count']) }}
{{ __('Out of stock') }} {{ number_format($pack['inventory']['out_of_stock']) }}
{{ __('8 · Owner Equity') }}
{{ __('Capital Contributions') }}{{ __('Put in this month') }} {{ $money($equity['contributions']) }}
{{ __('Owner Drawings') }}{{ __('Taken out this month') }} − {{ $money($equity['drawings']) }}
{{ __('Net movement this month') }} {{ $money($equity['net']) }}
{{ __('Net owner capital to date') }} {{ $money($equity['net_to_date']) }}
{{ __('A drawing is money the owners took out of the business. It is not an expense and never touches profit; it reduces the owners\' stake.') }}
{{-- 9 · Authorised adjustments ---------------------------------------- --}} @if ($pack['adjustments']['rows']->isNotEmpty()) @foreach ($pack['adjustments']['rows'] as $adj) @endforeach
{{ __('9 · Authorised Adjustments') }}
{{ __('Account') }} {{ __('Reason') }} {{ __('Approved by') }} {{ __('Effect on profit') }}
{{ $adj->account_label }} {{ $adj->reason }} {{ $adj->approver?->name ?? '—' }} {{ $signed($adj->signedAmount()) }}
{{ __('Net adjustment') }} {{ $signed($pack['adjustments']['net']) }}
{{ __('Corrections booked against this month after it was closed. The frozen figures above are left exactly as they were; these are the reconciling lines on top of them.') }}
@endif
{{ __('All amounts are in :code.', ['code' => $base]) }} {{ __('Receivables, payables and inventory are point in time, as at the preparation date; every other figure belongs to :month.', ['month' => $pack['period']['label']]) }}
{{ $companyName }} · {{ __('Month-End Summary') }} · {{ $pack['period']['label'] }} {{ __('Prepared') }} {{ $preparedOn->format('d M Y, H:i') }}