@extends('layouts.finance') @section('title', 'Period Closing') @section('subtitle', 'Close each account up to a date so its entries can no longer be added, edited or deleted') @section('content') @php $accounts = $accounts ?? []; $today = $today ?? \Illuminate\Support\Carbon::today(); @endphp @if(session('success'))
{{ session('success') }}
@endif @if($errors->any())
@foreach($errors->all() as $error)
{{ $error }}
@endforeach
@endif @unless($passwordConfigured)
Closing is disabled. No closing password is set. Add FINANCE_CLOSING_PASSWORD to the environment file and run php artisan config:clear to enable it.
@endunless
How closing works

Closing an account through a date freezes every entry dated on or before that date: it cannot be added, edited, re-dated or deleted. Close daily, or every few days — the only thing that changes is the date you pick. Each account is closed on its own, so one bank can be finalised while another stays open.

A transfer between two accounts is one movement of money recorded on both sides. If either side is closed, both sides are frozen — so deleting the open half of a transfer whose other half is closed is refused, and the message names the account responsible.

@forelse($accounts as $account) @php $rowKey = $account['type'].'-'.$account['id']; $isClosed = $account['closed_through'] !== null; // Closing daily means picking yesterday or today; these are just shortcuts. $suggested = $account['closed_through'] ? \Illuminate\Support\Carbon::parse($account['closed_through'])->copy()->addDay() : ($account['earliest_open'] ?? $today); $suggested = $suggested->greaterThan($today) ? $today : $suggested; @endphp @empty @endforelse
Account Status Closed through Open entries Action
{{ $account['name'] }}
{{ $account['type'] === 'credit_card' ? 'Credit card' : 'Bank account' }}
@if($isClosed) Closed @else Open @endif @if($isClosed) {{ \Illuminate\Support\Carbon::parse($account['closed_through'])->format('d M Y') }}
set {{ $account['closed_at']?->format('d M Y, H:i') }}
@if($account['note'])
{{ $account['note'] }}
@endif @else @endif
{{ number_format($account['open_count']) }} @if($account['earliest_open'])
from {{ $account['earliest_open']->format('d M Y') }}
@endif
No accounts to close yet.
@endsection