total amount on the account list page supports excluding specified accounts (#161)

This commit is contained in:
MaysWind
2025-06-29 22:27:34 +08:00
parent 90e862fbb1
commit 801c0f8572
25 changed files with 305 additions and 24 deletions
+11 -3
View File
@@ -1,6 +1,7 @@
import { ref, computed } from 'vue';
import { defineStore } from 'pinia';
import { useSettingsStore } from './setting.ts';
import { useUserStore } from './user.ts';
import { useExchangeRatesStore } from './exchangeRates.ts';
@@ -21,6 +22,7 @@ import services from '@/lib/services.ts';
import logger from '@/lib/logger.ts';
export const useAccountsStore = defineStore('accounts', () => {
const settingsStore = useSettingsStore();
const userStore = useUserStore();
const exchangeRatesStore = useExchangeRatesStore();
@@ -484,7 +486,9 @@ export const useAccountsStore = defineStore('accounts', () => {
return '***';
}
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, () => true);
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, account =>
!settingsStore.appSettings.totalAmountExcludeAccountIds[account.id]
);
let netAssets = 0;
let hasUnCalculatedAmount = false;
@@ -515,7 +519,9 @@ export const useAccountsStore = defineStore('accounts', () => {
return '***';
}
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, account => account.isAsset || false);
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, account =>
!settingsStore.appSettings.totalAmountExcludeAccountIds[account.id] && (account.isAsset || false)
);
let totalAssets = 0;
let hasUnCalculatedAmount = false;
@@ -546,7 +552,9 @@ export const useAccountsStore = defineStore('accounts', () => {
return '***';
}
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, account => account.isLiability || false);
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, account =>
!settingsStore.appSettings.totalAmountExcludeAccountIds[account.id] && (account.isLiability || false)
);
let totalLiabilities = 0;
let hasUnCalculatedAmount = false;
+9
View File
@@ -220,6 +220,13 @@ export const useSettingsStore = defineStore('settings', () => {
updateUserApplicationCloudSettingValue('alwaysShowTransactionPicturesInMobileTransactionEditPage', value);
}
// Account List Page
function setTotalAmountExcludeAccountIds(value: Record<string, boolean>): void {
updateApplicationSettingsValue('totalAmountExcludeAccountIds', value);
appSettings.value.totalAmountExcludeAccountIds = value;
updateUserApplicationCloudSettingValue('totalAmountExcludeAccountIds', value);
}
// Exchange Rates Data Page
function setCurrencySortByInExchangeRatesPage(value: number): void {
updateApplicationSettingsValue('currencySortByInExchangeRatesPage', value);
@@ -429,6 +436,8 @@ export const useSettingsStore = defineStore('settings', () => {
setAutoSaveTransactionDraft,
setAutoGetCurrentGeoLocation,
setAlwaysShowTransactionPicturesInMobileTransactionEditPage,
// -- Account List Page
setTotalAmountExcludeAccountIds,
// -- Exchange Rates Data Page
setCurrencySortByInExchangeRatesPage,
// -- Statistics Settings