@push('header') @endpush

Moon Traders
ROI Report
Period: {{ \Carbon\Carbon::parse($startDate)->format('d-M-Y') }} to {{ \Carbon\Carbon::parse($endDate)->format('d-M-Y') }} @if($filterSummary)
{{ $filterSummary }} @endif

Printed by: {{ auth()->user()->name }} | {{ now()->format('d-M-Y h:i A') }}

@foreach($matrixData['dates'] as $date) @endforeach @forelse($matrixData['products'] as $product) @foreach($matrixData['dates'] as $date) @php $count = $product['daily_data'][$date]['qty'] ?? 0; @endphp @endforeach @empty @endforelse {{-- Daily Totals (Optional? Leaving blank for layout clarity) --}} @foreach($matrixData['dates'] as $date) @endforeach
S.No SKU Category IP TP Margin{{ \Carbon\Carbon::parse($date)->format('j') }}Total Profit Sale
{{ $loop->iteration }}
{{ $product['product_name'] }}
{{ $product['category_name'] }} {{ number_format($product['ip'], 2) }} {{ number_format($product['tp'], 2) }} {{ number_format($product['margin'], 2) }} @if($count > 0) {{ $count + 0 }} @else 0 @endif {{ $product['totals']['total_sold_qty'] + 0 }} {{ number_format($product['totals']['net_profit'], 2) }} {{ number_format($product['totals']['total_sale'], 2) }}
No data found for the selected criteria.
Grand Totals:{{ $matrixData['grand_totals']['sold_qty'] + 0 }} {{ number_format($matrixData['grand_totals']['net_profit'], 2) }} {{ number_format($matrixData['grand_totals']['sale_amount'], 2) }}

Category Summary

@foreach($categorySummary as $cat) @endforeach
Sr # Category Qty Sale Share % Profit Mrg %
{{ $loop->iteration }} {{ $cat['name'] }} {{ $cat['count'] }} {{ number_format($cat['total_sale'], 2) }} {{ number_format($cat['sales_share'], 1) }}% {{ number_format($cat['total_profit'], 2) }} {{ number_format($cat['profit_margin'], 1) }}%

Expense Analysis

@forelse($expenseBreakdown as $expense) @empty @endforelse
Sr # Account Code Amount
{{ $loop->iteration }} {{ $expense->account_name }} {{ $expense->account_code }} {{ number_format($expense->total_amount, 2) }}
No Expenses Recorded
Total Expenses: {{ number_format($matrixData['grand_totals']['expenses'], 2) }}

Financial Summary

@php $gt = $matrixData['grand_totals']; $sales = $gt['sale_amount']; $cogs = $gt['cogs']; $gp = $gt['gross_profit']; $exp = $gt['expenses']; $np = $gt['net_profit']; $qty = $gt['sold_qty']; $gpMargin = $sales > 0 ? ($gp / $sales) * 100 : 0; $npMargin = $sales > 0 ? ($np / $sales) * 100 : 0; $expRatio = $sales > 0 ? ($exp / $sales) * 100 : 0; $avgTxnValue = $qty > 0 ? ($sales / $qty) : 0; $costPerUnit = $qty > 0 ? ($exp / $qty) : 0; // OR maybe Cost Per Unit = COGS / Qty? Usually Cost per Unit implies COGS. // Let's call it "Exp / Unit" for clarity if referring to expenses. // User asked "Cost Per Unit" in plan -> usually COGS per unit. // Let's add "Avg Item Price" (TP) and "Avg Item Cost" (IP) $avgPrice = $qty > 0 ? ($sales / $qty) : 0; $avgCost = $qty > 0 ? ($cogs / $qty) : 0; @endphp
Sr # Metric Amount
1 Total Sales {{ number_format($sales, 2) }}
2 Total COGS ({{ number_format($cogs, 2) }})
3 Gross Profit {{ number_format($gp, 2) }} ({{ number_format($gpMargin, 1) }}%)
4 Allocated Expenses ({{ number_format($exp, 2) }}) ({{ number_format($expRatio, 1) }}%)
5 Net Profit {{ number_format($np, 2) }} ({{ number_format($npMargin, 1) }}%)
A Avg Selling Price {{ number_format($avgPrice, 2) }}
B Avg Cost Price {{ number_format($avgCost, 2) }}