taxtank-core 3.0.5 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7194,14 +7194,16 @@ class PropertyEquityChartData {
7194
7194
  }
7195
7195
  const bankAccounts = this.bankAccounts.getByPropertyId(property.id);
7196
7196
  const loans = this.loans.getByBankAccountsIds(bankAccounts.getIds());
7197
- const offset = bankAccounts.filterBy('type', BankAccountTypeEnum.OFFSET).getPropertyBalanceAmount(property.id);
7197
+ // all not loan accounts connected to the property reduce the outstanding loan balance work like offset
7198
+ const offset = bankAccounts.getDebitAccounts().getPropertyBalanceAmount(property.id);
7199
+ let loanBalance = Math.abs(property.getForecastByYear(year).loanBalance) - offset;
7198
7200
  if (year > this.currentYear) {
7199
- return bankAccounts.items.reduce((totalSum, bankAccount) => totalSum + (bankAccount.getPropertyPercentage(property.id) * (loans.getByBankAccountId(bankAccount.id)?.getLastPaymentByYear(year)?.totalOwed || 0)), 0) - offset;
7201
+ loanBalance = bankAccounts.items.reduce((totalSum, bankAccount) => totalSum + (bankAccount.getPropertyPercentage(property.id) * (loans.getByBankAccountId(bankAccount.id)?.getLastPaymentByYear(year)?.totalOwed || 0)), 0) - offset;
7200
7202
  }
7201
7203
  if (year == this.currentYear) {
7202
- return Math.abs(bankAccounts.items.reduce((totalSum, bankAccount) => totalSum + bankAccount.getPropertyPercentage(property.id) * (bankAccount.convertedBalance || 0), 0));
7204
+ loanBalance = Math.abs(bankAccounts.items.reduce((totalSum, bankAccount) => totalSum + bankAccount.getPropertyPercentage(property.id) * (bankAccount.convertedBalance || 0), 0));
7203
7205
  }
7204
- return Math.abs(property.getForecastByYear(year).loanBalance) - offset;
7206
+ return loanBalance > 0 ? loanBalance : 0;
7205
7207
  // @TODO TT-4888 no idea why it was calculated like that
7206
7208
  // return property.getValuationByYear(year).marketValue - offset;
7207
7209
  }