mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 00:34:28 +08:00
fix the incorrect amount in the total outflows and inflows trend charts
This commit is contained in:
+19
-11
@@ -584,10 +584,6 @@ export const useStatisticsStore = defineStore('statistics', () => {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transactionStatisticsFilter.filterAccountIds && item.relatedAccount && transactionStatisticsFilter.filterAccountIds[item.relatedAccount.id]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transactionStatisticsFilter.filterCategoryIds && transactionStatisticsFilter.filterCategoryIds[item.category.id]) {
|
if (transactionStatisticsFilter.filterCategoryIds && transactionStatisticsFilter.filterCategoryIds[item.category.id]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -699,6 +695,7 @@ export const useStatisticsStore = defineStore('statistics', () => {
|
|||||||
if (isNumber(item.amountInDefaultCurrency)) {
|
if (isNumber(item.amountInDefaultCurrency)) {
|
||||||
let data = allDataItems['total'];
|
let data = allDataItems['total'];
|
||||||
let amount = item.amountInDefaultCurrency;
|
let amount = item.amountInDefaultCurrency;
|
||||||
|
let includeInTotal: boolean = true;
|
||||||
|
|
||||||
if (transactionStatisticsFilter.chartDataType === ChartDataType.NetCashFlow.type &&
|
if (transactionStatisticsFilter.chartDataType === ChartDataType.NetCashFlow.type &&
|
||||||
(item.category.type === CategoryType.Expense || (item.category.type === CategoryType.Transfer && item.relatedAccountType === TransactionRelatedAccountType.TransferTo))) {
|
(item.category.type === CategoryType.Expense || (item.category.type === CategoryType.Transfer && item.relatedAccountType === TransactionRelatedAccountType.TransferTo))) {
|
||||||
@@ -708,9 +705,16 @@ export const useStatisticsStore = defineStore('statistics', () => {
|
|||||||
amount = -amount;
|
amount = -amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data) {
|
// total outflows / inflows do not include transfer transactions between unfiltered accounts
|
||||||
data.totalAmount += amount;
|
if (transactionStatisticsFilter.chartDataType === ChartDataType.TotalOutflows.type ||
|
||||||
} else {
|
transactionStatisticsFilter.chartDataType === ChartDataType.TotalInflows.type ||
|
||||||
|
transactionStatisticsFilter.chartDataType === ChartDataType.NetCashFlow.type) {
|
||||||
|
if (item.relatedAccount && (!transactionStatisticsFilter.filterAccountIds || !transactionStatisticsFilter.filterAccountIds[item.relatedAccount.id])) {
|
||||||
|
includeInTotal = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
let name = '';
|
let name = '';
|
||||||
|
|
||||||
if (transactionStatisticsFilter.chartDataType === ChartDataType.TotalOutflows.type) {
|
if (transactionStatisticsFilter.chartDataType === ChartDataType.TotalOutflows.type) {
|
||||||
@@ -735,14 +739,18 @@ export const useStatisticsStore = defineStore('statistics', () => {
|
|||||||
color: '',
|
color: '',
|
||||||
hidden: false,
|
hidden: false,
|
||||||
displayOrders: [1],
|
displayOrders: [1],
|
||||||
totalAmount: amount
|
totalAmount: 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
totalAmount += amount;
|
if (includeInTotal) {
|
||||||
|
data.totalAmount += amount;
|
||||||
|
|
||||||
if (item.amountInDefaultCurrency > 0) {
|
totalAmount += amount;
|
||||||
totalNonNegativeAmount += amount;
|
|
||||||
|
if (item.amountInDefaultCurrency > 0) {
|
||||||
|
totalNonNegativeAmount += amount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allDataItems['total'] = data;
|
allDataItems['total'] = data;
|
||||||
|
|||||||
Reference in New Issue
Block a user