taxtank-core 0.28.31 → 0.28.33

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.
@@ -2777,9 +2777,7 @@
2777
2777
  var SoleBusinessLoss = /** @class */ (function (_super) {
2778
2778
  __extends(SoleBusinessLoss, _super);
2779
2779
  function SoleBusinessLoss() {
2780
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
2781
- _this.openBalance = 0;
2782
- return _this;
2780
+ return _super !== null && _super.apply(this, arguments) || this;
2783
2781
  }
2784
2782
  Object.defineProperty(SoleBusinessLoss.prototype, "hasOffset", {
2785
2783
  get: function () {
@@ -7522,8 +7520,7 @@
7522
7520
  return _super !== null && _super.apply(this, arguments) || this;
7523
7521
  }
7524
7522
  TransactionBaseCollection.prototype.getClaimAmountByBusiness = function (business) {
7525
- return this.filterBy('business.id', business.id)
7526
- .sumBy('claimAmount');
7523
+ return +this.filterBy('business.id', business.id).items.map(function (transaction) { return transaction instanceof Depreciation ? -transaction.claimAmount : transaction['claimAmount']; }).reduce(function (sum, claimAmount) { return sum + claimAmount; }).toFixed(2);
7527
7524
  };
7528
7525
  return TransactionBaseCollection;
7529
7526
  }(Collection));
@@ -11408,14 +11405,10 @@
11408
11405
  function SoleBusinessLossReport(loss, transactions, depreciations) {
11409
11406
  var _this = _super.call(this) || this;
11410
11407
  _this.openBalance = loss.openBalance;
11411
- _this.netIncome = transactions.sumBy('claimAmount') + depreciations.sumBy('claimAmount');
11412
- _this.taxableIncome = _this.calculateTaxableIncome();
11413
- _this.closeBalance = Math.max(_this.taxableIncome, 0);
11408
+ _this.netIncome = transactions.sumBy('claimAmount') - depreciations.sumBy('claimAmount');
11409
+ _this.closeBalance = _this.netIncome - _this.openBalance;
11414
11410
  return _this;
11415
11411
  }
11416
- SoleBusinessLossReport.prototype.calculateTaxableIncome = function () {
11417
- return this.netIncome - this.openBalance;
11418
- };
11419
11412
  return SoleBusinessLossReport;
11420
11413
  }(AbstractModel));
11421
11414
 
@@ -17378,6 +17371,7 @@
17378
17371
  function AbstractForm(controls, model, validatorOrOpts, asyncValidator) {
17379
17372
  var _this = _super.call(this, controls, validatorOrOpts, asyncValidator) || this;
17380
17373
  /**
17374
+ * @TODO Alex bad name, it's also about unchanged
17381
17375
  * Flag display if some form values changed
17382
17376
  */
17383
17377
  _this.unsaved = false;
@@ -17867,18 +17861,18 @@
17867
17861
 
17868
17862
  var SoleBusinessLossForm = /** @class */ (function (_super) {
17869
17863
  __extends(SoleBusinessLossForm, _super);
17870
- function SoleBusinessLossForm(loss, balance) {
17864
+ function SoleBusinessLossForm(loss, profit) {
17871
17865
  var _this = this;
17872
17866
  var _a;
17873
17867
  _this = _super.call(this, {
17874
17868
  openBalance: new forms.FormControl(loss.openBalance, forms.Validators.required),
17875
17869
  offsetRule: new forms.FormControl((_a = loss.offsetRule) === null || _a === void 0 ? void 0 : _a.id),
17876
17870
  // sum of depreciations/transactions claim amount - openBalance
17877
- balance: new forms.FormControl({ value: balance, disabled: true }),
17871
+ balance: new forms.FormControl({ value: profit - loss.openBalance, disabled: true }),
17878
17872
  }, loss) || this;
17879
17873
  _this.loss = loss;
17880
17874
  _this.get('openBalance').valueChanges.subscribe(function (openBalance) {
17881
- _this.get('balance').setValue(balance - openBalance);
17875
+ _this.get('balance').setValue(profit - openBalance);
17882
17876
  });
17883
17877
  return _this;
17884
17878
  }