Overview
A cash session represents a single operating day for a specific cash register. It serves as the container for all income adjustments and expenses occurring during that day.Session Structure
Core Fields
| Field | Type | Description |
|---|---|---|
cash_register_id | Foreign Key | Links to the register (see CashRegister.php:38) |
operating_date | Date | The business date for this session |
status | Enum | DRAFT or POSTED |
opening_balance | Decimal | Optional starting cash amount (nullable) |
closing_balance | Decimal | Calculated final balance after all transactions |
meta | JSON | Additional metadata (e.g., external batch ID) |
The combination of
cash_register_id and operating_date is unique - you can only have one session per register per day.Status Constants
From CashSession.php:31-33:Session Lifecycle
Record Transactions
Add cash adjustments (income) and expenses during the day
- All transactions remain editable while session is
DRAFT - Real-time balance available via
calculateCurrentBalance()
Post Session
Finalize the session by setting status to
POSTED- Marks all adjustments and expenses as posted
- Calculates and locks
closing_balance - Records
posted_byuser andposted_attimestamp
Balance Calculations
Closing Balance (Posted Transactions Only)
The official closing balance includes only posted transactions. From CashSession.php:118-146:Current Balance (Including Drafts)
For real-time display during the day, calculate balance including draft transactions. From CashSession.php:148-182:Relationships
Belongs To
- cashRegister: Links to CashRegister.php:38-41
Has Many
- adjustments: All cash adjustments for this session CashSession.php:46-49
- expenses: All expenses recorded in this session CashSession.php:54-57
Query Scopes
Useful scopes from CashSession.php:61-97:Helper Methods
Status Checks
Session Workflow Diagram
Best Practices
Opening Balance
Opening Balance
Set
opening_balance when starting a new session if you have a float. Leave null for event or delivery registers that start at zero.Posting Timing
Posting Timing
Post sessions at end-of-day after all adjustments and expenses are recorded. Once posted, the session becomes immutable.
Draft Management
Draft Management
Use
calculateCurrentBalance() to show operators their running total during the day, but rely on calculateClosingBalance() for official close.Variance Handling
Variance Handling
If closing balance doesn’t match physical count, create a correction adjustment (type
CORRECTION) before posting.Example: Daily Close Flow
Next Steps
Cash Adjustments
Learn how to record income and corrections
Cash Expenses
Track operational expenses during sessions