mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-14 06:57:35 +08:00
add expense / income ratio and savings rate to value metric in insights explorer
This commit is contained in:
@@ -301,10 +301,12 @@ export class TransactionExplorerDataDimension implements NameValue {
|
||||
|
||||
export enum TransactionExplorerValueMetricType {
|
||||
TransactionCount = 'transactionCount',
|
||||
SourceAmountSum = 'sourceAmountSum',
|
||||
SourceIncomeAmountSum = 'sourceIncomeAmountSum',
|
||||
SourceExpenseAmountSum = 'sourceExpenseAmountSum',
|
||||
SourceNetIncomeAmountSum = 'sourceNetIncomeAmountSum',
|
||||
SrouceAmountExpenseIncomeRatio = 'sourceExpenseIncomeRatio',
|
||||
SourceAmountSavingsRate = 'sourceAmountSavingsRate',
|
||||
SourceAmountSum = 'sourceAmountSum',
|
||||
SourceAmountAverage = 'sourceAmountAverage',
|
||||
SourceAmountMedian = 'sourceAmountMedian',
|
||||
SourceAmountQ1Amount = 'sourceQ1Amount',
|
||||
@@ -333,6 +335,8 @@ export class TransactionExplorerValueMetric implements NameValue {
|
||||
public static readonly SourceIncomeAmountSum = new TransactionExplorerValueMetric('Total Income', TransactionExplorerValueMetricType.SourceIncomeAmountSum, true, false, true);
|
||||
public static readonly SourceExpenseAmountSum = new TransactionExplorerValueMetric('Total Expense', TransactionExplorerValueMetricType.SourceExpenseAmountSum, true, false, true);
|
||||
public static readonly SourceNetIncomeAmountSum = new TransactionExplorerValueMetric('Net Income', TransactionExplorerValueMetricType.SourceNetIncomeAmountSum, true, false, true);
|
||||
public static readonly SrouceAmountExpenseIncomeRatio = new TransactionExplorerValueMetric('Expense / Income Ratio', TransactionExplorerValueMetricType.SrouceAmountExpenseIncomeRatio, false, true, false);
|
||||
public static readonly SourceAmountSavingsRate = new TransactionExplorerValueMetric('Savings Rate', TransactionExplorerValueMetricType.SourceAmountSavingsRate, false, true, false);
|
||||
public static readonly SourceAmountSum = new TransactionExplorerValueMetric('Total Amount', TransactionExplorerValueMetricType.SourceAmountSum, true, false, true);
|
||||
public static readonly SourceAmountAverage = new TransactionExplorerValueMetric('Average Amount', TransactionExplorerValueMetricType.SourceAmountAverage, true, false, true);
|
||||
public static readonly SourceAmountMedian = new TransactionExplorerValueMetric('Median Amount', TransactionExplorerValueMetricType.SourceAmountMedian, true, false, true);
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "Zielkonto-Währung",
|
||||
"Value Metric": "Wertmetrik",
|
||||
"Transaction Count": "Transaktionsanzahl",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "Durchschnittsbetrag",
|
||||
"Median Amount": "Medianbetrag",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "Destination Account Currency",
|
||||
"Value Metric": "Value Metric",
|
||||
"Transaction Count": "Transaction Count",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "Average Amount",
|
||||
"Median Amount": "Median Amount",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "Moneda de la cuenta de destino",
|
||||
"Value Metric": "Métrica de valor",
|
||||
"Transaction Count": "Recuento de transacciones",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "Importe Medio",
|
||||
"Median Amount": "Importe Mediano",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "Destination Account Currency",
|
||||
"Value Metric": "Value Metric",
|
||||
"Transaction Count": "Transaction Count",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "Average Amount",
|
||||
"Median Amount": "Median Amount",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "Destination Account Currency",
|
||||
"Value Metric": "Value Metric",
|
||||
"Transaction Count": "Transaction Count",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "Average Amount",
|
||||
"Median Amount": "Median Amount",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "Destination Account Currency",
|
||||
"Value Metric": "Value Metric",
|
||||
"Transaction Count": "Transaction Count",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "Average Amount",
|
||||
"Median Amount": "Median Amount",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "Destination Account Currency",
|
||||
"Value Metric": "Value Metric",
|
||||
"Transaction Count": "Transaction Count",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "Average Amount",
|
||||
"Median Amount": "Median Amount",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "목적지 계좌 통화",
|
||||
"Value Metric": "값 메트릭",
|
||||
"Transaction Count": "거래 수",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "평균 금액",
|
||||
"Median Amount": "중간 금액",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "Destination Account Currency",
|
||||
"Value Metric": "Value Metric",
|
||||
"Transaction Count": "Transaction Count",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "Average Amount",
|
||||
"Median Amount": "Median Amount",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "Moeda da Conta de Destino",
|
||||
"Value Metric": "Métrica de Valor",
|
||||
"Transaction Count": "Quantidade de Transações",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "Valor Médio",
|
||||
"Median Amount": "Valor Mediano",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "Валюта целевого счёта",
|
||||
"Value Metric": "Метрика значения",
|
||||
"Transaction Count": "Количество транзакций",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "Средняя сумма",
|
||||
"Median Amount": "Медиана сумм",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "Valuta ciljnega računa",
|
||||
"Value Metric": "Metrika vrednosti",
|
||||
"Transaction Count": "Število transakcij",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "Povprečni znesek",
|
||||
"Median Amount": "Mediana zneska",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "இலக்கு கணக்கு நாணயம்",
|
||||
"Value Metric": "மதிப்பு அளவீடு",
|
||||
"Transaction Count": "பரிவர்த்தனை எண்ணிக்கை",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "சராசரி தொகை",
|
||||
"Median Amount": "நடுநிலை தொகை",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "Destination Account Currency",
|
||||
"Value Metric": "Value Metric",
|
||||
"Transaction Count": "Transaction Count",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "Average Amount",
|
||||
"Median Amount": "Median Amount",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "Destination Account Currency",
|
||||
"Value Metric": "Value Metric",
|
||||
"Transaction Count": "Transaction Count",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "Average Amount",
|
||||
"Median Amount": "Median Amount",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "Destination Account Currency",
|
||||
"Value Metric": "Value Metric",
|
||||
"Transaction Count": "Transaction Count",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "Average Amount",
|
||||
"Median Amount": "Median Amount",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "Destination Account Currency",
|
||||
"Value Metric": "Value Metric",
|
||||
"Transaction Count": "Transaction Count",
|
||||
"Expense / Income Ratio": "Expense / Income Ratio",
|
||||
"Savings Rate": "Savings Rate",
|
||||
"Average Amount": "Average Amount",
|
||||
"Median Amount": "Median Amount",
|
||||
"Q1 Amount (First Quartile)": "Q1 Amount (First Quartile)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "目标账户货币",
|
||||
"Value Metric": "值类型",
|
||||
"Transaction Count": "交易数量",
|
||||
"Expense / Income Ratio": "支出/收入比",
|
||||
"Savings Rate": "储蓄率",
|
||||
"Average Amount": "平均金额",
|
||||
"Median Amount": "中位数金额",
|
||||
"Q1 Amount (First Quartile)": "Q1 金额(第一四分位数)",
|
||||
|
||||
@@ -1806,6 +1806,8 @@
|
||||
"Destination Account Currency": "目標帳戶貨幣",
|
||||
"Value Metric": "值類型",
|
||||
"Transaction Count": "交易數量",
|
||||
"Expense / Income Ratio": "支出/收入比率",
|
||||
"Savings Rate": "儲蓄率",
|
||||
"Average Amount": "平均金額",
|
||||
"Median Amount": "中位數金額",
|
||||
"Q1 Amount (First Quartile)": "Q1 金額 (第一四分位數)",
|
||||
|
||||
@@ -871,14 +871,18 @@ export const useExplorersStore = defineStore('explorers', () => {
|
||||
|
||||
if (valueMetric === TransactionExplorerValueMetric.TransactionCount) {
|
||||
value = allSourceAmountsInDefaultCurrency.length;
|
||||
} else if (valueMetric === TransactionExplorerValueMetric.SourceAmountSum) {
|
||||
value = totalSourceAmountSumInDefaultCurrency;
|
||||
} else if (valueMetric === TransactionExplorerValueMetric.SourceIncomeAmountSum) {
|
||||
value = totalSourceIncomeAmountSumInDefaultCurrency;
|
||||
} else if (valueMetric === TransactionExplorerValueMetric.SourceExpenseAmountSum) {
|
||||
value = totalSourceExpenseAmountSumInDefaultCurrency;
|
||||
} else if (valueMetric === TransactionExplorerValueMetric.SourceNetIncomeAmountSum) {
|
||||
value = totalSourceIncomeAmountSumInDefaultCurrency - totalSourceExpenseAmountSumInDefaultCurrency;
|
||||
} else if (valueMetric === TransactionExplorerValueMetric.SrouceAmountExpenseIncomeRatio) {
|
||||
value = totalSourceIncomeAmountSumInDefaultCurrency !== 0 ? 100.0 * totalSourceExpenseAmountSumInDefaultCurrency / totalSourceIncomeAmountSumInDefaultCurrency : 0;
|
||||
} else if (valueMetric === TransactionExplorerValueMetric.SourceAmountSavingsRate) {
|
||||
value = totalSourceIncomeAmountSumInDefaultCurrency !== 0 ? 100.0 * (totalSourceIncomeAmountSumInDefaultCurrency - totalSourceExpenseAmountSumInDefaultCurrency) / totalSourceIncomeAmountSumInDefaultCurrency : 0;
|
||||
} else if (valueMetric === TransactionExplorerValueMetric.SourceAmountSum) {
|
||||
value = totalSourceAmountSumInDefaultCurrency;
|
||||
} else if (valueMetric === TransactionExplorerValueMetric.SourceAmountAverage) {
|
||||
value = allSourceAmountsInDefaultCurrency.length > 0 ? Math.trunc(totalSourceAmountSumInDefaultCurrency / allSourceAmountsInDefaultCurrency.length) : 0;
|
||||
} else if (valueMetric === TransactionExplorerValueMetric.SourceAmountMedian) {
|
||||
|
||||
Reference in New Issue
Block a user