@php $sym = $symbol ?: ''; $cur = fn ($m) => $sym . number_format(((int) $m) / 100, 2, '.', ','); @endphp
{{ __('Admin') }} {{ __('BSP Billing') }}
{{ __('This month') }} · {{ $totals['from']->format('d M') }} – {{ $totals['to']->format('d M') }}

{{ __('Reseller') }} {{ __('P&L') }}.

{{ __('Every billed message is a wallet charge. Revenue is what your customers paid; Meta cost is what Meta bills you; the gap is your margin. Prices & costs are set on') }} {{ __('Wallet rules') }}.

{{-- P&L KPIs --}}
@php $kpis = [ ['Revenue (charged)', $cur($totals['revenue_minor']), 'text-ink-900'], ['Meta cost', $cur($totals['cost_minor']), 'text-ink-700'], ['Margin (profit)', $cur($totals['margin_minor']), 'text-wa-deep'], ['Wallet float held', $cur($totals['wallet_float_minor']), 'text-ink-900'], ]; @endphp @foreach ($kpis as [$label, $val, $cls])
{{ __($label) }}
{{ $val }}
@endforeach
{{ __('Billed messages') }}
{{ number_format($totals['messages']) }}
{{ __('No Meta cost set') }}
{{ number_format($totals['unpriced_msgs']) }}
@if ($totals['unpriced_msgs'] > 0)
{{ __(':n billed message(s) had no Meta cost set for their country/category, so their margin is counted as pure revenue. Add those rows on', ['n' => number_format($totals['unpriced_msgs'])]) }} {{ __('Wallet rules → Sync Meta costs') }}.
@endif {{-- Per-workspace P&L --}}
{{ __('Per-workspace (this month)') }}
@forelse ($rows as $r) @empty @endforelse
{{ __('Workspace') }} {{ __('Msgs') }} {{ __('Revenue') }} {{ __('Meta cost') }} {{ __('Margin') }} {{ __('Wallet balance') }}
{{ $r['workspace_name'] }} {{ number_format($r['messages']) }} {{ $cur($r['revenue_minor']) }} {{ $cur($r['cost_minor']) }} {{ $cur($r['margin_minor']) }} {{ $cur(((int) $r['credits_left']) * \App\Services\MessageCreditRate::minorPerCredit()) }}
{{ __('No billed messages this month yet.') }}