Archived
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>
54 lines
2.1 KiB
SQL
54 lines
2.1 KiB
SQL
-- CreateEnum
|
|
CREATE TYPE "CashupWriteOffCategory" AS ENUM ('card_fees', 'bank_charges', 'cash_shortfall', 'other');
|
|
|
|
-- AlterTable
|
|
ALTER TABLE "EventCashupLine" ADD COLUMN "bankAmount" DOUBLE PRECISION,
|
|
ADD COLUMN "onHandAmount" DOUBLE PRECISION,
|
|
ADD COLUMN "pendingAmount" DOUBLE PRECISION,
|
|
ADD COLUMN "pendingReference" TEXT,
|
|
ADD COLUMN "writeOffTotal" DOUBLE PRECISION NOT NULL DEFAULT 0;
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "EventCashupWriteOff" (
|
|
"id" TEXT NOT NULL,
|
|
"lineId" TEXT NOT NULL,
|
|
"category" "CashupWriteOffCategory" NOT NULL,
|
|
"amount" DOUBLE PRECISION NOT NULL,
|
|
"reason" TEXT,
|
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
CONSTRAINT "EventCashupWriteOff_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "EventCashupPendingResolution" (
|
|
"id" TEXT NOT NULL,
|
|
"lineId" TEXT NOT NULL,
|
|
"outcome" TEXT NOT NULL,
|
|
"amount" DOUBLE PRECISION NOT NULL,
|
|
"category" "CashupWriteOffCategory",
|
|
"notes" TEXT,
|
|
"performedById" TEXT,
|
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
CONSTRAINT "EventCashupPendingResolution_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "EventCashupWriteOff_lineId_idx" ON "EventCashupWriteOff"("lineId");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "EventCashupPendingResolution_lineId_idx" ON "EventCashupPendingResolution"("lineId");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "EventCashupPendingResolution_performedById_idx" ON "EventCashupPendingResolution"("performedById");
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "EventCashupWriteOff" ADD CONSTRAINT "EventCashupWriteOff_lineId_fkey" FOREIGN KEY ("lineId") REFERENCES "EventCashupLine"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "EventCashupPendingResolution" ADD CONSTRAINT "EventCashupPendingResolution_lineId_fkey" FOREIGN KEY ("lineId") REFERENCES "EventCashupLine"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "EventCashupPendingResolution" ADD CONSTRAINT "EventCashupPendingResolution_performedById_fkey" FOREIGN KEY ("performedById") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|