fix(import): name the IB-imbalance cause and offer the manual opening-balance path (#2082) (#2252)

The SIE preview's "Ingående balanser balanserar inte" warning was a dead
end: it said the diff would be booked to 2099 and offered an acknowledge
checkbox, nothing else. A new user parsed her SpeedLedger file five times,
never reached execute, and emailed support to ask whether IB can be
entered by hand (it can, the flow just never said so).

The warning now names the usual cause in plain Swedish (föregående års
resultat never transferred to eget kapital; SpeedLedger parks it on 9030
/9031), spells out the two ways forward, and offers a button straight into
the manual "Ingående balanser" wizard (the CSV/Excel wizard's default
entity). The acknowledgement path is unchanged. Copy stays hardcoded
Swedish like the rest of the import wizard.

Not done: letting the SIE import skip IB when a period already has them
(the import refuses such a period today), and running
findUntransferredResults at parse time so the preview can name the amount.

Closes #2082


Claude-Session: https://claude.ai/code/session_01VnConrmMCxJRQ5kfiPPWyy

Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-09-03 18:55:09 +02:00
committed by GitHub
co-authored by Jakob Wennberg Claude Fable 5.1
parent 1150930cb9
commit 5070041028
2 changed files with 42 additions and 8 deletions
+11 -3
View File
@@ -700,7 +700,12 @@ const SIE_STEP_LABELS: Record<ImportWizardStep, string> = {
result: 'Resultat',
}
function SIEImportWizard() {
function SIEImportWizard({
onOpenManualOpeningBalances,
}: {
/** Switch to the manual "Ingående balanser" wizard (SIE preview, issue #2082). */
onOpenManualOpeningBalances?: () => void
}) {
const { toast } = useToast()
const [step, setStep] = useState<ImportWizardStep>('upload')
@@ -1143,7 +1148,8 @@ function SIEImportWizard() {
{step === 'preview' && preview && (
<SIEPreviewStep preview={preview} issues={issues} missingAccounts={missingAccounts}
onCreateAccounts={handleCreateAccounts} isCreatingAccounts={isCreatingAccounts}
onContinue={() => goToStep(showMappingStep ? 'mapping' : 'review')} onBack={goBack} />
onContinue={() => goToStep(showMappingStep ? 'mapping' : 'review')} onBack={goBack}
onOpenManualOpeningBalances={onOpenManualOpeningBalances} />
)}
{step === 'mapping' && (
<AccountMappingStep mappings={mappings} basAccounts={basAccounts}
@@ -2747,7 +2753,9 @@ export default function ImportPage() {
)}
{mode === 'bank' && <BankFileImportWizard />}
{mode === 'skattekonto' && <SkattekontoImportWizard />}
{mode === 'sie' && <SIEImportWizard />}
{/* The CSV/Excel wizard opens on "Ingående balanser" by default, which is
exactly the manual path the SIE preview offers on an IB imbalance. */}
{mode === 'sie' && <SIEImportWizard onOpenManualOpeningBalances={() => setMode('csv_data')} />}
{mode === 'underlag' && <UnderlagImportWizard />}
{mode === 'csv_data' && <CSVDataImportWizard />}
{mode === 'migration' && (
+31 -5
View File
@@ -27,6 +27,12 @@ interface SIEPreviewStepProps {
isCreatingAccounts: boolean
onContinue: () => void
onBack: () => void
/**
* Opens the manual "Ingående balanser" wizard (issue #2082). Offered next to
* the IB-imbalance acknowledgement so a user who rightly hesitates to book an
* unexplained amount to 2099 has somewhere to go other than support.
*/
onOpenManualOpeningBalances?: () => void
}
export default function SIEPreviewStep({
@@ -37,6 +43,7 @@ export default function SIEPreviewStep({
isCreatingAccounts,
onContinue,
onBack,
onOpenManualOpeningBalances,
}: SIEPreviewStepProps) {
const errors = issues.filter((i) => i.severity === 'error')
const warnings = issues.filter((i) => i.severity === 'warning')
@@ -193,12 +200,31 @@ export default function SIEPreviewStep({
Ingående balanser balanserar inte ({formatCurrency(Math.abs(ibDiff))})
</p>
<p className="text-muted-foreground">
Det betyder oftast att exporten från ditt bokföringssystem är ofullständig:
t.ex. att skulder saknas eller att föregående års resultat inte är disponerat.
Om du fortsätter bokförs differensen på konto 2099 (Årets resultat), vilket
nästan alltid blir fel. Vi rekommenderar att du rättar exporten i källsystemet
och laddar upp filen på nytt.
Vanligaste orsaken är att föregående års resultat aldrig fördes över till
eget kapital i det gamla programmet. SpeedLedger parkerar det till exempel på
egna 9xxx-konton (9030/9031 Obokat resultat), och då summerar inte filens
ingående balanser till noll: differensen är det oförda resultatet. En annan
orsak är en ofullständig export, till exempel att skulder saknas.
</p>
<p className="text-muted-foreground">
Rätta i källsystemet och ladda upp filen på nytt, eller lägg in de ingående
balanserna för hand i guiden Ingående balanser, där du kan rätta raderna
själv innan de bokförs (den här filen importeras då inte). Fortsätter du ändå
bokförs differensen på konto 2099 (Årets resultat), vilket nästan alltid blir
fel.
</p>
{onOpenManualOpeningBalances && (
<Button
type="button"
variant="outline"
size="sm"
className="mt-1"
onClick={onOpenManualOpeningBalances}
>
Lägg in ingående balanser för hand
<ArrowRight className="ml-2 h-4 w-4" />
</Button>
)}
</div>
</div>
<label className="flex items-start gap-2 text-sm cursor-pointer">