* feat: add user locale preference to user_preferences table
- Introduced a new column 'locale' in the user_preferences table to store per-user UI language preferences.
- Added a CHECK constraint to ensure only supported locales ('sv', 'en') are allowed.
- Triggered a schema reload notification for the changes.
chore: declare CSS module support in TypeScript
- Added a declaration for CSS modules in globals.d.ts to enable TypeScript support for importing CSS files.
* feat: add Swish as an invoice payment method in company settings
* fix(currency): use transaction-date FX rate and post mall bookings in SEK (#442)
Three related defects in non-SEK transaction handling:
1. Ingest priced every transaction in a batch at today's rate because
fetchMultipleRates() was called without a date. Switch to a per-
(currency, date) fetch via fetchExchangeRate() + Promise.allSettled,
so each row stores Riksbanken's rate as of its own transaction date.
2. buildMappingResultFromTemplate emitted VAT/reverse-charge/output-VAT
lines from Math.abs(transaction.amount) — the source-currency amount.
Mall bookings on USD/EUR transactions therefore posted the journal
entry in the wrong currency. Resolve to SEK once via resolveSekAmount()
and reuse for every line, matching what createTransactionJournalEntry
already does for the settlement line.
3. The Granska bokföring modal and the journal-entry detail page lacked
a clear audit trail. The verifikation preview now renders in SEK with
a separate original-currency subtitle in the header; the detail page
gains a dedicated "Valutaomräkning" card above Kontorader showing the
rate and original total.
Also: replace truncate with break-all on the modal description so long
UUID-style strings (e.g. BALANCE_CASHBACK-…) wrap instead of forcing
horizontal overscroll.
Tests: 4 new booking-templates cases (USD 25%, EUR fallback via
exchange_rate, EU reverse-charge on USD, output VAT on USD income) and
2 new ingest cases (per-pair fetch dedup; no fetch for SEK rows).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(currency): wire SEK conversion into SwipeCategorizationView (#442 follow-up)
Address Greptile review:
- SwipeCategorizationView rendered JournalEntryPreview without amountSek,
so the swipe flow had the same defect QuickReviewDialog had — a USD
transaction showed the verifikation in source currency labeled SEK.
Now resolves SEK once via resolveSekAmount, passes it to the preview,
and shows SEK as the headline with the original-currency subtitle
(parallel to QuickReviewDialog).
- Drop the now-dead `currency` prop from JournalEntryPreviewProps and
its remaining call site in QuickReviewDialog — the component
hardcodes 'SEK' on display, so the prop was misleading.
- Correct the misleading inline comment in ingest.ts: network failures
resolve inside fetchExchangeRate to getFallbackRate() (non-null),
so the key only stays unset on empty-observation responses or
outright rejections.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(settings): add option for company name position in invoice PDF
* feat(migrations): add backfill for VAT account labels to correct bad seed data
* feat(migrations): add backfill for VAT account labels to correct bad seed data
* fix(ui): improve accessibility for company name position toggle in PDF settings
* fix(bookkeeping): align BAS 2026 reference data with official PDF
Reconciled lib/bookkeeping/bas-data/ against the BAS 2026 v1.1 official
chart (1286 accounts). All real discrepancies fixed:
- 2089 Fond för utvecklingsutgifter: k2_excluded → true
- 8417 Räntekostnader för dold räntekompensation: k2_excluded → true
- 1250, 1260 renamed to "(Fritt konto för Inventarier, verktyg och
installationer)" — BAS 2026 freed these slots
- Periodiseringsfond 2120-2139: added year suffixes (2120 = "...2020"
etc.) and added 8 missing accounts (2121-2127, 2129) for years
2019, 2021-2027. Dropped phantom 2022/2024 prior-parser garbage.
- 4075-4078: EUland → EU-land
- 8411: förlagsoch → förlags- och
Verified: 1282 of 1286 PDF accounts match exactly after edits (remaining
4 are PDF-parser artifacts, not real data). Build clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(migrations): backfill BAS 2026 account labels in chart_of_accounts
Companion to the TS reference fix. Updates existing companies' rows where
they still carry seed-data typos or generic names that don't match BAS 2026:
- 4075-4078: EUland → EU-land (hyphenation)
- 8411: förlagsoch → förlags- och (hyphenation)
- 2120, 2130-2137, 2139: rename "Periodiseringsfond" (generic, no year) to
the BAS 2026 canonical name with year suffix
Defensive: every WHERE clause matches an EXACT current value. Rows that
have been manually renamed by users — including those with a wrong year
that may reference legacy fonds from an earlier BAS numbering cycle — are
left untouched. No row is deleted.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(migrations): fix wrong-year labels on Periodiseringsfond accounts
Follow-up to 20260513140000. The first backfill only renamed accounts whose
name was the generic "Periodiseringsfond" (no year). Many customers were
seeded from an older BAS numbering cycle where 2126 = "2016", 2127 = "2017",
etc. — BAS 2026 reuses those account numbers for years 2026/2027.
This migration aligns the year tag with the BAS 2026 meaning of each
account number across 2120-2127, 2129, 2130-2137, 2139. Only rows whose
name still starts with "Periodiseringsfond" are touched — customers who
renamed the account to something custom keep their name.
Verified on staging: all 18 accounts now carry BAS 2026 canonical names.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(data): update account names and descriptions for clarity and consistency
* fix(migrations): backfill account names for BAS 2026 freed accounts and refine Periodiseringsfond name matching
* feat: enhance VAT handling with reverse charge logic and supplier type support
* feat: implement VAT declaration validation rules and enhance moms box mapping
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Update BAS account catalog with comprehensive SRU codes and K2 flags
- Add currency revaluation service with tests and API route
- Add expenses page and account deletion API
- Enhance booking templates with new patterns and improved tests
- Improve transaction categorization with template picker and description matching
- Polish dashboard, onboarding, import, and transaction UIs
- Refactor year-end service for multi-step closing
- Move SRU generator to ne-bilaga, remove standalone SRU export
- Remove unused dev docs, mock data, and extension hooks
- Add invoice delivery note sequences migration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reduce booking template library to eliminate duplicate suggestions when
users describe transactions. Templates with identical accounting treatment
(same account + VAT) are merged, keywords consolidated, and the entire
subscriptions group is eliminated. Also includes prior work on reports,
extensions, and transaction improvements.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add auto-detecting CSV parsers for Länsförsäkringar, ICA Banken, Skandia,
and Lunar. Refine SEB detection to avoid false matches. Update bank file
upload UI with new bank options and export instructions. Include booking
templates, improved AI categorization, and transaction review enhancements.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>