@extends('layouts.app') @section('title', 'Cash Book') @section('page', 'cash-book') @section('cashNav', 'entries') @php $typeVariant = fn ($t) => $t === 'In' ? 'success' : 'danger'; $statusVariant = fn ($s) => $s === 'Active' ? 'success' : 'danger'; $presetCategories = [ 'Opening Balance', 'Sales', 'Transfer', ]; $categoryOptions = collect($presetCategories) ->merge($expenseCategories ?? []) ->merge($categories ?? []) ->unique() ->sort() ->values(); $defaultCashBookId = $selectedCashBookId ?: ($cashBooks->first()?->id); @endphp @section('content') @include('partials.account-cash-nav') @if (session('success')) {{ session('success') }} @endif @if ($errors->any()) {{ $errors->first() }} @endif @if ($selectedCashBookId) @endif

Opening Balance

{{ money($openingBalance) }}

Balance before {{ $dateFrom }}

Total In

{{ money($totalIn) }}

Cash received

Total Out

{{ money($totalOut) }}

Cash paid

Closing Balance

{{ money($currentBalance) }}

As of {{ $dateTo }}

@forelse ($entries as $row) {{ $row->entry_date->format('Y-m-d') }} {{ $row->cashBook?->name ?? ($selectedCashBookName ?? '—') }} {{ $row->category }} {{ preg_match('/^(Bill No\s+\d+)/i', (string) $row->notes, $m) ? $m[1] : ($row->notes ?: '—') }} {{ $row->type === 'In' ? money((float) $row->amount) : '—' }} {{ $row->type === 'Out' ? money((float) $row->amount) : '—' }} {{ money((float) $row->running_balance) }} {{ $row->status }}
@empty No cash book entries yet. Add your first entry. @endforelse
@endsection @push('styles') @endpush @push('scripts') @endpush