feat: every page follows the one-currency mode
Totals, info boxes, section headers, group subtotals, shares and the per-currency charts on the dashboard, transactions, search, accounts, merchants, statement, budgets, categories, tags, groups, piggy banks, reports and the category, tag, budget and merchant pages sum into one converted amount when the mode is on; charts split by currency merge into one lane. Inputs, reconciliation and the Foreign column stay exact. Money moved to or from a debt, loan or mortgage no longer counts as income or spending in the transaction list boxes; it shows as From debts and To debts. The running balance of an incoming foreign-currency transfer shows in the account's currency.
This commit is contained in:
1 parent
94466d9be9
commit
617a4700e2
61 files changed
+1427
-798
No files matched your search
@@ -1,7 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { createQuery } from "@tanstack/svelte-query";
|
||||
import { displayCode, inDisplay } from "#lib/reports/display.js";
|
||||
import { reportQueries } from "#lib/reports/queries.js";
|
||||
import {
|
||||
displayMoney,
|
||||
drillQuery,
|
||||
money,
|
||||
navigate,
|
||||
@@ -34,12 +36,15 @@
|
||||
.sort((a, b) => a.name.localeCompare(b.name));
|
||||
});
|
||||
const sums = $derived.by(() => {
|
||||
const into = displayCode(new Set(rows.map((row) => row.code)));
|
||||
const map = new Map<string, { start: number; end: number }>();
|
||||
for (const row of rows) {
|
||||
const sum = map.get(row.code) ?? { end: 0, start: 0 };
|
||||
sum.start += row.start;
|
||||
sum.end += row.end;
|
||||
map.set(row.code, sum);
|
||||
const start = inDisplay(row.start, row.code, into);
|
||||
const end = inDisplay(row.end, row.code, into);
|
||||
const sum = map.get(start.code) ?? { end: 0, start: 0 };
|
||||
sum.start += start.amount;
|
||||
sum.end += end.amount;
|
||||
map.set(start.code, sum);
|
||||
}
|
||||
const order = report.codes;
|
||||
return [...map.entries()].sort(
|
||||
@@ -106,10 +111,14 @@
|
||||
{row.name}
|
||||
</button>
|
||||
</td>
|
||||
<td class="num px-3 text-right">{money(row.code, row.start)}</td>
|
||||
<td class="num px-3 text-right">{money(row.code, row.end)}</td>
|
||||
<td class="num px-3 text-right">
|
||||
{displayMoney(row.code, row.start)}
|
||||
</td>
|
||||
<td class="num px-3 text-right">
|
||||
{displayMoney(row.code, row.end)}
|
||||
</td>
|
||||
<td class="num px-3 text-right {tone(row.end - row.start)}">
|
||||
{money(row.code, row.end - row.start, true)}
|
||||
{displayMoney(row.code, row.end - row.start, true)}
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
|
||||
Reference in new issue
Block a user