From 70dd3884769b9750355c28c137fd7520920dfff5 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Thu, 18 Jan 2024 19:29:40 +0100 Subject: [PATCH] Display cleared / uncleared / working balance for account Signed-off-by: Knut Ahlers --- frontend/components/accountOverview.vue | 28 ++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/frontend/components/accountOverview.vue b/frontend/components/accountOverview.vue index 294f555..581fbfc 100644 --- a/frontend/components/accountOverview.vue +++ b/frontend/components/accountOverview.vue @@ -2,13 +2,29 @@
-
+
-
- {{ accountIdToName[accountId] }} +
+ {{ accountIdToName[accountId] }} +
+
+ {{ formatNumber(account.balance - balanceUncleared) }} € + Cleared Balance +
+ + +
+ {{ formatNumber(balanceUncleared) }} € + Uncleared Balance +
+ = +
+ {{ formatNumber(account.balance) }} € + Working Balance +
+
@@ -301,6 +317,12 @@ export default { return Object.fromEntries(this.accounts.map(acc => [acc.id, acc.type])) }, + balanceUncleared() { + return this.transactions + .filter(tx => !tx.cleared) + .reduce((sum, tx) => sum + tx.amount, 0) + }, + categories() { const cats = this.accounts.filter(acc => acc.type === 'category') cats.sort((a, b) => a.name.localeCompare(b.name))