Files
accounted/lib/bokslut/types.ts
T
Jakob Wennberg 12c59399ee fix(bokslut): remove uppskjuten skatt on obeskattade reserver in juridisk person (K3 29.37) (#1421)
* fix(bokslut): remove uppskjuten skatt on obeskattade reserver in juridisk person (K3 29.37) and confirm K3 to K2 reversion

In juridisk person K3 29.37 keeps obeskattade reserver at gross; the 79.4/20.6 split belongs to koncernredovisning. The old disposition double-counted the tax portion (result charged twice, 2240 overstated on top of gross 21xx). Removes the proposal step, POST kind, UI case, K2-to-K3 account seeding and the interim framework gate; keeps LATENT_TAX_DEFAULT_RATE for analytical soliditet presentation. Also adds the K3-to-K2 consequence confirmation dialog in settings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* docs(decisions): scope the batch log to shipped code and record the 29.37 election nuance

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(settings): stop promising deferred-tax accounting the engine no longer does

The framework help text and the K2-to-K3 confirmation both told the user that switching to K3 means uppskjuten skatt is recognised separately on 2240/8940 with a 79.4/20.6 split. This PR removes exactly that behaviour, so the copy would have promised something the product does not do, which is the defect class this batch exists to remove. Both now describe what actually happens: kassaflodesanalys, komponentavskrivning and a wider note set, with obeskattade reserver carried gross per K3 29.37.

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>
2026-08-06 10:05:15 +02:00

89 lines
3.2 KiB
TypeScript

import type { CreateJournalEntryLineInput } from '@/types'
export type DispositionKind =
| 'bolagsskatt'
| 'periodiseringsfond_avsattning'
| 'periodiseringsfond_ateforing'
| 'overavskrivningar'
| 'sarskild_loneskatt'
/**
* Common shape every bokslut-disposition calculator returns. The wizard renders
* one card per proposal; the API endpoint accepts a list of `{ kind, accept,
* overrideAmount? }` from the user and posts the matching entries.
*/
export interface ProposedDisposition {
kind: DispositionKind
/** Short Swedish label for UI cards (e.g. "Bolagsskatt 20,6 %"). */
label: string
/** One-sentence Swedish explanation of what the entry does. */
description: string
/** SEK amount displayed in the card header. Always a positive number. */
amount: number
/** Signed posting amount when direction matters while `amount` remains a
* positive display value. Used by over-depreciation releases. */
signedAmount?: number
/** Final voucher lines if the user accepts. Already balanced. */
lines: CreateJournalEntryLineInput[]
/** Soft warnings the UI surfaces beside the card (e.g. forced p-fond reversal,
* rate cap reached). Not blockers. */
warnings: string[]
/** Calculator-specific breakdown the UI can render in an "Visa beräkning"
* panel. Free-form so each calculator can show its own details. */
computation?: Record<string, unknown>
/** True if this proposal cannot be skipped: e.g. periodiseringsfond from
* tax year N-6 that must be reversed. UI disables the skip control. */
required?: boolean
}
export type TaxAdjustmentType = 'non_deductible_expense' | 'non_taxable_income'
export type TaxAdjustmentSource = 'detected' | 'manual'
export interface TaxAdjustmentItem {
sourceKey: string
source: TaxAdjustmentSource
adjustmentType: TaxAdjustmentType
description: string
accountNumber: string | null
amount: number
included: boolean
}
export interface TaxAdjustmentSnapshot {
items: TaxAdjustmentItem[]
nonDeductibleExpenses: number
nonTaxableIncome: number
}
export interface CompletedDisposition {
kind: DispositionKind
label: string
amount: number
status: 'booked' | 'needs_correction'
warnings: string[]
}
/**
* Snapshot of all proposed dispositions for a fiscal period, returned by the
* dispositions API. Order is the suggested user-flow order: p-fond återföring
* (mandatory) → överavskrivningar → p-fond avsättning → SLP → bolagsskatt.
* The wizard renders them in that order so each step's effect is visible to
* the next one (bolagsskatt comes last because it depends on everything else).
*/
export interface DispositionsProposal {
entityType: 'aktiebolag' | 'enskild_firma' | 'handelsbolag' | 'kommanditbolag' | 'ekonomisk_forening'
fiscalPeriod: {
id: string
name: string
period_start: string
period_end: string
}
/** Result before any new dispositions, from the income statement (positive = profit). */
netResultBefore: number
proposals: ProposedDisposition[]
taxAdjustments?: TaxAdjustmentSnapshot
completedDispositions?: CompletedDisposition[]
/** Non-blocking calculation warnings surfaced in the statutory wizard. */
warnings?: string[]
}