@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'))
Opening Balance {{ money($openingBalance) }} Total In {{ money($totalIn) }} Total Out {{ money($totalOut) }} Closing Balance {{ money($currentBalance) }}
@empty
{{ $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) }}
@endforelse
No cash book entries yet. Add your first entry.