@extends('dashboard.layouts.app') @section('content') @include('components.alert') @php $money = function ($value, bool $dashZero = false) { if ($value === null) { return '-'; } $value = round((float) $value, 2); if (abs($value) < 0.00001) { return $dashZero ? '-' : '0.00'; } return number_format($value, 2); }; $percent = fn ($value) => $value === null ? '-' : number_format((float) $value, 1) . '%'; $ratio = fn ($value) => $value === null ? '-' : number_format((float) $value, 2) . 'x'; $signedClass = fn ($value) => (float) $value < 0 ? 'fi-text-danger' : 'fi-text-success'; $cards = [ [ 'title' => 'Revenue', 'value' => $money($kpis['revenue']), 'hint' => 'Recognized revenue in this period', 'tone' => 'success', 'card_key' => 'fi_revenue', 'expected' => $kpis['revenue'], ], [ 'title' => 'Total Cost', 'value' => $money($kpis['total_cost']), 'hint' => 'Posted accounting record costs in this period', 'tone' => 'danger', 'card_key' => 'fi_total_cost', 'expected' => $kpis['total_cost'], ], [ 'title' => 'Net Profit', 'value' => $money($kpis['net_profit']), 'hint' => 'Revenue minus total costs', 'tone' => $kpis['net_profit'] < 0 ? 'danger' : 'success', 'card_key' => 'fi_net_profit', 'expected' => $kpis['net_profit'], ], [ 'title' => 'Gross Profit', 'value' => $money($kpis['gross_profit']), 'hint' => 'Revenue minus cost of revenue', 'tone' => $kpis['gross_profit'] < 0 ? 'danger' : 'success', 'card_key' => 'fi_gross_profit', 'expected' => $kpis['gross_profit'], ], [ 'title' => 'Net Profit Margin', 'value' => $percent($kpis['net_profit_margin']), 'hint' => 'Net profit as a percentage of revenue', 'tone' => $kpis['net_profit_margin'] !== null && $kpis['net_profit_margin'] < 0 ? 'danger' : 'success', 'card_key' => null, 'expected' => null, ], [ 'title' => 'Gross Profit Margin', 'value' => $percent($kpis['gross_profit_margin']), 'hint' => 'Gross profit as a percentage of revenue', 'tone' => $kpis['gross_profit_margin'] !== null && $kpis['gross_profit_margin'] < 0 ? 'danger' : 'success', 'card_key' => null, 'expected' => null, ], [ 'title' => 'Debt to Equity', 'value' => $ratio($kpis['debt_to_equity']), 'hint' => 'Liabilities compared to equity', 'tone' => 'neutral', 'card_key' => null, 'expected' => null, ], [ 'title' => 'Return on Equity', 'value' => $percent($kpis['return_on_equity']), 'hint' => 'Profit generated from equity', 'tone' => $kpis['return_on_equity'] !== null && $kpis['return_on_equity'] < 0 ? 'danger' : 'success', 'card_key' => null, 'expected' => null, ], [ 'title' => 'Break-even Point', 'value' => $money($kpis['break_even_point']), 'hint' => 'Revenue needed to cover fixed costs', 'tone' => 'neutral', 'card_key' => null, 'expected' => null, ], ]; @endphp
Financial Indicators

A quick view of profitability, break-even, and course performance.

Export
Reset
@foreach($cards as $card) @if($card['card_key'])
{{ $card['title'] }}
{{ $card['value'] }}
{{ $card['hint'] }}
@else
{{ $card['title'] }}
{{ $card['value'] }}
{{ $card['hint'] }}
@endif @endforeach
@php $progress = $kpis['break_even_progress']; $progressWidth = $progress === null ? 0 : max(min($progress, 100), 0); $isCovered = $kpis['break_even_point'] !== null && $kpis['revenue'] >= $kpis['break_even_point']; @endphp
Break-even Progress

Current revenue compared with the revenue needed to cover fixed costs.

{{ $progress === null ? '-' : number_format($progress, 0) . '%' }}
Revenue: {{ $money($kpis['revenue']) }} Break-even: {{ $money($kpis['break_even_point']) }} {{ $isCovered ? 'Covered' : 'Not covered yet' }}
@if ($courseProfitabilityVisible)
Course Profitability

Recognized revenue and direct purchase costs by course.

@forelse($courseRows as $row) @empty @endforelse
Course Sessions Revenue Direct Cost Gross Profit Margin Cost / Session
{{ $row['course_name'] }} {{ $row['course_meta'] ?: 'Course #' . $row['course_id'] }}
{{ $row['sessions_done'] }}/{{ $row['sessions_total'] }} {{ $money($row['recognized_revenue']) }} {{ $money($row['direct_cost'], true) }} {{ $money($row['gross_profit']) }} {{ $percent($row['margin']) }} {{ $money($row['cost_per_session'], true) }}
No course data found for this period.
Total {{ $courseTotals['sessions_done'] }}/{{ $courseTotals['sessions_total'] }} {{ $money($courseTotals['recognized_revenue']) }} {{ $money($courseTotals['direct_cost'], true) }} {{ $money($courseTotals['gross_profit']) }} {{ $percent($courseTotals['margin']) }} {{ $money($courseTotals['cost_per_session'], true) }}
@endif
{{-- ── Drilldown Modal ──────────────────────────────────────────────────── --}} @push('styles') @endpush @push('scripts') @endpush @endsection