fix(reports): route 77xx nedskrivningar to the anläggningstillgångar RR line (#1644)
* fix(reports): route 77xx nedskrivningar to the anläggningstillgångar RR line per BAS kopplingstabell The whole 7700-7799 block was mapped to "Nedskrivningar av omsättningstillgångar utöver normala nedskrivningar" in both the K2 årsredovisning mapper (preview + filed iXBRL) and the INK2R engine. Per the official BAS kopplingstabell (INK2R 3.9/3.10), only 774x and 779x belong there; 7700-7739 and 7750-7789 (nedskrivningar of anläggningstillgångar and their återföringar) belong on "Av- och nedskrivningar av materiella och immateriella anläggningstillgångar" together with 78xx. Totals were unaffected; the line split was wrong for four BAS account groups. Reported via gnubok_feedback 2026-07-07 (K2 side). The stale swedish-sru-filing reference row carried the same error and is corrected to match. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore(skills): regenerate atom-body seed for the corrected sru-codes reference Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -258,8 +258,8 @@ Source: BAS-kontogruppen + Skatteverket joint mapping at bas.se/kontoplaner/sru/
|
||||
| 4600-4699 | 7512 | 3.6 | Handelsvaror |
|
||||
| **5000-6999** | **7513** | 3.7 | **Övriga externa kostnader (ALL accounts in range)** |
|
||||
| 7000-7699 | 7514 | 3.8 | Personalkostnader |
|
||||
| 7700-7799 | 7516 | 3.10 | Nedskrivningar omsättningstillgångar |
|
||||
| 7800-7899 | 7515 | 3.9 | Avskrivningar |
|
||||
| 7740-7749, 7790-7799 | 7516 | 3.10 | Nedskrivningar omsättningstillgångar |
|
||||
| 7700-7739, 7750-7789, 7800-7899 | 7515 | 3.9 | Av- och nedskrivningar av anläggningstillgångar (incl. återföringar) |
|
||||
| 7900-7999 | 7517 | 3.11 | Övriga rörelsekostnader |
|
||||
| 8000-8099 | 7414 | 3.12 | Resultat koncernföretag |
|
||||
| 8100-8199 | 7415 | 3.13 | Resultat intresseföretag |
|
||||
|
||||
@@ -1043,3 +1043,5 @@ One line per decision: `[YYYY-MM-DD] <decision>: <why>`. Appended by agents and
|
||||
[2026-08-17] articles.housework_type keeps two vocabularies (Skatteverket arbetstypskod, or bare ROT/RUT) instead of migrating legacy ROT/RUT rows: a kind-only row cannot be upgraded to a code without knowing the work, so the article form preserves the legacy choice as an explicit option and the invoice prefill treats it as kind-only; everything else normalizes to null and is rejected at the API.
|
||||
[2026-08-17] ROT/RUT claim completeness (arbetstyp + arbetstimmar) is enforced at invoice creation (validateInvoice + CreateInvoiceItemSchema + editor), not only at begäran-file time: the file blocker fired when the invoice was already numbered/booked/paid with no repair path short of a credit note; schablontjänster (TRANSPORT/TVATT) stay hours-exempt. Yearly ceiling accumulation is per CUSTOMER in the editor (personnummer is ciphertext client-side) and warning-only; server warnings are still dropped on success, so the editor computes its own via the shared deductionCapWarnings helper.
|
||||
[2026-08-17] invoices.remaining_amount gets a BEFORE INSERT trigger deriving total - paid_amount - deduction_total when a fresh unpaid real invoice arrives with NULL/0, instead of only fixing the writers: four writers had drifted (proforma conversion x2, MCP create_invoice, sandbox seed) and 337 open invoices on prod sat at 0, so the column's DEFAULT 0 must never be able to mean 'settled' again; UPDATE is left to the settlement code, which legitimately writes 0 on full payment. Writers fixed too (defense in depth).
|
||||
|
||||
[2026-08-17] 77xx nedskrivningar split per official BAS kopplingstabell in BOTH k2-mapper and ink2-engine (fältkod 7515: 7700-7739, 7750-7789, 7800-7899; 7516: 774x, 779x): agent feedback 2026-07-07 reported the K2 side; the INK2R side and the swedish-sru-filing reference table had the same whole-77xx-to-7516 error, verified against bas.se INK2_P1_intervall-240118.pdf before overriding the skill reference. NE-bilaga mappings deliberately untouched (NE has no separate omsättningstillgångar line).
|
||||
|
||||
@@ -300,6 +300,26 @@ describe('mapTrialBalancesToK2', () => {
|
||||
).toBe(7_000)
|
||||
expect(res.rr['HandelsvarorKostnader'].current).toBe(3_000)
|
||||
})
|
||||
|
||||
it('routes 77xx nedskrivningar per K2 split (7710-7733 → anläggningstillgångar, 7740/7790 → omsättningstillgångar)', () => {
|
||||
const rows = [
|
||||
row('7710', 'Nedskrivningar av immateriella anläggningstillgångar', 10_000, 0),
|
||||
row('7730', 'Nedskrivningar av maskiner respektive inventarier', 5_000, 0),
|
||||
row('7770', 'Återföring av nedskrivningar av byggnader och mark', 0, 2_000),
|
||||
row('7740', 'Nedskrivningar av vissa omsättningstillgångar', 4_000, 0),
|
||||
row('7790', 'Återföring av nedskrivningar av vissa omsättningstillgångar', 0, 1_000),
|
||||
row('7810', 'Avskrivningar på immateriella anläggningstillgångar', 20_000, 0),
|
||||
]
|
||||
const res = mapTrialBalancesToK2({ full: rows, preClosing: rows }, null)
|
||||
// 10 000 + 5 000 - 2 000 återföring + 20 000 avskrivningar
|
||||
expect(
|
||||
res.rr['AvskrivningarNedskrivningarMateriellaImmateriellaAnlaggningstillgangar'].current,
|
||||
).toBe(33_000)
|
||||
// 4 000 - 1 000 återföring
|
||||
expect(res.rr['NedskrivningarOmsattningstillgangarUtoverNormalaNedskrivningar'].current).toBe(
|
||||
3_000,
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('mapTrialBalancesToK2: öre-rounding residual smoothing', () => {
|
||||
|
||||
@@ -87,12 +87,17 @@ export const K2_RR_MAPPINGS: PostMapping[] = [
|
||||
{
|
||||
concept: 'AvskrivningarNedskrivningarMateriellaImmateriellaAnlaggningstillgangar',
|
||||
balance: 'debit',
|
||||
ranges: [r('7800', '7899')],
|
||||
// 7710-7733 are nedskrivningar of anläggningstillgångar and 7760-7789
|
||||
// their återföringar (credit-normal, netted within the line); only
|
||||
// 774x/779x concern omsättningstillgångar. Intervals follow the official
|
||||
// BAS kopplingstabell for INK2R 3.9/3.10 (fältkod 7515: 7700-7739,
|
||||
// 7750-7789, 7800-7899; fältkod 7516: 774x, 779x).
|
||||
ranges: [r('7700', '7739'), r('7750', '7789'), r('7800', '7899')],
|
||||
},
|
||||
{
|
||||
concept: 'NedskrivningarOmsattningstillgangarUtoverNormalaNedskrivningar',
|
||||
balance: 'debit',
|
||||
ranges: [r('7700', '7799')],
|
||||
ranges: [r('7740', '7749'), r('7790', '7799')],
|
||||
},
|
||||
{ concept: 'OvrigaRorelsekostnader', balance: 'debit', ranges: [r('7900', '7999')] },
|
||||
{ concept: 'ResultatAndelarKoncernforetag', balance: 'credit', ranges: [r('8000', '8099')] },
|
||||
|
||||
@@ -188,8 +188,19 @@ describe('INK2R Account Mappings', () => {
|
||||
expect(findSRUCodeForAccount('7899')).toBe('7515')
|
||||
})
|
||||
|
||||
it('7700-7799 -> 7516 (Nedskrivningar OT)', () => {
|
||||
expect(findSRUCodeForAccount('7700')).toBe('7516')
|
||||
it('7700-7739, 7750-7789 -> 7515 (nedskrivningar AT + återföringar)', () => {
|
||||
expect(findSRUCodeForAccount('7700')).toBe('7515')
|
||||
expect(findSRUCodeForAccount('7710')).toBe('7515')
|
||||
expect(findSRUCodeForAccount('7733')).toBe('7515')
|
||||
expect(findSRUCodeForAccount('7750')).toBe('7515')
|
||||
expect(findSRUCodeForAccount('7770')).toBe('7515')
|
||||
expect(findSRUCodeForAccount('7789')).toBe('7515')
|
||||
})
|
||||
|
||||
it('7740-7749, 7790-7799 -> 7516 (Nedskrivningar OT)', () => {
|
||||
expect(findSRUCodeForAccount('7740')).toBe('7516')
|
||||
expect(findSRUCodeForAccount('7749')).toBe('7516')
|
||||
expect(findSRUCodeForAccount('7790')).toBe('7516')
|
||||
expect(findSRUCodeForAccount('7799')).toBe('7516')
|
||||
})
|
||||
|
||||
|
||||
@@ -515,14 +515,25 @@ export const INK2R_ACCOUNT_MAPPINGS: INK2AccountMapping[] = [
|
||||
description: 'Av- och nedskrivningar materiella/immateriella',
|
||||
section: 'income_statement',
|
||||
normalBalance: 'debit',
|
||||
accountRanges: [{ start: '7800', end: '7899' }],
|
||||
// Official BAS kopplingstabell for INK2R 3.9: 7700-7739, 7750-7789,
|
||||
// 7800-7899 (nedskrivningar of anläggningstillgångar + återföringar);
|
||||
// only 774x/779x belong on 3.10. Mirrors K2_RR_MAPPINGS in
|
||||
// lib/bokslut/ixbrl/k2-mapper.ts.
|
||||
accountRanges: [
|
||||
{ start: '7700', end: '7739' },
|
||||
{ start: '7750', end: '7789' },
|
||||
{ start: '7800', end: '7899' },
|
||||
],
|
||||
},
|
||||
{
|
||||
sruCode: '7516',
|
||||
description: 'Nedskrivningar omsättningstillgångar',
|
||||
section: 'income_statement',
|
||||
normalBalance: 'debit',
|
||||
accountRanges: [{ start: '7700', end: '7799' }],
|
||||
accountRanges: [
|
||||
{ start: '7740', end: '7749' },
|
||||
{ start: '7790', end: '7799' },
|
||||
],
|
||||
},
|
||||
{
|
||||
sruCode: '7517',
|
||||
|
||||
@@ -196,8 +196,8 @@
|
||||
"version": 6
|
||||
},
|
||||
"horizontal/swedish-sru-filing/sru-codes": {
|
||||
"hash": "39625f1122caf0d3d034a98f2e5daabc2d60d2a44fd299010c9d39f58cf6635f",
|
||||
"version": 3
|
||||
"hash": "ad5f50531905891aff7bdc2d37a010eeccb8b4df902e3a7ce2b228cd6ad31e7e",
|
||||
"version": 4
|
||||
},
|
||||
"horizontal/swedish-tax-planning": {
|
||||
"hash": "99b87fac9eacf0ad168434c2bce99f21cdb8a53cb26ccabb64ba291b9059aa24",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user