@extends('layouts.layout-horizontal') @section('title', ' Overview') @section('css') @endsection @php $role = auth()->user()?->role ?? 'viewer'; $isAdmin = ($role === 'admin'); $isCa = ($role === 'ca'); $isCash = currentCompany()?->mode === 'cash'; $shortcuts = [ ['name' => 'Sales Invoice', 'route' => 'sale.create', 'icon' => 'ph-receipt', 'key' => '1', 'cash' => true], ['name' => 'Sale Receipt', 'route' => 'sale-receipts.create', 'icon' => 'ph-money', 'key' => '2', 'cash' => false], ['name' => 'Purchase Bill', 'route' => 'purchase.create', 'icon' => 'ph-note', 'key' => '3', 'cash' => false], ['name' => 'Purchase Payment', 'route' => 'purchase-payments.create', 'icon' => 'ph-currency-dollar', 'key' => '4', 'cash' => false], ['name' => 'Customer', 'route' => 'customers.create', 'icon' => 'ph-user-plus', 'key' => '5', 'cash' => false], ['name' => 'Product', 'route' => 'products.create', 'icon' => 'ph-cube', 'key' => '6', 'cash' => false], ['name' => 'Shipping Labels', 'route' => 'shipping-labels.index', 'icon' => 'ph-package', 'key' => '7', 'cash' => true], ['name' => 'Proforma Invoice', 'route' => 'proforma-invoices.create', 'icon' => 'ph-file-dashed', 'key' => '8', 'cash' => false], ['name' => 'Purchase Order', 'route' => 'purchase-orders.create', 'icon' => 'ph-clipboard-text', 'key' => '9', 'cash' => true], ['name' => 'OTC Sales', 'route' => 'otc-sales.create', 'icon' => 'ph-shopping-cart', 'key' => 'F9', 'cash' => true, 'cashOnly' => true], ]; @endphp @section('content') {{-- ═══ Greeting ═══ --}}

Overview

FY {{ $fyStart->format('M Y') }} – {{ $fyEnd->format('M Y') }}
{{-- ═══ Stat Cards (hide for cash role) ═══ --}} @if($role !== 'cash')
Sales
₹{{ indian_number($totalSales, 0) }}
{{ $salesCount }}Invoices
Purchases
₹{{ indian_number($totalPurchases, 0) }}
{{ $purchasesCount }}Bills
Receipts
₹{{ indian_number($totalReceipts, 0) }}
{{ $receiptsCount }}Entries
Payments
₹{{ indian_number($totalPayments, 0) }}
{{ $paymentsCount }}Entries
Receivables
₹{{ indian_number($totalReceivableOutstanding ?? 0, 0) }}
DrDue
Outstandings
₹{{ indian_number($totalPayableOutstanding ?? 0, 0) }}
CrDue
@endif {{-- ═══ Quick Actions ═══ --}}
@foreach($shortcuts as $s) @if($role === 'cash' && !$s['cash']) @continue @endif @if(!$isCash && !$isCa && ($s['cashOnly'] ?? false)) @continue @endif @if(($s['cashRoleOnly'] ?? false) && $role !== 'cash') @continue @endif {{ $s['name'] }}@if($s['key'])Alt+{{ $s['key'] }}@endif @endforeach
{{-- ═══ Sales/Purchase Bills — Last 7 Days (hidden in cash mode) ═══ --}} @if(!$isCash && isset($lastSevenSaleBills, $lastSevenPurchaseBills))
Sales Bills - Last 7 Days {{ $lastSevenSaleBills->count() }}
All →
@forelse($lastSevenSaleBills as $bill) @empty @endforelse
DateBill NoPartyTotal
{{ $bill->invoice_date->format('d-M') }} {{ $bill->bill_no ?: '-' }} {{ $bill->party?->name ?? '-' }} ₹{{ indian_number($bill->grand_total, 2) }}
No sales bills in the last 7 days
Purchase Bills - Last 7 Days {{ $lastSevenPurchaseBills->count() }}
All →
@forelse($lastSevenPurchaseBills as $bill) @empty @endforelse
DateBill NoPartyTotal
{{ $bill->invoice_date->format('d-M') }} {{ $bill->bill_no ?: '-' }} {{ $bill->party?->name ?? '-' }} ₹{{ indian_number($bill->grand_total, 2) }}
No purchase bills in the last 7 days
@endif @if(false && isset($lastSevenDays))
Last 7 Days Sales & Purchases
@foreach($lastSevenDays as $day) @endforeach
Date Sales Bills Sales Purchase Bills Purchase
{{ $day->date->format('d-M') }} {{ $day->sales_count }} ₹{{ indian_number($day->sales_total, 2) }} {{ $day->purchase_count }} ₹{{ indian_number($day->purchase_total, 2) }}
@endif @if($isCash)
Cash Sales — Last 7 Days {{ $recentCashSales->count() }}
@if($recentCashSales->count() > 0) @endif All →
@forelse($recentCashSales as $cs) @empty @endforelse
DateBill NoPartyTotalActions
{{ $cs->invoice_date->format('d-M') }} {{ $cs->bill_no ?: '—' }} {{ $cs->party?->name ?? '—' }} ₹{{ indian_number($cs->grand_total, 2) }}
@if($cs->party?->mobile) @else @endif
No cash sales in the last 7 days
@endif @if(false)
Pending Outwards {{ $pendingOutwards->count() }}
@if($pendingOutwards->count() > 0) @endif All →
@forelse($pendingOutwards as $po) @php $pctO = $po->qty > 0 ? round(($po->outward_qty / $po->qty) * 100) : 0; $leftO = $po->qty - $po->outward_qty; @endphp @empty @endforelse
ProductPartyQtyOutLeftEntry
{{ $po->product->name ?? '—' }} {{ $po->saleEnquiry->party->name ?? '—' }} {{ indian_number($po->qty, 0) }} {{ indian_number($po->outward_qty, 0) }}
{{ indian_number($leftO, 0) }}
@csrf
No pending outwards
{{-- ═══ Alerts: Negative Stock ═══ --}}
Negative Stock {{ $negativeStock->count() }}
@if($negativeStock->count() > 0) @endif
@forelse($negativeStock as $item) @empty @endforelse
ProductSKUStock
{{ $item->name }} {{ $item->product_id }} {{ indian_number($item->stock, 0) }}
No negative stock
@endif @endsection @push('scripts') @if($isCash) {{-- Cash Sales: WhatsApp + Print handlers --}} @endif @endpush