@extends('master.app') @section('title', 'Income Statement (P&L)') @section('body') @php $lang = $filters['lang'] ?? 'en'; $name = function($x) use ($lang){ if(!$x) return ''; if($lang==='ps') return $x->title_ps ?: ($x->title_en ?: ''); if($lang==='dr') return $x->title_dr ?: ($x->title_en ?: ''); return $x->title_en ?: ($x->title_ps ?: ''); }; $fmt = fn($n)=> number_format((float)$n,2); $net = (float)($totals['net'] ?? 0); // role meta for badges $roleMeta = function(string $role) { $role = strtolower($role); if($role==='revenue') return ['cls'=>'badge-soft-primary','icon'=>'fa-arrow-trend-up','label'=>'Revenue']; if($role==='cogs') return ['cls'=>'badge-soft-warning','icon'=>'fa-boxes-stacked','label'=>'COGS']; if($role==='opex') return ['cls'=>'badge-soft-secondary','icon'=>'fa-receipt','label'=>'OPEX']; if($role==='tax') return ['cls'=>'badge-soft-info','icon'=>'fa-landmark','label'=>'Taxes']; return ['cls'=>'badge-soft-dark','icon'=>'fa-layer-group','label'=>ucfirst($role)]; }; @endphp @push('styles') @endpush
{{-- Header --}}
Income Statement (P&L)
Period: {{ $from }} to {{ $to }} • Base currency
{{ $from }} → {{ $to }} {{ strtoupper($lang) }} Multi-currency
Revenue
{{ $fmt($totals['revenue'] ?? 0) }}
Sales - Returns
COGS
{{ $fmt($totals['cogs'] ?? 0) }}
Cost of goods sold
Gross Profit
{{ $fmt($totals['gross'] ?? 0) }}
Revenue + COGS
Net Profit / Loss
{{ $fmt($totals['net'] ?? 0) }}
After expenses & taxes
{{-- Filters --}}
Filters
Click each role card to expand details
Reset
{{-- Content --}}
@include('reporting.income_statement._section', ['sec'=>$revenue, 'role'=>'revenue', 'meta'=>$roleMeta('revenue'), 'name'=>$name]) @include('reporting.income_statement._section', ['sec'=>$cogs, 'role'=>'cogs', 'meta'=>$roleMeta('cogs'), 'name'=>$name]) @include('reporting.income_statement._section', ['sec'=>$opex, 'role'=>'opex', 'meta'=>$roleMeta('opex'), 'name'=>$name]) @include('reporting.income_statement._section', ['sec'=>$taxes, 'role'=>'tax', 'meta'=>$roleMeta('tax'), 'name'=>$name])
Summary
{{ $net>=0 ? 'Profit' : 'Loss' }}
Revenue
{{ $fmt($totals['revenue'] ?? 0) }}
COGS
{{ $fmt($totals['cogs'] ?? 0) }}
Gross Profit
{{ $fmt($totals['gross'] ?? 0) }}
Operating Expenses
{{ $fmt($totals['opex'] ?? 0) }}
Operating Profit
{{ $fmt($totals['op_profit'] ?? 0) }}
Taxes
{{ $fmt($totals['tax'] ?? 0) }}
Net Profit / Loss
{{ $fmt($totals['net'] ?? 0) }}
Notes: COGS from customer_bill_items.cost_total.
@endsection