@extends('layouts.app') @section('title', 'Profit by Product') @section('breadcrumb') @endsection @section('content') @include('reports.partials.date-filter')
৳{{ number_format($summary->revenue,0) }}
Revenue
৳{{ number_format($summary->cogs,0) }}
COGS
৳{{ number_format($summary->profit,0) }}
Gross Profit
Product Profit Analysis ({{ $items->total() }} products)
@php $maxProfit = $items->max('profit') ?: 1; @endphp @foreach($items as $i => $item) @endforeach
#ProductQty SoldRevenueCOGSProfitMarginBar
{{ ($items->currentPage()-1)*$items->perPage()+$i+1 }}
{{ $item->productVariant?->product?->name ?? '—' }}
{{ $item->productVariant?->variant_name }}
{{ number_format($item->total_qty) }} ৳{{ number_format($item->revenue,0) }} ৳{{ number_format($item->cogs,0) }} ৳{{ number_format($item->profit,0) }} @php $margin = $item->revenue > 0 ? ($item->profit/$item->revenue)*100 : 0; @endphp {{ number_format($margin,1) }}% @php $barW = $maxProfit > 0 ? min(100, ($item->profit/$maxProfit)*100) : 0; @endphp
Totals: ৳{{ number_format($summary->revenue,0) }} ৳{{ number_format($summary->cogs,0) }} ৳{{ number_format($summary->profit,0) }}
@if($items->hasPages())@endif
@endsection