# createJournalEntry

## Overview

Creates a DRAFT journal entry (仕訳) in the general ledger. The caller supplies an
accounting period (the `companyId` is derived from it), an optional entry date
(defaults to today) and description, and at least two lines. Each line references a
GL account and carries exactly one of a debit or credit amount (decimal strings).
Double-entry rules (≥2 lines, debit XOR credit, positive amounts) are enforced by
the native command; balance (Σdebit = Σcredit) is checked later at post time. Thin
wrapper over the native `financial-accounting` create command.

## Modules Commands Used

- [financial-accounting] createJournalEntry

## Exception Handling

| Error Code | Description |
| --- | --- |
| FINANCIAL_ACCOUNTING_COMPANY_NOT_FOUND | The company owning the accounting period does not exist |
| FINANCIAL_ACCOUNTING_ACCOUNTING_PERIOD_NOT_FOUND | The accounting period does not exist |
| FINANCIAL_ACCOUNTING_ACCOUNTING_PERIOD_COMPANY_MISMATCH | The accounting period belongs to a different company |
| FINANCIAL_ACCOUNTING_INVALID_ENTRY_DATE | The entry date is invalid for the selected period |
| FINANCIAL_ACCOUNTING_MINIMUM_LINES_NOT_MET | Fewer than two lines were supplied |
| FINANCIAL_ACCOUNTING_ACCOUNT_NOT_FOUND | A referenced GL account does not exist |
| FINANCIAL_ACCOUNTING_ACCOUNT_INACTIVE | A referenced GL account is inactive |
| FINANCIAL_ACCOUNTING_INVALID_DEBIT_CREDIT | A line does not carry exactly one positive debit or credit amount |
