@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.
Account
Status
Closed through
Open entries
Action
@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