Show reconcile button and current reconciling-balance
This commit is contained in:
@ -4,27 +4,29 @@ import { useBudgetsStore } from "./budget";
|
||||
import { useSessionStore } from "./session";
|
||||
|
||||
interface State {
|
||||
Accounts: Map<string, Account>,
|
||||
CurrentAccountID: string | null,
|
||||
Categories: Map<string, Category>,
|
||||
Months: Map<number, Map<number, Map<string, Category>>>,
|
||||
Transactions: Map<string, Transaction>,
|
||||
Accounts: Map<string, Account>
|
||||
CurrentAccountID: string | null
|
||||
Categories: Map<string, Category>
|
||||
Months: Map<number, Map<number, Map<string, Category>>>
|
||||
Transactions: Map<string, Transaction>
|
||||
Assignments: []
|
||||
Reconciling: boolean
|
||||
}
|
||||
|
||||
export interface Transaction {
|
||||
ID: string,
|
||||
Date: Date,
|
||||
TransferAccount: string,
|
||||
CategoryGroup: string,
|
||||
Category: string,
|
||||
CategoryID: string | undefined,
|
||||
Memo: string,
|
||||
Status: string,
|
||||
GroupID: string,
|
||||
Payee: string,
|
||||
PayeeID: string | undefined,
|
||||
Amount: number,
|
||||
ID: string
|
||||
Date: Date
|
||||
TransferAccount: string
|
||||
CategoryGroup: string
|
||||
Category: string
|
||||
CategoryID: string | undefined
|
||||
Memo: string
|
||||
Status: string
|
||||
GroupID: string
|
||||
Payee: string
|
||||
PayeeID: string | undefined
|
||||
Amount: number
|
||||
Reconciled: boolean
|
||||
}
|
||||
|
||||
export interface Account {
|
||||
@ -54,7 +56,8 @@ export const useAccountStore = defineStore("budget/account", {
|
||||
Months: new Map<number, Map<number, Map<string, Category>>>(),
|
||||
Categories: new Map<string, Category>(),
|
||||
Transactions: new Map<string, Transaction>(),
|
||||
Assignments: []
|
||||
Assignments: [],
|
||||
Reconciling: false,
|
||||
}),
|
||||
getters: {
|
||||
AccountsList(state) {
|
||||
@ -93,6 +96,14 @@ export const useAccountStore = defineStore("budget/account", {
|
||||
|
||||
return state.Accounts.get(state.CurrentAccountID);
|
||||
},
|
||||
ReconcilingBalance(state): number {
|
||||
let reconciledBalance = this.CurrentAccount!.ReconciledBalance;
|
||||
for (const transaction of this.TransactionsList) {
|
||||
if(transaction.Reconciled)
|
||||
reconciledBalance += transaction.Amount;
|
||||
}
|
||||
return reconciledBalance;
|
||||
},
|
||||
OnBudgetAccounts(state) {
|
||||
return [...state.Accounts.values()].filter(x => x.OnBudget);
|
||||
},
|
||||
|
Reference in New Issue
Block a user