feat: add drawer cash in/out adjustments with balance reconciliation
- New drawer_adjustment table (type: cash_in/cash_out, amount, reason) - POST/GET /drawer/:id/adjustments endpoints - Drawer close calculation now includes adjustments: expected = opening + sales + cash_in - cash_out - DrawerAdjustmentSchema for input validation - 5 new tests (44 total POS tests passing) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
DO $$ BEGIN
|
||||
CREATE TYPE "adjustment_type" AS ENUM ('cash_in', 'cash_out');
|
||||
EXCEPTION WHEN duplicate_object THEN NULL;
|
||||
END $$;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "drawer_adjustment" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"drawer_session_id" uuid NOT NULL REFERENCES "drawer_session"("id"),
|
||||
"type" "adjustment_type" NOT NULL,
|
||||
"amount" numeric(10, 2) NOT NULL,
|
||||
"reason" text NOT NULL,
|
||||
"created_by" uuid NOT NULL REFERENCES "user"("id"),
|
||||
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
@@ -295,6 +295,13 @@
|
||||
"when": 1775580000000,
|
||||
"tag": "0041_app_settings",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 42,
|
||||
"version": "7",
|
||||
"when": 1775590000000,
|
||||
"tag": "0042_drawer-adjustments",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user