fix(reconciliation): bank tile says 'Rörelse på banken' with the in/ut/antal split (#1858)

'Banktransaktioner i perioden (netto)' made a bookkeeper's abstraction do
the explaining; Jakob read it as gross activity. The tile now reads
'Rörelse på banken i perioden' and its sub-line shows the gross split
behind the net (in · ut · antal transaktioner), so 'netto' needs no
label. The bank status carries bank_transaction_inflow / _outflow /
_count for it; the bridge line uses the same wording.

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:
Jakob Wennberg
2026-08-24 16:24:26 +02:00
committed by GitHub
co-authored by Jakob Wennberg Claude Fable 5
parent 34ad1b1936
commit 4fb449a474
5 changed files with 31 additions and 5 deletions
+12 -1
View File
@@ -358,6 +358,16 @@ export function AccountOverview({ account, rail, window, onChanged }: AccountOve
const fetchedAt = isSkv ? status.skattekonto?.fetched_at : account.source.synced_at
const sourceLabel = isSkv ? t('source_skv') : t('source_bank')
const bankRaw = status.bank as { bank_transaction_inflow?: number; bank_transaction_outflow?: number; bank_transaction_count?: number } | null
const bankBreakdown =
!isSkv && bankRaw && typeof bankRaw.bank_transaction_inflow === 'number' && typeof bankRaw.bank_transaction_outflow === 'number'
? t('tile_bank_breakdown', {
inflow: formatCurrency(bankRaw.bank_transaction_inflow, currency),
outflow: formatCurrency(Math.abs(bankRaw.bank_transaction_outflow), currency),
count: bankRaw.bank_transaction_count ?? 0,
})
: null
const tiles: Array<{ key: string; label: string; value: string; sub: string; tone?: 'ok' | 'attn'; help?: string }> = [
{
key: 'external',
@@ -370,7 +380,8 @@ export function AccountOverview({ account, rail, window, onChanged }: AccountOve
? status.external_balance
: (status.bridge.find((l) => l.key === 'bank_transactions')?.amount ?? status.external_balance),
),
sub: fetchedAt ? t('tile_synced', { date: formatDate(fetchedAt) }) : t('rail_never_synced'),
// Bank: the gross split makes the net self-explanatory; skattekonto: when it was fetched.
sub: bankBreakdown ?? (fetchedAt ? t('tile_synced', { date: formatDate(fetchedAt) }) : t('rail_never_synced')),
},
{
key: 'ledger',
+13
View File
@@ -110,6 +110,12 @@ export interface ReconciliationStatus {
* excluded-but-shown.
*/
bank_transaction_total: number
/** Gross inflow (sum of positive amounts) behind bank_transaction_total; informational, for the page's "in · ut · antal" line. */
bank_transaction_inflow: number
/** Gross outflow (sum of negative amounts, itself negative) behind bank_transaction_total. */
bank_transaction_outflow: number
/** Number of non-ignored bank transactions in the window. */
bank_transaction_count: number
/** Sum of ignored bank transactions in the window. NOT part of
* bank_transaction_total or difference; informational, like the IB. */
ignored_transaction_total: number
@@ -921,6 +927,10 @@ export async function getReconciliationStatus(
// matched_count + unmatched_transaction_count always equals the number of
// rows behind bank_transaction_total.
const matchedCount = reconcilableTx.filter((tx) => tx.journal_entry_id !== null).length
// The gross split behind the net: what the user actually recognises as
// "what moved on the bank", so the page never has to explain "netto".
const bankInflow = reconcilableTx.reduce((sum, tx) => sum + Math.max(Number(tx.amount) || 0, 0), 0)
const bankOutflow = reconcilableTx.reduce((sum, tx) => sum + Math.min(Number(tx.amount) || 0, 0), 0)
const unmatchedTx = reconcilableTx.filter((tx) => tx.journal_entry_id === null)
const unmatchedTransactionCount = unmatchedTx.length
@@ -976,6 +986,9 @@ export async function getReconciliationStatus(
return {
currency,
bank_transaction_total: Math.round(bankTotal * 100) / 100,
bank_transaction_inflow: roundOre(bankInflow),
bank_transaction_outflow: roundOre(bankOutflow),
bank_transaction_count: reconcilableTx.length,
ignored_transaction_total: roundOre(ignoredTotal),
ignored_transaction_count: ignoredTx.length,
gl_1930_balance: Math.round(glBalance * 100) / 100,
+2 -2
View File
@@ -88,8 +88,8 @@ function bankBridge(status: Awaited<ReturnType<typeof getBankReconciliationStatu
const lines: BridgeLine[] = [
{
key: 'bank_transactions',
label_sv: 'Banktransaktioner i perioden (netto)',
label_en: 'Bank transactions in the period (net)',
label_sv: 'Rörelse på banken i perioden',
label_en: 'Movement on the bank in the period',
amount: status.bank_transaction_total,
count: null,
items_bucket: null,
+2 -1
View File
@@ -7815,7 +7815,8 @@
"empty_connect_skv": "Connect Skatteverket",
"load_failed": "Could not load the reconciliation. Try again in a moment.",
"tile_external_skv": "Balance at Skatteverket",
"tile_external_bank": "Bank transactions in the period (net)",
"tile_external_bank": "Movement on the bank in the period",
"tile_bank_breakdown": "{inflow} in · {outflow} out · {count} transactions",
"tile_ledger": "Booked on {account}",
"tile_ledger_bank": "Booked on {account} in the period",
"tile_difference": "Difference",
+2 -1
View File
@@ -7815,7 +7815,8 @@
"empty_connect_skv": "Koppla Skatteverket",
"load_failed": "Kunde inte hämta avstämningen. Försök igen om en stund.",
"tile_external_skv": "Saldo hos Skatteverket",
"tile_external_bank": "Banktransaktioner i perioden (netto)",
"tile_external_bank": "Rörelse på banken i perioden",
"tile_bank_breakdown": "{inflow} in · {outflow} ut · {count} transaktioner",
"tile_ledger": "Bokfört på {account}",
"tile_ledger_bank": "Bokfört på {account} i perioden",
"tile_difference": "Differens",