feat: unified document inbox, full BAS 2026, and document-transaction matching
- Expand BAS reference from ~180 to ~1,276 accounts (full BAS Kontoplan 2026) with K2 exclusion flags, per-class data files, and computed SRU codes - Evolve invoice inbox into unified document inbox handling invoices, receipts, and government letters with AI-powered classification (Claude Haiku Vision) - Add multi-pass document-to-transaction matching engine with greedy assignment for both supplier invoices (reference/amount/date/name) and receipts (weighted amount/merchant/date scoring) - Add supplier invoice matching in transaction ingest pipeline - Inject booking template suggestions into AI extraction prompts - Surface matched documents in swipe categorization UI with one-tap booking - Auto-activate missing BAS accounts during SIE import against full reference - Add K2 filter toggle in Chart of Accounts manager - Add receipt confirmation route with BFNAR representation fields - Add database migrations for K2 support and document matching columns - Remove obsolete extension migration scripts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
6956a757f3
commit
39e407644d
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,917 @@
|
||||
import type { BASReferenceAccount } from '../bas-reference'
|
||||
|
||||
export const CLASS_4_ACCOUNTS: BASReferenceAccount[] = [
|
||||
{
|
||||
account_number: '4000',
|
||||
account_name: 'Inköp av handelsvaror (gruppkonto)',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av handelsvaror (gruppkonto)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4010',
|
||||
account_name: 'Inköp av handelsvaror i Sverige',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Kostnader for inkop av varor avsedda for vidareforssaljning.',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4060',
|
||||
account_name: 'Inköp av handelsvaror i Sverige, omvänd betalningsskyldighet',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av handelsvaror i Sverige, omvänd betalningsskyldighet',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4065',
|
||||
account_name: 'Inköp av handelsvaror i Sverige, omvänd betalningsskyldighet, 25 % moms',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av handelsvaror i Sverige, omvänd betalningsskyldighet, 25 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4066',
|
||||
account_name: 'Inköp av handelsvaror i Sverige, omvänd betalningsskyldighet, 12 % moms',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av handelsvaror i Sverige, omvänd betalningsskyldighet, 12 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4067',
|
||||
account_name: 'Inköp av handelsvaror i Sverige, omvänd betalningsskyldighet, 6 % moms',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av handelsvaror i Sverige, omvänd betalningsskyldighet, 6 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4070',
|
||||
account_name: 'Inköp av handelsvaror från annat EU-land',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av handelsvaror från annat EU-land',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4075',
|
||||
account_name: 'Inköp av handelsvaror från annat EUland, 25 % moms',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av handelsvaror från annat EUland, 25 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4076',
|
||||
account_name: 'Inköp av handelsvaror från annat EUland, 12 % moms',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av handelsvaror från annat EUland, 12 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4077',
|
||||
account_name: 'Inköp av handelsvaror från annat EUland, 6 % moms',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av handelsvaror från annat EUland, 6 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4078',
|
||||
account_name: 'Inköp av handelsvaror från annat EUland, momsfri',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av handelsvaror från annat EUland, momsfri',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4080',
|
||||
account_name: 'Import av handelsvaror',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Import av handelsvaror',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4085',
|
||||
account_name: 'Import av handelsvaror, 25 % moms',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Import av handelsvaror, 25 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4086',
|
||||
account_name: 'Import av handelsvaror, 12 % moms',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Import av handelsvaror, 12 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4087',
|
||||
account_name: 'Import av handelsvaror, 6 % moms',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Import av handelsvaror, 6 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4090',
|
||||
account_name: 'Erhållna rabatter (Handelsvaror)',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Erhållna rabatter (Handelsvaror)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4091',
|
||||
account_name: 'Erhållna kassarabatter (Handelsvaror)',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Erhållna kassarabatter (Handelsvaror)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4092',
|
||||
account_name: 'Erhållna mängdrabatter (inkl. bonus) (Handelsvaror)',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Erhållna mängdrabatter (inkl. bonus) (Handelsvaror)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4099',
|
||||
account_name: 'Övriga reduktioner av inköpspriser (Handelsvaror) 42 SÅLDA HANDELSVAROR VMB',
|
||||
account_class: 4,
|
||||
account_group: '40',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Övriga reduktioner av inköpspriser (Handelsvaror) 42 SÅLDA HANDELSVAROR VMB',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4200',
|
||||
account_name: 'Sålda handelsvaror VMB (gruppkonto)',
|
||||
account_class: 4,
|
||||
account_group: '42',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Sålda handelsvaror VMB (gruppkonto)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4210',
|
||||
account_name: 'Sålda handelsvaror VMB',
|
||||
account_class: 4,
|
||||
account_group: '42',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Sålda handelsvaror VMB',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4211',
|
||||
account_name: 'Sålda handelsvaror positiv VMB 25 %',
|
||||
account_class: 4,
|
||||
account_group: '42',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Sålda handelsvaror positiv VMB 25 %',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4212',
|
||||
account_name: 'Sålda handelsvaror negativ VMB 25 % 43 INKÖP AV RÅVAROR OCH MATERIAL I SVERIGE (RÅVAROR OCH FÖRNÖDENHETER)',
|
||||
account_class: 4,
|
||||
account_group: '42',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Sålda handelsvaror negativ VMB 25 % 43 INKÖP AV RÅVAROR OCH MATERIAL I SVERIGE (RÅVAROR OCH FÖRNÖDENHETER)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4300',
|
||||
account_name: 'Inköp av råvaror och material i Sverige (gruppkonto)',
|
||||
account_class: 4,
|
||||
account_group: '43',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av råvaror och material i Sverige (gruppkonto)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4310',
|
||||
account_name: 'Inköp av råvaror och material i Sverige 44 INKÖP AV RÅVAROR OCH MATERIAL, TJÄNSTER M.M. I SVERIGE, OMVÄND BETALNINGSSKYLDIGHET (RÅVAROR OCH FÖRNÖDENHETER)',
|
||||
account_class: 4,
|
||||
account_group: '43',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av råvaror och material i Sverige 44 INKÖP AV RÅVAROR OCH MATERIAL, TJÄNSTER M.M. I SVERIGE, OMVÄND BETALNINGSSKYLDIGHET (RÅVAROR OCH FÖRNÖDENHETER)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4400',
|
||||
account_name: 'Inköp av råvaror och material, tjänster m.m. i Sverige, omvänd betalningsskyldighet (gruppkonto)',
|
||||
account_class: 4,
|
||||
account_group: '44',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av råvaror och material, tjänster m.m. i Sverige, omvänd betalningsskyldighet (gruppkonto)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4410',
|
||||
account_name: 'Inköp av råvaror och material i Sverige, omvänd betalningsskyldighet',
|
||||
account_class: 4,
|
||||
account_group: '44',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av råvaror och material i Sverige, omvänd betalningsskyldighet',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4415',
|
||||
account_name: 'Inköp av råvaror och material i Sverige, omvänd betalningsskyldighet, 25 % moms',
|
||||
account_class: 4,
|
||||
account_group: '44',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av råvaror och material i Sverige, omvänd betalningsskyldighet, 25 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4416',
|
||||
account_name: 'Inköp av råvaror och material i Sverige, omvänd betalningsskyldighet, 12 % moms',
|
||||
account_class: 4,
|
||||
account_group: '44',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av råvaror och material i Sverige, omvänd betalningsskyldighet, 12 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4417',
|
||||
account_name: 'Inköp av råvaror och material i Sverige, omvänd betalningsskyldighet, 6 % moms',
|
||||
account_class: 4,
|
||||
account_group: '44',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av råvaror och material i Sverige, omvänd betalningsskyldighet, 6 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4420',
|
||||
account_name: 'Inköp av tjänster i Sverige, omvänd betalningsskyldighet',
|
||||
account_class: 4,
|
||||
account_group: '44',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av tjänster i Sverige, omvänd betalningsskyldighet',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4425',
|
||||
account_name: 'Inköp av tjänster i Sverige, omvänd betalningsskyldighet, 25 % moms',
|
||||
account_class: 4,
|
||||
account_group: '44',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av tjänster i Sverige, omvänd betalningsskyldighet, 25 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4426',
|
||||
account_name: 'Inköp av tjänster i Sverige, omvänd betalningsskyldighet, 12 % moms',
|
||||
account_class: 4,
|
||||
account_group: '44',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av tjänster i Sverige, omvänd betalningsskyldighet, 12 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4427',
|
||||
account_name: 'Inköp av tjänster i Sverige, omvänd betalningsskyldighet, 6 % moms 45 INKÖP AV RÅVAROR OCH MATERIAL, TJÄNSTER M.M. FRÅN UTLANDET (RÅVAROR OCH FÖRNÖDENHETER)',
|
||||
account_class: 4,
|
||||
account_group: '44',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av tjänster i Sverige, omvänd betalningsskyldighet, 6 % moms 45 INKÖP AV RÅVAROR OCH MATERIAL, TJÄNSTER M.M. FRÅN UTLANDET (RÅVAROR OCH FÖRNÖDENHETER)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4500',
|
||||
account_name: 'Inköp av råvaror och material, tjänster m.m. från utlandet (gruppkonto)',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Varuinkop fran utlandet (ravaror och fornodenheter).',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4510',
|
||||
account_name: 'Inköp av råvaror och material från annat EU-land',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av råvaror och material från annat EU-land',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4515',
|
||||
account_name: 'Inköp av råvaror och material från annat EU-land, 25 %',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av råvaror och material från annat EU-land, 25 %',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4516',
|
||||
account_name: 'Inköp av råvaror och material från annat EU-land, 12 %',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av råvaror och material från annat EU-land, 12 %',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4517',
|
||||
account_name: 'Inköp av råvaror och material från annat EU-land, 6 %',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av råvaror och material från annat EU-land, 6 %',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4518',
|
||||
account_name: 'Inköp av råvaror och material från annat EU-land, momsfri',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av råvaror och material från annat EU-land, momsfri',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4530',
|
||||
account_name: 'Inköp av tjänster m.m. från utlandet',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av tjänster m.m. från utlandet',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4531',
|
||||
account_name: 'Inköp av tjänster från ett land utanför EU, 25 % moms',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av tjänster från ett land utanför EU, 25 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4532',
|
||||
account_name: 'Inköp av tjänster från ett land utanför EU, 12 % moms',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av tjänster från ett land utanför EU, 12 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4533',
|
||||
account_name: 'Inköp av tjänster från ett land utanför EU, 6 % moms',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av tjänster från ett land utanför EU, 6 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4535',
|
||||
account_name: 'Inköp av tjänster från annat EU-land, 25 %',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av tjänster från annat EU-land, 25 %',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4536',
|
||||
account_name: 'Inköp av tjänster från annat EU-land, 12 %',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av tjänster från annat EU-land, 12 %',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4537',
|
||||
account_name: 'Inköp av tjänster från annat EU-land, 6 %',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av tjänster från annat EU-land, 6 %',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4538',
|
||||
account_name: 'Inköp av tjänster från annat EU-land, momsfri',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av tjänster från annat EU-land, momsfri',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4540',
|
||||
account_name: 'Import av råvaror och material',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Import av råvaror och material',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4545',
|
||||
account_name: 'Import av råvaror och material, 25 % moms',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Import av råvaror och material, 25 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4546',
|
||||
account_name: 'Import av råvaror och material, 12 % moms',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Import av råvaror och material, 12 % moms',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4547',
|
||||
account_name: 'Import av råvaror och material, 6 % moms 46 INKÖP AV TJÄNSTER, UNDERENTREPRENADER OCH LEGOARBETEN I SVERIGE (RÅVAROR OCH FÖRNÖDENHETER)',
|
||||
account_class: 4,
|
||||
account_group: '45',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Import av råvaror och material, 6 % moms 46 INKÖP AV TJÄNSTER, UNDERENTREPRENADER OCH LEGOARBETEN I SVERIGE (RÅVAROR OCH FÖRNÖDENHETER)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4600',
|
||||
account_name: 'Inköp av tjänster, underentreprenader och legoarbeten i Sverige (gruppkonto)',
|
||||
account_class: 4,
|
||||
account_group: '46',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Kostnader for arbete utfort av underleverantorer som del av leverans till kund.',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4610',
|
||||
account_name: 'Inköp av tjänster och underentreprenader',
|
||||
account_class: 4,
|
||||
account_group: '46',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av tjänster och underentreprenader',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4670',
|
||||
account_name: 'Inköp av legoarbeten 47 REDUKTION AV INKÖPSPRISER (RÅVAROR OCH FÖRNÖDENHETER)',
|
||||
account_class: 4,
|
||||
account_group: '46',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Inköp av legoarbeten 47 REDUKTION AV INKÖPSPRISER (RÅVAROR OCH FÖRNÖDENHETER)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4700',
|
||||
account_name: 'Reduktion av inköpspriser (gruppkonto)',
|
||||
account_class: 4,
|
||||
account_group: '47',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Reduktion av inköpspriser (gruppkonto)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4730',
|
||||
account_name: 'Erhållna rabatter (Råvaror och förnödenheter)',
|
||||
account_class: 4,
|
||||
account_group: '47',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Erhållna rabatter (Råvaror och förnödenheter)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4731',
|
||||
account_name: 'Erhållna kassarabatter (Råvaror och förnödenheter)',
|
||||
account_class: 4,
|
||||
account_group: '47',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Erhållna kassarabatter (Råvaror och förnödenheter)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4732',
|
||||
account_name: 'Erhållna mängdrabatter (inkl. bonus) (Råvaror och förnödenheter)',
|
||||
account_class: 4,
|
||||
account_group: '47',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Erhållna mängdrabatter (inkl. bonus) (Råvaror och förnödenheter)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4739',
|
||||
account_name: 'Övriga reduktioner av inköpspriser (Råvaror och förnödenheter) 48 ANDRA PRODUKTIONSKOSTNADER (RÅVAROR OCH FÖRNÖDENHETER)',
|
||||
account_class: 4,
|
||||
account_group: '47',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Övriga reduktioner av inköpspriser (Råvaror och förnödenheter) 48 ANDRA PRODUKTIONSKOSTNADER (RÅVAROR OCH FÖRNÖDENHETER)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4800',
|
||||
account_name: 'Andra produktionskostnader (gruppkonto)',
|
||||
account_class: 4,
|
||||
account_group: '48',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Andra produktionskostnader (gruppkonto)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4810',
|
||||
account_name: 'Kostnader för energi (Råvaror och förnödenheter)',
|
||||
account_class: 4,
|
||||
account_group: '48',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Kostnader för energi (Råvaror och förnödenheter)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4820',
|
||||
account_name: 'Kostnader för drivmedel (Råvaror och förnödenheter)',
|
||||
account_class: 4,
|
||||
account_group: '48',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Kostnader för drivmedel (Råvaror och förnödenheter)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4830',
|
||||
account_name: 'Kostnader för resor (Råvaror och förnödenheter)',
|
||||
account_class: 4,
|
||||
account_group: '48',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Kostnader för resor (Råvaror och förnödenheter)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4840',
|
||||
account_name: 'Kostnader för hyra av utrustning (Råvaror och förnödenheter)',
|
||||
account_class: 4,
|
||||
account_group: '48',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Kostnader för hyra av utrustning (Råvaror och förnödenheter)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4890',
|
||||
account_name: 'Övriga produktionskostnader (Råvaror och förnödenheter) 49 FÖRÄNDRING AV LAGER, PRODUKTER I ARBETE OCH PÅGÅENDE ARBETEN',
|
||||
account_class: 4,
|
||||
account_group: '48',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'debit',
|
||||
description: 'Övriga produktionskostnader (Råvaror och förnödenheter) 49 FÖRÄNDRING AV LAGER, PRODUKTER I ARBETE OCH PÅGÅENDE ARBETEN',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4900',
|
||||
account_name: 'Förändring av lager (gruppkonto)',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Förändring av lager (gruppkonto)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4910',
|
||||
account_name: 'Förändring av lager av råvaror',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Förändring av lager av råvaror',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4920',
|
||||
account_name: 'Förändring av lager av tillsatsmaterial och förnödenheter',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Förändring av lager av tillsatsmaterial och förnödenheter',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4940',
|
||||
account_name: 'Förändring av produkter i arbete',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Förändring av produkter i arbete',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4944',
|
||||
account_name: 'Förändring av produkter i arbete, material och utlägg',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Förändring av produkter i arbete, material och utlägg',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4945',
|
||||
account_name: 'Förändring av produkter i arbete, omkostnader',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Förändring av produkter i arbete, omkostnader',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4947',
|
||||
account_name: 'Förändring av produkter i arbete, personalkostnader',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Förändring av produkter i arbete, personalkostnader',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4950',
|
||||
account_name: 'Förändring av lager av färdiga varor',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Förändring av lager av färdiga varor',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4960',
|
||||
account_name: 'Förändring av lager av handelsvaror',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Förändring av lager av handelsvaror',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4970',
|
||||
account_name: 'Förändring av pågående arbeten, nedlagda kostnader',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Förändring av pågående arbeten, nedlagda kostnader',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4974',
|
||||
account_name: 'Förändring av pågående arbeten, material och utlägg',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Förändring av pågående arbeten, material och utlägg',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4975',
|
||||
account_name: 'Förändring av pågående arbeten, omkostnader',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Förändring av pågående arbeten, omkostnader',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4977',
|
||||
account_name: 'Förändring av pågående arbeten, personalkostnader',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Förändring av pågående arbeten, personalkostnader',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4980',
|
||||
account_name: 'Förändring av lager av värdepapper (Handelsvaror)',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Förändring av lager av värdepapper (Handelsvaror)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4981',
|
||||
account_name: 'Sålda värdepappers anskaffningsvärde (Handelsvaror)',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Sålda värdepappers anskaffningsvärde (Handelsvaror)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4987',
|
||||
account_name: 'Nedskrivning av värdepapper (Handelsvaror)',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Nedskrivning av värdepapper (Handelsvaror)',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
{
|
||||
account_number: '4988',
|
||||
account_name: 'Återföring av nedskrivning av värdepapper (Handelsvaror) 50 LOKALKOSTNADER',
|
||||
account_class: 4,
|
||||
account_group: '49',
|
||||
account_type: 'expense',
|
||||
normal_balance: 'credit',
|
||||
description: 'Återföring av nedskrivning av värdepapper (Handelsvaror) 50 LOKALKOSTNADER',
|
||||
sru_code: '7320',
|
||||
k2_excluded: false,
|
||||
},
|
||||
]
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
import { CLASS_1_ACCOUNTS } from './class-1-assets'
|
||||
import { CLASS_2_ACCOUNTS } from './class-2-equity-liabilities'
|
||||
import { CLASS_3_ACCOUNTS } from './class-3-revenue'
|
||||
import { CLASS_4_ACCOUNTS } from './class-4-purchases'
|
||||
import { CLASS_5_ACCOUNTS } from './class-5-external-expenses'
|
||||
import { CLASS_6_ACCOUNTS } from './class-6-other-external'
|
||||
import { CLASS_7_ACCOUNTS } from './class-7-personnel'
|
||||
import { CLASS_8_ACCOUNTS } from './class-8-financial'
|
||||
|
||||
import type { BASReferenceAccount } from '../bas-reference'
|
||||
|
||||
export const BAS_REFERENCE: BASReferenceAccount[] = [
|
||||
...CLASS_1_ACCOUNTS,
|
||||
...CLASS_2_ACCOUNTS,
|
||||
...CLASS_3_ACCOUNTS,
|
||||
...CLASS_4_ACCOUNTS,
|
||||
...CLASS_5_ACCOUNTS,
|
||||
...CLASS_6_ACCOUNTS,
|
||||
...CLASS_7_ACCOUNTS,
|
||||
...CLASS_8_ACCOUNTS,
|
||||
]
|
||||
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* SRU Code Computation
|
||||
*
|
||||
* Replicates the range-based SRU code assignment logic from
|
||||
* supabase/migrations/20240101000021_sru_codes.sql.
|
||||
*
|
||||
* SRU codes are used for NE (enskild firma) and INK2 (aktiebolag) tax forms
|
||||
* filed with Skatteverket.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Compute the SRU code for a given BAS account number.
|
||||
*
|
||||
* The logic applies NE-form codes first (higher priority for revenue/expense
|
||||
* accounts), then falls back to INK2 balance sheet codes.
|
||||
*/
|
||||
export function computeSRUCode(accountNumber: string): string | null {
|
||||
const num = accountNumber
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// NE form codes (enskild firma) — fields 7310-7325
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// NE: R1 - Försäljning med moms (3000-3499 excl 3100)
|
||||
if (num >= '3000' && num <= '3499' && num !== '3100') return '7310'
|
||||
|
||||
// NE: R2 - Momsfria intäkter (3100, 3900, 3970-3980)
|
||||
if (num === '3100' || num === '3900' || (num >= '3970' && num <= '3980')) return '7311'
|
||||
|
||||
// NE: R3 - Bil/bostadsförmån (3200-3299) — overlaps with R1, R1 wins
|
||||
if (num >= '3200' && num <= '3299') return '7312'
|
||||
|
||||
// NE: R4 - Ränteintäkter (8310-8330)
|
||||
if (num >= '8310' && num <= '8330') return '7313'
|
||||
|
||||
// NE: R5 - Varuinköp (4000-4990)
|
||||
if (num >= '4000' && num <= '4990') return '7320'
|
||||
|
||||
// NE: R6 - Övriga kostnader (5000-6990, 7970)
|
||||
if ((num >= '5000' && num <= '6990') || num === '7970') return '7321'
|
||||
|
||||
// NE: R7 - Lönekostnader (7000-7699)
|
||||
if (num >= '7000' && num <= '7699') return '7322'
|
||||
|
||||
// NE: R8 - Räntekostnader (8400-8499)
|
||||
if (num >= '8400' && num <= '8499') return '7323'
|
||||
|
||||
// NE: R9 - Avskrivningar fastighet (7820)
|
||||
if (num === '7820') return '7324'
|
||||
|
||||
// NE: R10 - Avskrivningar övrigt (7700-7899 excl 7820)
|
||||
if (num >= '7700' && num <= '7899' && num !== '7820') return '7325'
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// INK2 form codes (aktiebolag) — fields 7201-7380
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// INK2: Immateriella anläggningstillgångar (1000-1099)
|
||||
if (num >= '1000' && num <= '1099') return '7201'
|
||||
|
||||
// INK2: Materiella anläggningstillgångar (1100-1299)
|
||||
if (num >= '1100' && num <= '1299') return '7202'
|
||||
|
||||
// INK2: Finansiella anläggningstillgångar (1300-1399)
|
||||
if (num >= '1300' && num <= '1399') return '7203'
|
||||
|
||||
// INK2: Varulager (1400-1499)
|
||||
if (num >= '1400' && num <= '1499') return '7210'
|
||||
|
||||
// INK2: Kundfordringar (1500-1599)
|
||||
if (num >= '1500' && num <= '1599') return '7211'
|
||||
|
||||
// INK2: Övriga omsättningstillgångar (1600-1999)
|
||||
if (num >= '1600' && num <= '1999') return '7212'
|
||||
|
||||
// INK2: Aktiekapital (2081)
|
||||
if (num === '2081') return '7220'
|
||||
|
||||
// INK2: Övrigt eget kapital (2085-2098)
|
||||
if (num >= '2085' && num <= '2098') return '7221'
|
||||
|
||||
// INK2: Årets resultat (2099)
|
||||
if (num === '2099') return '7222'
|
||||
|
||||
// INK2: Skulder (2100-2499)
|
||||
if (num >= '2100' && num <= '2499') return '7230'
|
||||
|
||||
// INK2: Övriga skulder (2500-2999)
|
||||
if (num >= '2500' && num <= '2999') return '7231'
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// INK2 remaining income statement (fallback for class 3-8 not covered by NE)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
if (num >= '3000' && num <= '3999') return '7310'
|
||||
if (num >= '4000' && num <= '4999') return '7320'
|
||||
if (num >= '5000' && num <= '6999') return '7330'
|
||||
if (num >= '7000' && num <= '7699') return '7340'
|
||||
if (num >= '7700' && num <= '7899') return '7350'
|
||||
if (num >= '7900' && num <= '7999') return '7360'
|
||||
if (num >= '8000' && num <= '8499') return '7370'
|
||||
if (num >= '8500' && num <= '8999') return '7380'
|
||||
|
||||
// Equity accounts not covered above (2000-2084)
|
||||
if (num >= '2000' && num <= '2084') return '7221'
|
||||
|
||||
return null
|
||||
}
|
||||
Reference in New Issue
Block a user