@extends('layouts.app') @section('title', 'All Sales Invoices & Customers Report') @section('content')

All Sales Invoices & Customers Report

Complete overview of all sales invoices and customers

{{ number_format($stats['total_invoices']) }}
Total Invoices
{{ number_format($stats['total_customers']) }}
Total Customers
৳{{ number_format($stats['total_amount'], 2) }}
Total Sales Amount
৳{{ number_format($stats['total_due'], 2) }}
Total Due Amount
Filter & Search
@if(request()->hasAny(['search', 'from_date', 'to_date', 'customer_id', 'status', 'sales_invoice_id', 'invoice_month', 'invoice_date_from', 'invoice_date_to'])) @endif

Customers Details (Current Month: {{ \Carbon\Carbon::now()->format('M Y') }})

@if(request('sales_invoice_id')) @php $selectedInvoice = \App\Models\SalesInvoice::find(request('sales_invoice_id')); @endphp @if($selectedInvoice) Filtered by Invoice: {{ $selectedInvoice->invoice_no }} @if($selectedInvoice->customer_invoice) ({{ $selectedInvoice->customer_invoice }}) @endif @endif @elseif(request('invoice_date_from') || request('invoice_date_to')) Invoice Date: @if(request('invoice_date_from')) From {{ \Carbon\Carbon::parse(request('invoice_date_from'))->format('d M Y') }} @endif @if(request('invoice_date_to')) @if(request('invoice_date_from')) to @else Until @endif {{ \Carbon\Carbon::parse(request('invoice_date_to'))->format('d M Y') }} @endif @elseif(request('invoice_month')) @php $selectedMonthValue = request('invoice_month'); $selectedMonthDisplay = \Carbon\Carbon::createFromFormat('Y-m', $selectedMonthValue)->format('M Y'); @endphp Invoice Month: {{ $selectedMonthDisplay }} @else @php $currentMonth = \Carbon\Carbon::now()->format('Y-m'); $currentMonthDisplay = \Carbon\Carbon::now()->format('M Y'); @endphp Current Month: {{ $currentMonthDisplay }} ({{ $currentMonth }}) @endif
@if(empty($customerDetails) || count($customerDetails) == 0)
No customer details found for the selected period. @if(!request('invoice_month') && !request('sales_invoice_id')) @php $currentMonthDisplay = \Carbon\Carbon::now()->format('M Y'); $currentMonthValue = \Carbon\Carbon::now()->format('Y-m'); @endphp

Current Month: {{ $currentMonthDisplay }} ({{ $currentMonthValue }})
No invoices found for December 2025 in the database. @if(isset($availableMonths) && count($availableMonths) > 0)

Available months with data: @if(count($availableMonths) > 5) ... and {{ count($availableMonths) - 5 }} more months @endif @else
No invoice data found in the database for any month. @endif @elseif(request('invoice_month'))
Selected month: {{ request('invoice_month') }}
No invoices found for this month. @endif
@endif
@foreach($itemTypesList ?? [] as $columnKey => $columnInfo) @php $itemName = $columnInfo['item_name'] ?? 'Item'; $colClass = 'col-item-' . str_replace([' ', '-', '@', '#'], '-', strtolower($itemName)); @endphp @endforeach @foreach($itemTypesList ?? [] as $columnKey => $columnInfo) @php $itemName = $columnInfo['item_name'] ?? 'Item'; $colClass = 'col-item-' . str_replace([' ', '-', '@', '#'], '-', strtolower($itemName)); @endphp @endforeach @forelse($customerDetails ?? [] as $detail) @foreach($itemTypesList ?? [] as $columnKey => $columnInfo) @php $itemName = $columnInfo['item_name'] ?? 'Item'; $colClass = 'col-item-' . str_replace([' ', '-', '@', '#'], '-', strtolower($itemName)); @endphp @endforeach @empty @endforelse
SN Company
{{ $itemName }}
Qty Rate Price
{{ $detail['sn'] }} {{ $detail['company'] }} {{ $detail[$columnKey]['quantity'] ?? '' }} {{ $detail[$columnKey]['rate'] ?? '' }} {{ $detail[$columnKey]['price'] ?? '' }}

No customer details found for current month

@endsection