taxtank-core 0.30.136 → 0.30.137

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.
@@ -5997,6 +5997,9 @@ class BorrowingReport extends BorrowingReport$1 {
5997
5997
  * surplus income to cover your debt obligations
5998
5998
  */
5999
5999
  getNetSurplusRatio(profit, repaymentAmount) {
6000
+ if (!(repaymentAmount && this.loanRepaymentAmount && this.otherLiabilities)) {
6001
+ return 0;
6002
+ }
6000
6003
  return (profit + this.netRentIncome + this.netSalary + this.spouseNetSalary - this.livingExpenses)
6001
6004
  / (repaymentAmount + this.loanRepaymentAmount + this.otherLiabilities);
6002
6005
  }
@@ -20087,13 +20090,16 @@ class TransactionCalculationService {
20087
20090
  });
20088
20091
  }
20089
20092
  /**
20090
- * Get invoices allocated amounts grouped bu invoice id
20093
+ * Get invoices paid amounts grouped by invoice id
20091
20094
  */
20092
- getAllocationsAmountsByInvoiceId(allocations, invoices) {
20095
+ getInvoicePaidAmountById(allocations, invoices) {
20093
20096
  const allocationsByTransactionId = allocations.groupBy('transaction.id');
20094
20097
  const dictionary = new Dictionary([]);
20095
20098
  invoices.toArray().forEach((invoice) => {
20096
- dictionary.add(invoice.id, allocationsByTransactionId.merge(invoice.itemsCollection.mapBy('transaction.id')).amount || 0);
20099
+ // fully paid if user marked invoice as paid with cash
20100
+ const amount = invoice.isPaidCash() ? invoice.grossPrice
20101
+ : allocationsByTransactionId.merge(invoice.itemsCollection.mapBy('transaction.id')).amount || 0;
20102
+ dictionary.add(invoice.id, amount);
20097
20103
  });
20098
20104
  return dictionary;
20099
20105
  }