'use client' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' import { Skeleton } from '@/components/ui/skeleton' import { ArrowRight } from 'lucide-react' import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from '@/components/ui/table' import { formatCurrency } from '@/lib/utils' import type { YearEndPreview } from '@/types' interface PreviewStepProps { preview: YearEndPreview | null isLoading: boolean error: string | null onBack: () => void onContinue: () => void } export function PreviewStep({ preview, isLoading, error, onBack, onContinue }: PreviewStepProps) { if (isLoading) { return ( ) } if (error) { return (

{error}

) } if (!preview) return null const isProfit = preview.netResult > 0 const isLoss = preview.netResult < 0 return (
Årets resultat

Nettoresultat överförs till {preview.closingAccount} {preview.closingAccountName}

{isProfit && Vinst} {isLoss && Förlust}

{formatCurrency(preview.netResult)}

{preview.currencyRevaluation && preview.currencyRevaluation.items.length > 0 && ( Kursrevaluering (ÅRL 4:13)

Öppna fordringar/skulder i utländsk valuta värderas om till balansdagens kurs innan bokslut. Detta sker automatiskt som en del av verkställandet.

Kursvinst

{formatCurrency(preview.currencyRevaluation.totalGain)}

Kursförlust

{formatCurrency(preview.currencyRevaluation.totalLoss)}

Nettoeffekt

{formatCurrency(preview.currencyRevaluation.netEffect)}

)} Bokslutsverifikation — förhandsgranskning

{preview.closingLines.length} kontorader. Nollställer klass 3–8 mot {preview.closingAccount}.

Konto Beskrivning Debet Kredit {preview.closingLines.map((line, i) => ( {line.account_number} {line.line_description} {line.debit_amount > 0 ? formatCurrency(line.debit_amount) : '—'} {line.credit_amount > 0 ? formatCurrency(line.credit_amount) : '—'} ))}
) }