@extends('layouts.app') @section('content')

Petty Cash

Manage petty cash funds, entries and top-ups.

@if(auth()->user()->hasPermission($currentBusiness->id, 'can_edit_petty_cash')) @endif
@php $allFunds = $funds ?? collect(); $totalAllocated = $allFunds->sum('amount') + $allFunds->sum('total_top_up'); $totalBalance = $allFunds->sum('balance'); $totalSpent = $totalAllocated - $totalBalance; $activeFunds = $allFunds->filter(fn($f) => strtolower($f->status) === 'active')->count(); @endphp

Total Funds

{{ $allFunds->count() }}

{{ $activeFunds }} active · {{ $allFunds->count() - $activeFunds }} closed

Total Allocated

{{ $currentBusiness->currency_symbol }}{{ number_format($totalAllocated) }}

initial + top-ups

Total Spent

{{ $currentBusiness->currency_symbol }}{{ number_format($totalSpent) }}

{{ $totalAllocated > 0 ? round($totalSpent / $totalAllocated * 100) : 0 }}% of allocated

Total Balance

{{ $currentBusiness->currency_symbol }}{{ number_format($totalBalance) }}

{{ $totalAllocated > 0 ? round($totalBalance / $totalAllocated * 100) : 0 }}% remaining

Active Funds

{{ $activeFunds }}

{{ $allFunds->sum('entries_count') ?? 0 }} total entries

@forelse($allFunds as $fund)

{{ $fund->name ?? $fund->holder }}

{{ $fund->purpose ?? 'General' }}

{{ $fund->status }}
Holder {{ $fund->holder }}
@if($fund->location)
Location {{ $fund->location }}
@endif
Payment {{ $fund->payment_method }}
Date {{ \Carbon\Carbon::parse($fund->date)->format('d M Y') }}

Initial

{{ $currentBusiness->currency_symbol }}{{ number_format($fund->amount) }}

Top-ups

+{{ $currentBusiness->currency_symbol }}{{ number_format($fund->total_top_up) }}

Balance

{{ $currentBusiness->currency_symbol }}{{ number_format($fund->balance) }}

@php $totalFund = $fund->amount + $fund->total_top_up; $spent = $totalFund - $fund->balance; $pct = $totalFund > 0 ? round(($fund->balance / $totalFund) * 100) : 0; @endphp
Spent {{ $currentBusiness->currency_symbol }}{{ number_format($spent) }} {{ $pct }}% left
@empty

No petty cash funds

Create a new fund to start tracking petty cash.

@endforelse
@endsection