@extends('master.app') @section('title', 'Product Sales Report') @section('pageCSS') @endsection @section('body')
Product Sales Report
Province / Customer wise • Qty • Cartons • Amount
{{-- Print Header --}} @if($isPrint)
{{ $info->business_name ?? 'Business' }}
Product Sales Report
Print Date: {{ date('Y-m-d') }}
@endif {{-- Filters --}}
{{-- Active Filters Pills --}}
Group: {{ $groupBy === 'customer' ? 'Customer' : 'Province' }} @if(request('from_date') || request('to_date')) {{ request('from_date') ?: '...' }} → {{ request('to_date') ?: '...' }} @endif @if(request('currency_id') && request('currency_id') !== 'all') Currency ID: {{ request('currency_id') }} @endif
{{-- KPI --}}
Total Qty
{{ number_format($kpi->qty, 2) }}
Total Cartons
{{ number_format($kpi->carton, 2) }}
Total Amount
{{ number_format($kpi->amount, 2) }}
@php // helper for sorting links $makeSortUrl = function($key) { $currentSort = request('sort'); $currentDir = request('dir','desc'); $dir = ($currentSort === $key && $currentDir === 'desc') ? 'asc' : 'desc'; return route('reports.product_sales', array_merge(request()->query(), ['sort'=>$key, 'dir'=>$dir])); }; $sortIcon = function($key){ $currentSort = request('sort'); $currentDir = request('dir','desc'); if($currentSort !== $key) return 'fa-sort text-muted'; return $currentDir === 'asc' ? 'fa-sort-up' : 'fa-sort-down'; }; @endphp {{-- Table --}}
@php // paginator vs collection row iteration $rowItems = $isPrint ? $rows : $rows->items(); $startNo = $isPrint ? 1 : $rows->firstItem(); @endphp @forelse($rowItems as $i => $r) @empty @endforelse
# {{ $groupBy === 'customer' ? 'Customer' : 'Province' }} Qty Cartons Amount
{{ $startNo + $i }}
{{ $r->gname }}
ID: {{ $r->gid }}
{{ number_format((float)$r->total_qty, 2) }} {{ number_format((float)$r->total_cartons, 2) }} {{ number_format((float)$r->total_amount, 2) }}
No data found
{{-- Pagination --}} @if(!$isPrint)
{{ $rows->links('pagination::bootstrap-4') }}
@endif {{-- Print footer --}} @if($isPrint)
Generated by System • {{ date('Y-m-d H:i') }}
@endif
@endsection