@extends('admin.layouts') @section('title', 'Category Wise Sales') @section('content')
{{-- ========================================================= --}} {{-- PAGE HEADER --}} {{-- ========================================================= --}}

Category-wise Sales & Profit Report

@if(!empty($branchName)) Branch: {{ $branchName }} @else All Branches @endif
{{-- ========================================================= --}} {{-- FILTER CARD --}} {{-- ========================================================= --}}
{{-- FROM DATE --}}
{{-- TO DATE --}}
{{-- CATEGORY --}}
{{-- SUBCATEGORY --}}
{{-- ORDER ID --}}
{{-- SEARCH --}}
{{-- RESET --}}
{{-- ========================================================= --}} {{-- REPORT --}} {{-- ========================================================= --}} @if($categoryReport->count() > 0) {{-- ========================================================= --}} {{-- CHART SECTION --}} {{-- SALES TOP / PROFIT BELOW --}} {{-- ========================================================= --}}
{{-- ===================================================== --}} {{-- SALES CHART --}} {{-- ===================================================== --}}
{{-- CHART HEADER --}}
Category-wise Sales @if(!empty($branchName)) — {{ $branchName }} @endif

Sales performance by category and subcategory

{{-- SALES CHART --}}
{{-- ===================================================== --}} {{-- PROFIT CHART --}} {{-- ===================================================== --}}
{{-- CHART HEADER --}}
Category-wise Profit @if(!empty($branchName)) — {{ $branchName }} @endif

Profit performance by category and subcategory

{{-- PROFIT CHART --}}
{{-- ========================================================= --}} {{-- HIGHEST SALES / PROFIT --}} {{-- ========================================================= --}}
{{-- HIGHEST SALES --}}
HIGHEST SALES CATEGORY @if($highestSalesCategory)

{{ $highestSalesCategory['category_name'] }}

@if(!empty($highestSalesCategory['subcategory_name'])) {{ $highestSalesCategory['subcategory_name'] }} @endif
₹{{ number_format( $highestSalesCategory['sales_amount'], 2 ) }}
@else No data @endif
{{-- HIGHEST PROFIT --}}
HIGHEST PROFIT CATEGORY @if($highestProfitCategory)

{{ $highestProfitCategory['category_name'] }}

@if(!empty($highestProfitCategory['subcategory_name'])) {{ $highestProfitCategory['subcategory_name'] }} @endif
₹{{ number_format( $highestProfitCategory['profit'], 2 ) }}
@else No data @endif
{{-- ========================================================= --}} {{-- SUMMARY TABLE --}} {{-- ========================================================= --}}
Category Sales Summary
Sales and profit grouped by category and subcategory
{{ $categoryReport->count() }} Records
@forelse($categoryReport as $index => $category) @empty @endforelse
SNO CATEGORY NAME SUBCATEGORY BILLS QUANTITY SALES AMOUNT SALES % COST PROFIT PROFIT % ACTION
{{ $index + 1 }} {{ $category['category_name'] }} @if(!empty($category['subcategory_name'])) {{ $category['subcategory_name'] }} @else N/A @endif {{ $category['bills'] }} {{ rtrim( rtrim( number_format( $category['quantity'], 3, '.', '' ), '0' ), '.' ) }} ₹{{ number_format( $category['sales_amount'], 2 ) }} {{ number_format( $category['sales_percentage'], 2 ) }}% ₹{{ number_format( $category['cost_amount'], 2 ) }} @if($category['profit'] >= 0) ₹{{ number_format( $category['profit'], 2 ) }} @else ₹{{ number_format( $category['profit'], 2 ) }} @endif {{ number_format( $category['profit_percentage'], 2 ) }}% @if(!empty($category['category_id'])) View @else - @endif

No sales found.
@else {{-- ========================================================= --}} {{-- NO DATA --}} {{-- ========================================================= --}}
No sales found

No category sales are available for the selected filters.

@endif
{{-- ============================================================= --}} {{-- MODERN CHART CSS --}} {{-- ============================================================= --}} {{-- ============================================================= --}} {{-- CHART.JS --}} {{-- ============================================================= --}} @endsection