# AccountingReports Module — CHANGELOG

All notable changes to this module are documented here.
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

---

## [2.5.0] — 2026-04-28

### 🆕 New Features

#### Sri Lanka Cheque Printing (SL Standard Compliant)
- **SL-standard page size**: `190.5mm × 88.9mm` (7.5 × 3.5 inches)
- **MICR Clear Band enforced**: Bottom `19.05mm` (0.75 inch) is permanently blank — MICR zone never overprinted
- **DDMMYYYY date boxes**: 8 individual bordered digit boxes; century digits rendered transparent (pre-printed on SL cheque leaves)
- **Amount format**: `Rs. 50,000.00/=` (SL standard prefix + suffix)
- **Amount in Words**: Mandatory "Only" suffix, asterisk protection `***Amount Only***`
- **Payee protection**: `***PAYEE NAME***` to prevent fraudulent additions
- **Crossing options**: A/C Payee Only, Not Negotiable — rendered as two diagonal lines top-left
- **VOID watermark**: Diagonal semi-transparent "VOID" text for cancelled cheques
- **Live preview panel**: JS canvas preview of cheque before printing
- **MICR bank code reference table**: BOC, Commercial Bank, HNB, Sampath, Seylan, NTB, People's Bank codes

#### Cheque Print Calibration System (New DB Table)
- New table: `cheque_print_templates`
- Per-bank-account calibration: X/Y offset in mm to compensate for printer paper-pull
- Field position storage: date, payee, amount words, amount figures, crossing — all individually configurable per account
- AJAX save/load: calibration loads automatically when account is selected in the form

#### Cheque Print Audit Trail (New DB Table)
- New table: `cheque_print_audit_log`
- Every print action logged: user, payee, amount, cheque date, crossing type, IP address, user agent, timestamp
- Recent 20 prints shown in the printing form's history section
- Fraud detection: full immutable trail of who printed what and when

### 🔧 Fixes
- **Bug fix**: `$date` variable undefined in `ChequePrintingController@print()` (line 130) — caused PHP warning on every print
- **Bug fix**: `$data['crossing']` notice when no crossing selected — now safely defaults to empty string
- **Bug fix**: Auth call `$auth()->user()` syntax error in `getTemplate()` — corrected to `auth()->user()`
- **Improvement**: `convertToWords()` now handles "Only" suffix deduplication (prevented "Only Only" in output)
- **Improvement**: `numToWord()` fallback chain hardened — gracefully falls back to built-in converter if `intl` extension missing

### ⬆️ Migrations Added
| File | Purpose |
|------|---------|
| `2026_04_28_000001_create_cheque_print_templates_table.php` | Per-account cheque layout + calibration offsets |
| `2026_04_28_000002_create_cheque_print_audit_log_table.php` | Full audit trail of all cheque prints |

---

## [2.4.x] — 2025-12-16

### Added
- `source_cheque_id` column on `cheque_book_entries` table
- `contact_id` and `deposit_account_id` columns on `cheque_book_entries` table
- `journal_entry_line_id` made nullable in `bank_reconciliation` table

---

## [2.3.x] — 2025-11-03

### Added
- `category_id` column on `direct_expenses` table

---

## [2.2.x] — 2025-01-16

### Added
- `available` status support in `cheque_book_entries` table
- Bank account ID linkage to cheque book entries
- Account transaction ID to bank reconciliation
- Budgets table (`create_budgets_table`)

---

## [2.1.x] — 2024-01-01 (Initial Release)

### Added
- Chart of Accounts
- Journal Entry Headers & Lines
- Ledger Rollups
- FIFO Layers
- Account Receivables / Payables
- Period Locks
- Bank Reconciliation
- Audit Log (accounting)
- Ratio Snapshots
- Direct Expenses & Names
- Direct Incomes & Names
- Cheque Book Entries & Books
- Loans & Loan Transactions
- Fixed Assets (base + revaluations)
- Capital Accounts
- Investments
- Bank Accounts
- Opening Balance Transactions
