- invoice/article posting-account overrides accept active class 1-3 accounts; class 1-2 (balance-sheet) accounts are rejected on VAT-bearing lines so the ruta 05 tax base always books to a 3xxx account - shared posting-account regex across server schemas, pending-operation re-validation, and client forms - share-capital settings (aktiekapital/antal_aktier) feed the annual-report note; kvotvarde derived per ABL 1 kap 6 $; all-or-nothing pair constraint - signed per-rate VAT breakdown on credit-note PDFs; U+2212 to ASCII hyphen Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
18 lines
831 B
TypeScript
18 lines
831 B
TypeScript
/**
|
|
* Canonical shape for a per-line invoice posting-account override: a 4-digit
|
|
* BAS class 1-3 account. Single source of truth shared by the server-side Zod
|
|
* schemas (lib/api/schemas.ts) and the client-side form schemas
|
|
* (ArticleForm, InvoiceEditor) so the two layers cannot drift apart.
|
|
*
|
|
* Classes 4-8 stay excluded: an invoice line never books to cost, payroll,
|
|
* or financial accounts. Class 1-2 (balance-sheet) overrides exist for
|
|
* deposits, customer advances, and genuine outlays; they are only bookable
|
|
* on zero-VAT lines (enforced server-side in build-invoice-write.ts).
|
|
*/
|
|
export const INVOICE_POSTING_ACCOUNT_REGEX = /^[123]\d{3}$/
|
|
|
|
/** True when the account is a balance-sheet account (BAS class 1-2). */
|
|
export function isBalanceSheetAccount(account: string): boolean {
|
|
return /^[12]/.test(account)
|
|
}
|