From cef62574bb3b4e2abdddf51ecda7c232e23e0789 Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Tue, 5 Apr 2022 15:08:33 +0000 Subject: [PATCH] Add assigned, deassigned and activity to budgeting screen --- web/src/pages/Budgeting.vue | 18 +++++++++++++++++- web/src/stores/budget-account.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/web/src/pages/Budgeting.vue b/web/src/pages/Budgeting.vue index 5722854..d800a75 100644 --- a/web/src/pages/Budgeting.vue +++ b/web/src/pages/Budgeting.vue @@ -79,7 +79,23 @@ function assignedChanged(e : Event, category : Category){ Available balance: + /> +
+ Budgeted this month: + +
+ Budgeted this month: + +
+ Budgeted this month: + +
{ + const IncomeCategoryID = this.GetIncomeCategoryID; + if (IncomeCategoryID == null) return 0; + + const categories = this.AllCategoriesForMonth(year, month); + + let assigned = 0, deassigned = 0; + let activity = 0; + for (const category of categories) { + if (category.ID == IncomeCategoryID) + continue; + + activity += category.Activity; + if(category.Assigned > 0) + assigned += category.Assigned; + else + deassigned += category.Assigned; + } + return { + assigned, + deassigned, + activity + }; + }; + }, GetIncomeAvailable(state) { return (year: number, month: number) => { const IncomeCategoryID = this.GetIncomeCategoryID;