taxtank-core 0.31.18 → 0.31.20

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.
@@ -403,6 +403,7 @@ var TankTypeEnum;
403
403
  TankTypeEnum[TankTypeEnum["OTHER"] = 3] = "OTHER";
404
404
  TankTypeEnum[TankTypeEnum["SOLE"] = 4] = "SOLE";
405
405
  TankTypeEnum[TankTypeEnum["HOLDING"] = 5] = "HOLDING";
406
+ TankTypeEnum[TankTypeEnum["PERSONAL"] = 6] = "PERSONAL";
406
407
  })(TankTypeEnum || (TankTypeEnum = {}));
407
408
 
408
409
  class TransactionBase extends ObservableModel {
@@ -419,8 +420,10 @@ class TransactionBase extends ObservableModel {
419
420
  return TankTypeEnum.SOLE;
420
421
  case this.isHoldingTank():
421
422
  return TankTypeEnum.HOLDING;
422
- default:
423
+ case this.isOtherTank():
423
424
  return TankTypeEnum.OTHER;
425
+ default:
426
+ return TankTypeEnum.PERSONAL;
424
427
  }
425
428
  }
426
429
  /**
@@ -465,6 +468,13 @@ class TransactionBase extends ObservableModel {
465
468
  // @TODO Alex we need another way to distinguish work/holding
466
469
  return !this.isPropertyTank() && !this.isSoleTank();
467
470
  }
471
+ isOtherTank() {
472
+ // chart accounts may be empty for new instances
473
+ if (!this.chartAccounts) {
474
+ return false;
475
+ }
476
+ return CHART_ACCOUNTS_CATEGORIES.other.includes(this.chartAccounts?.category);
477
+ }
468
478
  isPersonalTank() {
469
479
  if (!this.chartAccounts) {
470
480
  return false;
@@ -2366,6 +2376,10 @@ const CHART_ACCOUNTS_CATEGORIES = {
2366
2376
  ChartAccountsCategoryEnum.HOLDING_EXPENSE,
2367
2377
  ChartAccountsCategoryEnum.HOLDING_INCOME,
2368
2378
  ],
2379
+ other: [
2380
+ ChartAccountsCategoryEnum.OTHER_INCOME,
2381
+ ChartAccountsCategoryEnum.OTHER_EXPENSE,
2382
+ ],
2369
2383
  personal: [
2370
2384
  ChartAccountsCategoryEnum.PERSONAL_EXPENSE,
2371
2385
  ChartAccountsCategoryEnum.PERSONAL_INCOME
@@ -3143,6 +3157,9 @@ class ChartAccounts extends ChartAccounts$1 {
3143
3157
  isDepreciation() {
3144
3158
  return CHART_ACCOUNTS_CATEGORIES.depreciation.includes(this.category);
3145
3159
  }
3160
+ isSoleIncome() {
3161
+ return CHART_ACCOUNTS_CATEGORIES.soleIncome.includes(this.category);
3162
+ }
3146
3163
  /**
3147
3164
  * Check if transaction chart account is work related car expenses
3148
3165
  */
@@ -22681,7 +22698,7 @@ class AllocationRuleForm extends AbstractForm {
22681
22698
  .map((condition) => new AllocationRuleConditionForm(condition))),
22682
22699
  transaction: new AllocationRuleTransactionForm(rule.transaction || plainToClass(AllocationRuleTransaction, {}), isGST),
22683
22700
  transferBankAccount: new UntypedFormControl(rule.transferBankAccount, Validators.required),
22684
- autoAllocate: new UntypedFormControl(rule.autoAllocate || false, Validators.required)
22701
+ autoAllocate: new UntypedFormControl(rule.autoAllocate || false, Validators.required),
22685
22702
  }, rule);
22686
22703
  this.isGST = isGST;
22687
22704
  this.listenEvents();
@@ -22890,7 +22907,7 @@ class TransactionBaseForm extends AbstractForm {
22890
22907
  // property claim (ownership% x shared%) for property expenses, taxable percent for others
22891
22908
  let claimPercent = chartAccounts.taxablePercent;
22892
22909
  if (chartAccounts.isPropertyExpense() && chartAccounts.id !== ChartAccountsListEnum.PLATFORM_FEES) {
22893
- claimPercent *= this.value.property?.claimCoefficient;
22910
+ claimPercent *= this.get('property').value.claimCoefficient;
22894
22911
  }
22895
22912
  this.get('claimPercent').setValue(claimPercent);
22896
22913
  }