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
@@ -0,0 +1,269 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import {
|
||||
BAS_REFERENCE,
|
||||
ACCOUNT_CLASS_LABELS,
|
||||
ACCOUNT_GROUP_LABELS,
|
||||
getBASReference,
|
||||
getBASReferenceByClass,
|
||||
isStandardBASAccount,
|
||||
} from '../bas-reference'
|
||||
|
||||
describe('BAS_REFERENCE data integrity', () => {
|
||||
it('contains the expected number of accounts (~1,276)', () => {
|
||||
expect(BAS_REFERENCE.length).toBeGreaterThanOrEqual(1250)
|
||||
expect(BAS_REFERENCE.length).toBeLessThanOrEqual(1300)
|
||||
})
|
||||
|
||||
it('has no duplicate account numbers', () => {
|
||||
const numbers = BAS_REFERENCE.map((a) => a.account_number)
|
||||
const uniqueNumbers = new Set(numbers)
|
||||
expect(uniqueNumbers.size).toBe(numbers.length)
|
||||
})
|
||||
|
||||
it('account_class matches the first digit of account_number', () => {
|
||||
for (const account of BAS_REFERENCE) {
|
||||
const firstDigit = parseInt(account.account_number[0], 10)
|
||||
expect(account.account_class).toBe(firstDigit)
|
||||
}
|
||||
})
|
||||
|
||||
it('account_group matches the first two digits of account_number', () => {
|
||||
for (const account of BAS_REFERENCE) {
|
||||
const firstTwo = account.account_number.substring(0, 2)
|
||||
expect(account.account_group).toBe(firstTwo)
|
||||
}
|
||||
})
|
||||
|
||||
it('every account has a non-null sru_code', () => {
|
||||
const withoutSru = BAS_REFERENCE.filter((a) => a.sru_code === null)
|
||||
expect(withoutSru).toEqual([])
|
||||
})
|
||||
|
||||
it('every account has a non-empty description', () => {
|
||||
const withoutDesc = BAS_REFERENCE.filter((a) => !a.description || a.description.trim() === '')
|
||||
expect(withoutDesc).toEqual([])
|
||||
})
|
||||
|
||||
it('every account has a valid account_type', () => {
|
||||
const validTypes = ['asset', 'liability', 'equity', 'revenue', 'expense', 'untaxed_reserves']
|
||||
for (const account of BAS_REFERENCE) {
|
||||
expect(validTypes).toContain(account.account_type)
|
||||
}
|
||||
})
|
||||
|
||||
it('every account has a valid normal_balance', () => {
|
||||
for (const account of BAS_REFERENCE) {
|
||||
expect(['debit', 'credit']).toContain(account.normal_balance)
|
||||
}
|
||||
})
|
||||
|
||||
it('all account numbers are 4 digits', () => {
|
||||
for (const account of BAS_REFERENCE) {
|
||||
expect(account.account_number).toMatch(/^\d{4}$/)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('Non-standard accounts removed', () => {
|
||||
const nonStandard = ['1249', '1259', '1400', '1580', '3109', '4100', '4990', '7834', '7835', '7910', '8710']
|
||||
|
||||
for (const num of nonStandard) {
|
||||
it(`${num} is not in the catalog`, () => {
|
||||
expect(isStandardBASAccount(num)).toBe(false)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
describe('Class 2 account_type correctness', () => {
|
||||
it('20xx accounts are equity', () => {
|
||||
const group20 = BAS_REFERENCE.filter((a) => a.account_group === '20')
|
||||
expect(group20.length).toBeGreaterThan(0)
|
||||
for (const a of group20) {
|
||||
expect(a.account_type).toBe('equity')
|
||||
}
|
||||
})
|
||||
|
||||
it('21xx accounts are untaxed_reserves', () => {
|
||||
const group21 = BAS_REFERENCE.filter((a) => a.account_group === '21')
|
||||
expect(group21.length).toBeGreaterThan(0)
|
||||
for (const a of group21) {
|
||||
expect(a.account_type).toBe('untaxed_reserves')
|
||||
}
|
||||
})
|
||||
|
||||
it('22xx-29xx accounts are liability', () => {
|
||||
const liabilityGroups = BAS_REFERENCE.filter(
|
||||
(a) => a.account_class === 2 && parseInt(a.account_group) >= 22
|
||||
)
|
||||
expect(liabilityGroups.length).toBeGreaterThan(0)
|
||||
for (const a of liabilityGroups) {
|
||||
expect(a.account_type).toBe('liability')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('Class 8 normal_balance correctness', () => {
|
||||
it('8310 (Ränteintäkter) has credit normal_balance', () => {
|
||||
const account = getBASReference('8310')
|
||||
expect(account).toBeDefined()
|
||||
expect(account!.normal_balance).toBe('credit')
|
||||
})
|
||||
|
||||
it('8410 (Räntekostnader) has debit normal_balance', () => {
|
||||
const account = getBASReference('8410')
|
||||
expect(account).toBeDefined()
|
||||
expect(account!.normal_balance).toBe('debit')
|
||||
})
|
||||
|
||||
it('8910 (Skatt) has debit normal_balance', () => {
|
||||
const account = getBASReference('8910')
|
||||
expect(account).toBeDefined()
|
||||
expect(account!.normal_balance).toBe('debit')
|
||||
})
|
||||
|
||||
it('8810 (Bokslutsdispositioner) has credit normal_balance', () => {
|
||||
const account = getBASReference('8810')
|
||||
expect(account).toBeDefined()
|
||||
expect(account!.normal_balance).toBe('credit')
|
||||
})
|
||||
})
|
||||
|
||||
describe('Contra accounts have opposite normal_balance', () => {
|
||||
it('1119 (Ack. avskrivningar byggnader) has credit balance', () => {
|
||||
const account = getBASReference('1119')
|
||||
expect(account).toBeDefined()
|
||||
expect(account!.normal_balance).toBe('credit')
|
||||
})
|
||||
|
||||
it('1229 (Ack. avskrivningar inventarier) has credit balance', () => {
|
||||
const account = getBASReference('1229')
|
||||
expect(account).toBeDefined()
|
||||
expect(account!.normal_balance).toBe('credit')
|
||||
})
|
||||
|
||||
it('2011 (Egna varuuttag) has debit balance', () => {
|
||||
const account = getBASReference('2011')
|
||||
expect(account).toBeDefined()
|
||||
expect(account!.normal_balance).toBe('debit')
|
||||
})
|
||||
|
||||
it('3740 (Öres- och kronutjämning) has debit balance', () => {
|
||||
const account = getBASReference('3740')
|
||||
expect(account).toBeDefined()
|
||||
expect(account!.normal_balance).toBe('debit')
|
||||
})
|
||||
})
|
||||
|
||||
describe('K2-excluded accounts', () => {
|
||||
const k2Excluded = [
|
||||
'1010', '1011', '1012', '1018', '1019',
|
||||
'1370', '1518',
|
||||
'2092', '2096', '2240', '2448',
|
||||
'3940', '7940',
|
||||
'8290', '8291', '8295',
|
||||
'8320', '8321', '8325',
|
||||
'8450', '8451', '8455',
|
||||
'8480', '8940',
|
||||
]
|
||||
|
||||
it('known K2-excluded accounts are marked correctly', () => {
|
||||
for (const num of k2Excluded) {
|
||||
const account = getBASReference(num)
|
||||
expect(account).toBeDefined()
|
||||
expect(account!.k2_excluded).toBe(true)
|
||||
}
|
||||
})
|
||||
|
||||
it('common non-K2-excluded accounts are not marked', () => {
|
||||
const normalAccounts = ['1510', '1930', '2440', '3001', '4010', '5010', '7010', '8310']
|
||||
for (const num of normalAccounts) {
|
||||
const account = getBASReference(num)
|
||||
expect(account).toBeDefined()
|
||||
expect(account!.k2_excluded).toBe(false)
|
||||
}
|
||||
})
|
||||
|
||||
it('total K2-excluded count matches expected (24)', () => {
|
||||
const k2Count = BAS_REFERENCE.filter((a) => a.k2_excluded).length
|
||||
expect(k2Count).toBe(24)
|
||||
})
|
||||
})
|
||||
|
||||
describe('ACCOUNT_GROUP_LABELS coverage', () => {
|
||||
it('all groups present in BAS_REFERENCE have labels', () => {
|
||||
const groups = new Set(BAS_REFERENCE.map((a) => a.account_group))
|
||||
for (const group of groups) {
|
||||
expect(ACCOUNT_GROUP_LABELS[group]).toBeDefined()
|
||||
}
|
||||
})
|
||||
|
||||
it('covers at least 70 groups', () => {
|
||||
expect(Object.keys(ACCOUNT_GROUP_LABELS).length).toBeGreaterThanOrEqual(70)
|
||||
})
|
||||
})
|
||||
|
||||
describe('ACCOUNT_CLASS_LABELS', () => {
|
||||
it('has labels for all 8 classes', () => {
|
||||
for (let i = 1; i <= 8; i++) {
|
||||
expect(ACCOUNT_CLASS_LABELS[i]).toBeDefined()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('Helper functions', () => {
|
||||
it('getBASReference returns correct account', () => {
|
||||
const account = getBASReference('1930')
|
||||
expect(account).toBeDefined()
|
||||
expect(account!.account_name).toBe('Företagskonto')
|
||||
expect(account!.account_type).toBe('asset')
|
||||
})
|
||||
|
||||
it('getBASReference returns undefined for non-existent account', () => {
|
||||
expect(getBASReference('9999')).toBeUndefined()
|
||||
})
|
||||
|
||||
it('getBASReferenceByClass returns accounts for each class', () => {
|
||||
for (let cls = 1; cls <= 8; cls++) {
|
||||
const accounts = getBASReferenceByClass(cls)
|
||||
expect(accounts.length).toBeGreaterThan(0)
|
||||
for (const a of accounts) {
|
||||
expect(a.account_class).toBe(cls)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
it('getBASReferenceByClass returns empty array for non-existent class', () => {
|
||||
expect(getBASReferenceByClass(9)).toEqual([])
|
||||
})
|
||||
|
||||
it('isStandardBASAccount returns true for standard accounts', () => {
|
||||
expect(isStandardBASAccount('1510')).toBe(true)
|
||||
expect(isStandardBASAccount('3001')).toBe(true)
|
||||
expect(isStandardBASAccount('8999')).toBe(true)
|
||||
})
|
||||
|
||||
it('isStandardBASAccount returns false for non-standard accounts', () => {
|
||||
expect(isStandardBASAccount('9999')).toBe(false)
|
||||
expect(isStandardBASAccount('0000')).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('Account class distribution', () => {
|
||||
it('class 1 (assets) has ~230 accounts', () => {
|
||||
const cls = getBASReferenceByClass(1)
|
||||
expect(cls.length).toBeGreaterThanOrEqual(220)
|
||||
expect(cls.length).toBeLessThanOrEqual(240)
|
||||
})
|
||||
|
||||
it('class 2 (equity & liabilities) has ~265 accounts', () => {
|
||||
const cls = getBASReferenceByClass(2)
|
||||
expect(cls.length).toBeGreaterThanOrEqual(255)
|
||||
expect(cls.length).toBeLessThanOrEqual(275)
|
||||
})
|
||||
|
||||
it('class 3 (revenue) has ~100 accounts', () => {
|
||||
const cls = getBASReferenceByClass(3)
|
||||
expect(cls.length).toBeGreaterThanOrEqual(90)
|
||||
expect(cls.length).toBeLessThanOrEqual(110)
|
||||
})
|
||||
})
|
||||
@@ -1,4 +1,4 @@
|
||||
export type AccountType = 'asset' | 'liability' | 'equity' | 'revenue' | 'expense'
|
||||
export type AccountType = 'asset' | 'liability' | 'equity' | 'revenue' | 'expense' | 'untaxed_reserves'
|
||||
|
||||
export interface AccountDescription {
|
||||
name: string
|
||||
|
||||
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
|
||||
}
|
||||
+53
-1939
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Template Prompt Builder
|
||||
*
|
||||
* Generates the booking template list section for AI extraction prompts.
|
||||
* Used by both receipt-analyzer and invoice-analyzer to stay in sync.
|
||||
*/
|
||||
|
||||
import { BOOKING_TEMPLATES } from './booking-templates'
|
||||
|
||||
/**
|
||||
* Build the template list section for AI prompts.
|
||||
* Lists all expense templates with their Swedish name, primary debit account, and VAT rate.
|
||||
*/
|
||||
export function buildTemplatePromptSection(): string {
|
||||
const expenseTemplates = BOOKING_TEMPLATES.filter((t) => t.direction === 'expense')
|
||||
|
||||
const lines = expenseTemplates.map((t) => {
|
||||
const vatInfo = t.vat_rate > 0 ? `moms ${t.vat_rate * 100}%` : 'momsfri'
|
||||
return `- ${t.id}: ${t.name_sv} (konto ${t.debit_account}, ${vatInfo})`
|
||||
})
|
||||
|
||||
return `BOKFÖRINGSMALLAR (välj den mest passande suggestedTemplateId):
|
||||
${lines.join('\n')}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a compact template ID list for validation.
|
||||
*/
|
||||
export function getValidTemplateIds(): string[] {
|
||||
return BOOKING_TEMPLATES.map((t) => t.id)
|
||||
}
|
||||
Reference in New Issue
Block a user