Settle cashups: where the money ended up

A full cashup now records, per payment method, how much of the expected
takings is in the bank, still on hand (cash) or pending (on the card
report or with a POP), and writes off what was lost to card fees, bank
charges or a shortfall. Whatever is left is shown as unaccounted; closing
with an unaccounted amount is allowed after a warning.

Pending money can be marked received or written off after the event is
closed, without reopening it. Reopening starts the next cashup from the
last one. Write-offs come off net profit and show as "Bank & card
charges" in the cashup, finance and profit reports.

The reports page also moves to the shared back link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 13:25:04 +02:00
co-authored by Claude Opus 5.5
parent 9be78c3c34
commit 3a68b24a0f
12 changed files with 1004 additions and 186 deletions
+53 -3
View File
@@ -183,7 +183,36 @@ export type EventCashupLine = {
actualAmount?: number | null;
variance?: number | null;
notes?: string | null;
bankAmount?: number | null;
onHandAmount?: number | null;
pendingAmount?: number | null;
pendingReference?: string | null;
writeOffTotal?: number;
denominations?: EventCashupDenomination[];
writeOffs?: CashupWriteOff[];
};
export type CashupWriteOffCategory = "card_fees" | "bank_charges" | "cash_shortfall" | "other";
export type CashupWriteOff = {
id?: string;
category: CashupWriteOffCategory;
amount: number;
reason?: string | null;
createdAt?: string;
// Written off after the event was closed (from pending money that never arrived).
afterClose?: boolean;
};
export type PendingResolution = {
id: string;
lineId: string;
outcome: "received" | "written_off";
amount: number;
category?: CashupWriteOffCategory | null;
notes?: string | null;
performedBy?: { id: string; name: string } | null;
createdAt: string;
};
export type CashupAction = "closed" | "quick_closed" | "reopened";
@@ -204,12 +233,25 @@ export type EventCashup = {
event?: Pick<Event, "id" | "title">;
};
// One method of the latest close, with pending money settled since then folded in.
export type ReconciledByMethod = {
lineId: string | null;
expected: number;
actual: number | null;
variance: number | null;
notes?: string | null;
denominations: EventCashupDenomination[];
bank: number | null;
onHand: number | null;
pending: number | null;
pendingReference: string | null;
pendingReceived: number;
pendingOutstanding: number;
pendingResolutions: PendingResolution[];
writeOffs: CashupWriteOff[];
writeOffTotal: number;
// expected − actual − write-offs; null when nothing was entered for the method.
unaccounted: number | null;
};
export type ReconciledSnapshot = {
@@ -225,9 +267,12 @@ export type ReconciledSnapshot = {
export type CashupDraft = {
lines?: {
method: string;
actualAmount?: string | number;
notes?: string;
denominations?: { value: number; count: number }[];
bankAmount?: string | number | null;
onHandAmount?: string | number | null;
pendingAmount?: string | number | null;
pendingReference?: string | null;
writeOffs?: { category: CashupWriteOffCategory; amount: string | number | null; reason?: string | null }[];
notes?: string | null;
}[];
};
@@ -250,6 +295,11 @@ export type EventFinancials = {
reconciled: ReconciledSnapshot | null;
effectiveGrossIncomeByMethod: Record<CashupMethod, number>;
effectiveTotalRevenue: number;
writeOffsByMethod: Record<CashupMethod, number>;
writeOffsByCategory: Record<CashupWriteOffCategory, number>;
// Card fees, bank charges and shortfalls written off; comes off net profit.
totalWriteOffs: number;
pendingOutstandingTotal: number;
netProfit: number;
// Coupon discounts given on the event's registrations.
discountsTotal?: number;