@extends('admin.layout') @section('title', 'Reports') @section('content') @include('admin._range', ['action' => '/admin/reports', 'days' => $days])

Download product report (CSV) @can('orders.view')Download orders (CSV)@endcan

Revenue collected{{ naira($m['revenue']) }}
Sales value (all non-cancelled orders){{ naira($m['sales_value']) }}
Orders{{ $m['orders'] }}
Units sold{{ $m['units'] }}

Product performance

@if ($fin)@endif @foreach ($perf as $p) @if ($fin)@endif @endforeach
ProductCategoryUnitsOrdersSalesProfitMarginRatingStock
{{ $p['name'] }}{{ $p['cat'] }}{{ $p['units'] }}{{ $p['orders'] }}{{ naira($p['sales']) }}{{ $p['profit'] === null ? '-' : naira($p['profit']) }}{{ $p['margin'] === null ? '-' : $p['margin'].'%' }}{{ $p['rating'] ? $p['rating'].' ★ ('.$p['reviews'].')' : '-' }} {{ $p['qty'] !== null ? $p['qty'] : $p['stock'] }}
@php($noSales = array_filter($perf, fn ($p) => $p['units'] === 0)) @if ($noSales)

No sales in this period: {{ implode(', ', array_map(fn ($p) => $p['name'], $noSales)) }}

@endif @if ($customers !== null)

Top customers

@foreach ($customers as $c)@endforeach
CustomerPhoneOrdersSpent (paid)
{{ $c->customer_name }}{{ $c->phone }}{{ (int) $c->n }}{{ naira((int) $c->paid) }}
@endif @endsection