@extends('layouts.app') @section('title', 'Profit & Loss - ' . setting('system_name')) @section('content') @php $money = fn ($v, $d = 0) => $currency . ' ' . number_format((float) $v, $d); $netProfitStatus = $netProfit < 0 ? 'danger' : ($netMargin >= 15 ? 'success' : ($netMargin >= 5 ? 'warning' : 'danger')); $grossMarginStatus = $grossMargin >= 30 ? 'success' : ($grossMargin >= 20 ? 'warning' : 'danger'); $canRecordExpenses = auth()->user()->hasPermission('add_expense') || auth()->user()->hasPermission('access_all_expenses'); $expensesUrl = route('expenses.index', ['from' => $fromDateDisplay, 'to' => $toDateDisplay]); @endphp {{-- Change against the previous period; null means there is nothing to compare with --}} @php $delta = function ($value, $onDark = false) use ($comparisonLabel) { if ($value === null) { return 'No earlier data to compare'; } $up = $value >= 0; $cls = $onDark ? 'bg-white text-dark' : ($up ? 'bg-success-subtle text-success' : 'bg-danger-subtle text-danger'); return ' ' . abs($value) . '% ' . e($comparisonLabel) . ''; }; @endphp

Profit & Loss

{{ $fromDateLabel }} – {{ $toDateLabel }} · {{ setting('system_name') }}

to
@include('partials.pdf-button', ['class' => 'btn btn-danger btn-sm shadow-sm'])
@if($operatingExpenses == 0)
No expenses recorded for this period. Net profit below does not yet include running costs such as rent, wages and electricity.
@if($canRecordExpenses) Record expenses @endif
@endif
Net Profit
{{ $money($netProfit) }}
{{ $netMargin }}% of sales kept as profit
{!! $delta($deltas['net_profit'], true) !!}
Sales
{{ $money($totalSales) }}
{{ number_format($totalTransactions) }} {{ $totalTransactions == 1 ? 'sale' : 'sales' }} · average {{ $money($totalTransactions > 0 ? $totalSales / $totalTransactions : 0) }}
{!! $delta($deltas['revenue']) !!}
Gross Profit {{ $grossMargin }}% margin
{{ $money($grossProfit) }}
Sales minus what the goods cost you
{!! $delta($deltas['gross_profit']) !!}
Expenses & Losses
{{ $money($operatingExpenses + $stockWrittenOff) }}
Running costs{{ $money($operatingExpenses) }}
Stock written off{{ $money($stockWrittenOff) }}
@if($canRecordExpenses) View or record expenses @endif
Stock value
Quantities on each date × each product's purchase / selling price
Opening stock by purchase price
{{ $money($openingStockCost) }}
on {{ $fromDateLabel }}
Opening stock by selling price
{{ $money($openingStockRetail) }}
on {{ $fromDateLabel }}
Closing stock by purchase price
{{ $money($closingStockCost) }}
{{ $toDate->isFuture() ? 'today' : 'on ' . $toDateLabel }}
Closing stock by selling price
{{ $money($closingStockRetail) }}
{{ $money($closingStockRetail - $closingStockCost) }} profit if all sold
Profit & Loss Statement
@foreach($writeOffsByReason as $reason => $amount) @endforeach @foreach($expensesByCategory as $category => $amount) @endforeach
Sales revenue ({{ number_format($totalTransactions) }} sales){{ $money($totalSales, 2) }}
Less: cost of goods sold− {{ $money($costOfGoodsSold, 2) }}
Gross profit ({{ $grossMargin }}%){{ $money($grossProfit, 2) }}
Less: stock written off− {{ $money($stockWrittenOff, 2) }}
{{ $reason }}{{ $money($amount, 2) }}
Less: running costs− {{ $money($operatingExpenses, 2) }}
{{ $category }}{{ $money($amount, 2) }}
Net profit ({{ $netMargin }}%) {{ $money($netProfit, 2) }}

Cost of goods uses the purchase price recorded at the time of each sale. Written-off stock is valued at its purchase price.

Last 6 months
Most profitable products
@forelse($topProducts as $product) @empty @endforelse
Product Sold Sales Profit Margin
{{ $product['name'] }} {{ number_format($product['qty']) }} {{ $money($product['revenue']) }} {{ $money($product['profit']) }} {{ $product['margin'] }}%
No sales in this period.
Money received by method

Split payments are counted per method; change given back is excluded.

@if(count($paymentBreakdown))
@foreach($paymentBreakdown as $row) @endforeach
{{ $row['method'] }} {{ $row['count'] }} {{ $row['count'] == 1 ? 'payment' : 'payments' }} {{ $money($row['total']) }}
@else

No payments in this period.

@endif
Profit by category
@forelse($categoryMargins as $cat => $data)
{{ $cat }}
Sales {{ $money($data['revenue']) }}
{{ $money($data['profit']) }}
{{ $data['margin'] }}% margin
@empty

No sales in this period.

@endforelse
Stock movement (at cost)
@if($otherStockChanges != 0) @endif
At start ({{ \Carbon\Carbon::parse($fromDateDisplay)->format('d M') }}){{ $money($openingStockCost) }}
+ Received{{ $money($stockReceived) }}
− Sold (at cost){{ $money($costOfGoodsSold) }}
− Written off{{ $money($stockWrittenOff) }}
{{ $otherStockChanges > 0 ? '+' : '−' }} Other changes {{ $money(abs($otherStockChanges)) }}
At end ({{ \Carbon\Carbon::parse($toDateDisplay)->format('d M') }}){{ $money($closingStockCost) }}
@if($totalPurchase > 0)
Supplier invoices this period{{ $money($totalPurchase) }}
@endif @if($stockInByAdjustment > 0)
Stock bought in (adjustments){{ $money($stockInByAdjustment) }}
@endif
Value at selling price{{ $money($closingStockRetail) }}
Units in stock{{ number_format($totalStockUnits) }}
Stock turnover this period{{ number_format($inventoryTurnover, 2) }}×
Not selling
No sales in 30 days

{{ $money($slowMovingValue) }} of cash is tied up in stock that has not sold in 30 days.

@forelse($slowMovingProducts as $item) @empty @endforelse
{{ $item->name }} {{ number_format($item->current_stock) }} units {{ $money($item->current_stock * $item->purchase_price) }}
Everything in stock has sold in the last 30 days.
@endsection