@extends('admin.layouts.app') @section('title', 'Cashbook') @section('page_title', 'Cashbook Report') @section('content')
Cashbook Report
@error('start_date')
{{ $message }}
@enderror
@error('end_date')
{{ $message }}
@enderror
@php $balance = (float)($openingBalance ?? 0); $grouped = $cashbooks->groupBy(function($item) { return $item->date; }); $currentDate = null; @endphp @forelse($grouped as $date => $entries) @php $dayOpening = $balance; $dayDebit = $entries->sum('debit'); $dayCredit = $entries->sum('credit'); @endphp @foreach($entries as $entry) @php $balance = $balance + (float)$entry->credit - (float)$entry->debit; @endphp @endforeach @empty @endforelse
ID Date Type Description Reference Debit Credit Balance
- {{ date('d-m-Y', strtotime($date)) }} - Opening Balance - - - {{ number_format($dayOpening, 2) }}
{{ $entry->id }} {{ date('d-m-Y', strtotime($entry->date)) }} @if($entry->type == 'receipt') Receipt @else Payment @endif {{ $entry->description }} {{ $entry->reference_type ? $entry->reference_type . ' #' . $entry->reference_id : '-' }} {{ $entry->debit > 0 ? number_format($entry->debit, 2) : '0.00' }} {{ $entry->credit > 0 ? number_format($entry->credit, 2) : '0.00' }} {{ number_format($balance, 2) }}
- {{ date('d-m-Y', strtotime($date)) }} - Closing Balance - {{ number_format($dayDebit, 2) }} {{ number_format($dayCredit, 2) }} {{ number_format($balance, 2) }}
No entries found
Total: {{ number_format($cashbooks->sum('debit'), 2) }} {{ number_format($cashbooks->sum('credit'), 2) }}
Closing Balance: - - {{ number_format($balance, 2) }}
@endsection