How to change schema so that account_id reference is unique among 3 tables
Start with:


Create a ChartOfAccounts table with the Account code as Primary Key.
Add a Foreign Key constraint to ChartOfAccounts on all tables with an AccountCode field.
Use an IsDebit field, not the numeric sign, to distinguish Debits from Credits and reserve negative signs for transaction reversals (if used at all). This is necessary in order to generate T-Balances and Trial Balances properly from your Journal and Ledger
Create a Journal table with Primary Key: TransactionType, PostingDate, Account, SubledgerCode, IsDebit and minimum attributes of: Amount, CreatedDate, CreatedBy, DocumentReference
Design and spec a stored procedure (or type of routine suitable for where your business logic is located) for each type of transaction to be handled by the system. For your system these might be:


Ticket Purchase for Cash
Ticket Purchase on Account
Prize Payout in Cash
etc.



Please note that I am CGA, CPA in addition to being primarily a professional developer.

Update - Terminology:


A Journal is a chronological list of the details of all transactions of a given type, such as Cash Receipts, Cash Disbursements, Sales, etc.
A Ledger is a listing By Account of the aggregates of all transactions in a given time period.


It is occasionally necessary or expedient, when a wide variety of transaction types will be supported by the system (or to increase parallelism, as when many clerks need to be working at once Bob Cratchit style), to have multiple Journal files with different structure.

In a modern SQL Server system with only one Journal the Ledger could be defined as an Indexed View on the Journal. This would eliminate the need for either a trigger on the Journal to update the Ledger, or a batch-processing design.

Also, it is acceptable to have separate DrAmount and CrAmount columns in place of an IsDebit flag and single Amount column.