---
tags: [accounting, model]
module: Accounting
---

# BankStatement

## Connections
[[_Accounting]] · [[[Model]JournalEntry]] · [[[Model]Account]] · [[[Model]Reconciliation]] · [[[Repo]Repositories]] · [[[Controller]BankStatementController]] · [[[Service]BankStatementServices]] · [[[DB]DatabaseTables]]

## Source
```
Modules/Accounting/Models/BankStatement.php
Modules/Accounting/Models/BankStatementRecord.php
```

## Responsibilities
- `BankStatement` is an imported bank statement header linked to an [[[Model]Account]] and fiscal year
- `BankStatementRecord` is each transaction line from the bank file
- Records can be matched to existing [[[Model]JournalEntry]] records (reconciliation) or used to create a new JournalEntry directly
- Supports import from CSV/Excel via `BankStatementImport`

## Key Relationships

| Relation | Type | Target |
|---|---|---|
| account | belongsTo | [[[Model]Account]] |
| records | hasMany | BankStatementRecord |
| BankStatementRecord.journalEntry | belongsTo | [[[Model]JournalEntry]] |
| BankStatementRecord.bankStatement | belongsTo | BankStatement |

## Record Status Enum
`BankStatementRecordsStatusEnum` — unmatched / matched / entry-created

## Import Flow
```
BankStatementImportController::store
  → ImportingBankStatementsService
  → BankStatementImport (Maatwebsite Excel)
  → BankStatement + N × BankStatementRecord created
```

## Matching Flow
```
BankStatementRecordsMatchedJournalEntriesController::store
  → LinkingingBankstatmentRecordWithEntryService
  → BankStatementRecord.journal_entry_id set
```

## Traits
`AuditableTrait` · `CascadeSoftDeletes` · `UsesTenantConnection` (BankStatement)
`SoftDeletes` · `UsesTenantConnection` (BankStatementRecord)
