@extends('layouts.app') @section('title','Profit & Loss Report') @section('page_title','Profit & Loss') @section('content') @include('reports.partials.print-header',['reportTitle'=>'Profit & Loss Report','reportSubtitle'=>\Carbon\Carbon::parse($dateFrom)->format('d M Y').' — '.\Carbon\Carbon::parse($dateTo)->format('d M Y')])

Profit & Loss Report

Overview of your financial performance for the selected period.

Back to Reports
@php $profitBars = [ ['label'=>'Total Sales','short'=>'Total Sales','value'=>$summary['sales'],'tone'=>'blue'], ['label'=>'Cost of Goods Sold','short'=>'COGS','value'=>$summary['cogs'],'tone'=>'cyan'], ['label'=>'Gross Profit','short'=>'Gross Profit','value'=>$summary['gross_profit'],'tone'=>'purple'], ['label'=>'Expenses','short'=>'Expenses','value'=>$summary['expenses'],'tone'=>'red'], ['label'=>'Net Profit','short'=>'Net Profit','value'=>$summary['net_profit'],'tone'=>$summary['net_profit']>=0?'green':'red'], ]; $profitChartMax = max(1, ...array_map(fn($bar)=>abs((float)$bar['value']), $profitBars)); $profitAxis = [$profitChartMax, $profitChartMax*.75, $profitChartMax*.5, $profitChartMax*.25, 0]; $profitAxisLabel = fn($value) => abs($value) >= 1000000 ? rtrim(rtrim(number_format($value / 1000000, 1), '0'), '.').'M' : (abs($value) >= 1000 ? rtrim(rtrim(number_format($value / 1000, 1), '0'), '.').'K' : tzs_amount($value)); @endphp
Financial Performance

Profit & Loss Overview

Financial performance for the selected period

@foreach($profitBars as $bar){{ $bar['short'] }}@endforeach
@endsection