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.
- package/bundles/taxtank-core.umd.js +8 -14
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/transaction/transaction-base.collection.js +3 -3
- package/esm2015/lib/db/Models/transaction/transaction-base.js +1 -1
- package/esm2015/lib/forms/abstract.form.js +2 -1
- package/esm2015/lib/forms/sole/sole-business-loss.form.js +4 -4
- package/esm2015/lib/models/report/sole/sole-business/sole-business-loss-report.js +3 -7
- package/esm2015/lib/models/sole/sole-business-loss.js +1 -5
- package/fesm2015/taxtank-core.js +7 -15
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/forms/abstract.form.d.ts +1 -0
- package/lib/forms/sole/sole-business-loss.form.d.ts +1 -1
- package/lib/models/report/sole/sole-business/sole-business-loss-report.d.ts +0 -5
- package/lib/models/sole/sole-business-loss.d.ts +0 -1
- package/package.json +1 -1
|
@@ -2777,9 +2777,7 @@
|
|
|
2777
2777
|
var SoleBusinessLoss = /** @class */ (function (_super) {
|
|
2778
2778
|
__extends(SoleBusinessLoss, _super);
|
|
2779
2779
|
function SoleBusinessLoss() {
|
|
2780
|
-
|
|
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')
|
|
11412
|
-
_this.
|
|
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,
|
|
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:
|
|
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(
|
|
17875
|
+
_this.get('balance').setValue(profit - openBalance);
|
|
17882
17876
|
});
|
|
17883
17877
|
return _this;
|
|
17884
17878
|
}
|