taxtank-core 1.0.56 → 1.0.58

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.
@@ -1393,6 +1393,7 @@ var TaxReturnCategoryListEnum;
1393
1393
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["tAX_OFFSET_MIDDLE"] = 62] = "tAX_OFFSET_MIDDLE";
1394
1394
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_OFFSET_SOLE"] = 63] = "TAX_OFFSET_SOLE";
1395
1395
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["DEFERRED_BUSINESS_LOSSES_FROM_PRIOR_YEAR"] = 64] = "DEFERRED_BUSINESS_LOSSES_FROM_PRIOR_YEAR";
1396
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["BUSINESS_LOSSES_APPLIED"] = 88] = "BUSINESS_LOSSES_APPLIED";
1396
1397
  })(TaxReturnCategoryListEnum || (TaxReturnCategoryListEnum = {}));
1397
1398
 
1398
1399
  var TaxReturnCategorySectionEnum;
@@ -3484,8 +3485,10 @@ class ChartAccounts extends ChartAccounts$1 {
3484
3485
  .includes(this.category);
3485
3486
  }
3486
3487
  isSoleExpense() {
3487
- return [ChartAccountsCategoryEnum.SOLE_EXPENSE, ChartAccountsCategoryEnum.SOLE_DEPRECIATION]
3488
- .includes(this.category);
3488
+ return [ChartAccountsCategoryEnum.SOLE_EXPENSE, ChartAccountsCategoryEnum.SOLE_DEPRECIATION].includes(this.category);
3489
+ }
3490
+ isHoldingExpense() {
3491
+ return [ChartAccountsCategoryEnum.HOLDING_EXPENSE].includes(this.category);
3489
3492
  }
3490
3493
  /**
3491
3494
  * Check if chart accounts is property expense
@@ -3541,7 +3544,7 @@ class ChartAccounts extends ChartAccounts$1 {
3541
3544
  * except when taxablePercent=0, but not ENTERTAINMENT
3542
3545
  */
3543
3546
  isClaimPercentEditable() {
3544
- return ((this.isWorkExpense() || this.isSoleExpense()) && !this.isVehicleExpense() && this.taxablePercent > 0)
3547
+ return ((this.isWorkExpense() || this.isSoleExpense() || this.isHoldingExpense()) && !this.isVehicleExpense() && this.taxablePercent > 0)
3545
3548
  || this.id === BusinessChartAccountsEnum.ENTERTAINMENT;
3546
3549
  }
3547
3550
  /**
@@ -9137,7 +9140,8 @@ class BankAccountCollection extends Collection {
9137
9140
  return this.filterBy('type', TYPE_LOAN);
9138
9141
  }
9139
9142
  getLoanAndOffsetAccounts() {
9140
- return this.filterBy('type', [...TYPE_LOAN, BankAccountTypeEnum.OFFSET]);
9143
+ // @TODO we have to add TRANSACTION/SAVINGS because basiq doesn't provide offset type
9144
+ return this.filterBy('type', [...TYPE_LOAN, BankAccountTypeEnum.OFFSET, BankAccountTypeEnum.TRANSACTION, BankAccountTypeEnum.SAVINGS]);
9141
9145
  }
9142
9146
  getDebitAccounts() {
9143
9147
  return this.filter(bankAccount => ![...TYPE_LOAN, BankAccountTypeEnum.CREDIT_CARD].includes(bankAccount.type));
@@ -15656,12 +15660,25 @@ class TaxSummary {
15656
15660
  return this.getReportItems([this.work, this.property, this.sole, this.holdings]).sumByCategories([
15657
15661
  ...TAX_RETURN_CATEGORIES.work.expenses,
15658
15662
  ...TAX_RETURN_CATEGORIES.property.expenses,
15663
+ TaxReturnCategoryListEnum.BORROWING_EXPENSES,
15664
+ ...TAX_RETURN_CATEGORIES.property.interest,
15665
+ ...TAX_RETURN_CATEGORIES.property.depreciation,
15659
15666
  ...TAX_RETURN_CATEGORIES.sole.expenses,
15667
+ ...TAX_RETURN_CATEGORIES.sole.depreciation,
15668
+ ...TAX_RETURN_CATEGORIES.sole.loss,
15660
15669
  ...TAX_RETURN_CATEGORIES.holdings.expenses,
15661
15670
  ]);
15662
15671
  }
15672
+ get taxCredits() {
15673
+ return this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.summary.taxCredits, TaxSummarySectionEnum.SUMMARY);
15674
+ }
15675
+ get depreciation() {
15676
+ return this.sole.items.sumByCategories(TAX_RETURN_CATEGORIES.sole.depreciation)
15677
+ + this.property.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.property.depreciation, TaxSummarySectionEnum.PROPERTY_TANK)
15678
+ + this.workDepreciations;
15679
+ }
15663
15680
  get netCash() {
15664
- return this.workNetCash + this.propertyNetCash + this.soleNetCash + this.holdingsNetCash;
15681
+ return this.income + this.expense + this.taxCredits - this.depreciation;
15665
15682
  }
15666
15683
  get netTotal() {
15667
15684
  return this.workNetTotal + this.propertyNetTotal + this.soleNetTotal + this.holdingsNetTotal;
@@ -15727,20 +15744,19 @@ class TaxSummary {
15727
15744
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
15728
15745
  */
15729
15746
  get soleNetCash() {
15730
- const depreciation = this.sole.items.sumByCategories(TAX_RETURN_CATEGORIES.sole.depreciation);
15731
- const loss = this.sole.items.sumByCategories(TAX_RETURN_CATEGORIES.sole.loss);
15732
- const lossCurrent = this.sole.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.sole.lossCurrent, TaxSummarySectionEnum.SOLE_TANK);
15733
- return this.soleNetTotal - depreciation - loss + lossCurrent;
15747
+ const income = this.sole.items.sumByCategories(TAX_RETURN_CATEGORIES.sole.income);
15748
+ const expense = this.sole.items.sumByCategories(TAX_RETURN_CATEGORIES.sole.expenses);
15749
+ return income + expense + this.soleTaxCredits;
15750
+ }
15751
+ get soleLossesApplied() {
15752
+ return this.sole.items.sumByCategories([TaxReturnCategoryListEnum.BUSINESS_LOSSES_APPLIED]);
15734
15753
  }
15735
15754
  /**
15736
15755
  * Sole Net Total = Gross income - expenses
15737
15756
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
15738
15757
  */
15739
15758
  get soleNetTotal() {
15740
- // income + expenses + depreciation + loss
15741
- const profit = this.sole.items.sumByCategories([TaxReturnCategoryListEnum.BUSINESS_INCOME_OR_LOSS]);
15742
- const lossCurrent = this.sole.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.sole.lossCurrent, TaxSummarySectionEnum.SOLE_TANK);
15743
- return profit - lossCurrent;
15759
+ return this.sole.netAmount;
15744
15760
  }
15745
15761
  getDeferredBusinessLoss(business) {
15746
15762
  return this.sole.items