@extends('layouts.finance') @section('title', 'Revenue Detail') @section('subtitle', 'Paid Examism voucher order revenue for the current month') @section('content') @php $displayCurrency = 'PKR'; $fmt = fn($usd) => $metrics->moneyIn($usd, 'USD', $displayCurrency); $profitDetails = $profitDetails ?? ['summary' => [], 'products' => collect(), 'recent_orders' => collect()]; $profitSummary = $profitDetails['summary'] ?? []; $productRows = collect($profitDetails['products'] ?? []); $recentOrders = collect($profitDetails['recent_orders'] ?? []); $productOptions = collect($productOptions ?? $productRows); $pointCards = $pointCards ?? []; $filters = $filters ?? ['mode' => 'month', 'month' => now()->format('Y-m'), 'from' => now()->startOfMonth()->toDateString(), 'to' => now()->endOfMonth()->toDateString(), 'product_id' => null]; $dashboardRevenueUsd = (float) $kpis['revenue']; $sourceCurrency = $profitSummary['currency'] ?? 'PKR'; $summaryRevenueUsd = $metrics->usd((float) ($profitSummary['revenue'] ?? 0), $sourceCurrency); $revenueUsd = $summaryRevenueUsd; $detailRevenueUsd = $metrics->usd($productRows->sum('revenue'), $sourceCurrency); $recentRevenueUsd = $metrics->usd($recentOrders->sum('revenue'), $sourceCurrency); $isDashboardScope = $filters['mode'] === 'month' && $filters['month'] === now()->format('Y-m') && empty($filters['product_id']); $reconciliationDelta = $dashboardRevenueUsd - $summaryRevenueUsd; $isExact = $isDashboardScope && $reconciliationDelta == 0.0; @endphp
| Product | Qty | Orders | Sale Amount | Buying Amount | Points Used | Profit | Share |
|---|---|---|---|---|---|---|---|
| {{ $row['title'] }} | {{ number_format($row['sold_qty']) }} | {{ number_format($row['orders_count']) }} |
@if($rowQty > 0)
{{ $fmt($rowSaleTotalUsd) }}
{{ $fmt($rowSaleUnitUsd) }} each
@else
-
@endif
|
@if($rowQty > 0)
{{ $fmt($rowBuyingTotalUsd) }}
{{ $fmt($rowBuyingUnitUsd) }} each
@else
-
@endif
|
{{ $rowPointsUsd > 0 ? $fmt($rowPointsUsd) : '-' }} |
@if($rowQty > 0)
{{ $fmt($rowProfitUsd) }}
{{ number_format($rowMargin, 2) }}% margin
@else
-
@endif
|
{{ $revenueUsd > 0 ? number_format(($rowRevenueUsd / $revenueUsd) * 100, 2) : '0.00' }}% |
| No paid voucher revenue found for this month. | |||||||
| Total | {{ number_format($productRows->sum('sold_qty')) }} | {{ number_format($productRows->sum('orders_count')) }} | {{ $fmt($totalSaleUsd) }} | {{ $fmt($totalBuyingUsd) }} | {{ $totalPointsUsd > 0 ? $fmt($totalPointsUsd) : '-' }} |
{{ $fmt($totalProfitUsd) }}
{{ number_format($totalMargin, 2) }}% margin
|
100.00% |
| Order | Date | Qty | Revenue |
|---|---|---|---|
| #{{ $order['id'] }} | {{ $order['date'] ?: '-' }} | {{ number_format($order['qty']) }} | {{ $fmt($metrics->usd($order['revenue'], 'PKR')) }} |
| No recent paid orders found for this month. | |||