taxtank-core 0.28.32 → 0.28.34
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 +18 -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/esm2015/lib/services/http/income-source/sole-forecast/sole-forecast.service.js +10 -1
- package/fesm2015/taxtank-core.js +16 -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/lib/services/http/income-source/sole-forecast/sole-forecast.service.d.ts +4 -0
- 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
|
|
|
@@ -15574,6 +15567,7 @@
|
|
|
15574
15567
|
SoleForecastService.prototype.listenEvents = function () {
|
|
15575
15568
|
this.listenToAddedIncomeSources();
|
|
15576
15569
|
this.listenToUpdatedIncomeSources();
|
|
15570
|
+
this.listenBusinessCreated();
|
|
15577
15571
|
};
|
|
15578
15572
|
/**
|
|
15579
15573
|
* Listen to EventDispatcherService event related to added Income Sources
|
|
@@ -15623,6 +15617,15 @@
|
|
|
15623
15617
|
return incomeSource.soleForecasts;
|
|
15624
15618
|
}).flat();
|
|
15625
15619
|
};
|
|
15620
|
+
/**
|
|
15621
|
+
* Listen business created because we create sole forests together with business
|
|
15622
|
+
*/
|
|
15623
|
+
SoleForecastService.prototype.listenBusinessCreated = function () {
|
|
15624
|
+
var _this = this;
|
|
15625
|
+
this.eventDispatcherService.on(exports.AppEventTypeEnum.SOLE_BUSINESS_CREATED).subscribe(function () {
|
|
15626
|
+
_this.resetCache();
|
|
15627
|
+
});
|
|
15628
|
+
};
|
|
15626
15629
|
return SoleForecastService;
|
|
15627
15630
|
}(RestService));
|
|
15628
15631
|
SoleForecastService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleForecastService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
@@ -17378,6 +17381,7 @@
|
|
|
17378
17381
|
function AbstractForm(controls, model, validatorOrOpts, asyncValidator) {
|
|
17379
17382
|
var _this = _super.call(this, controls, validatorOrOpts, asyncValidator) || this;
|
|
17380
17383
|
/**
|
|
17384
|
+
* @TODO Alex bad name, it's also about unchanged
|
|
17381
17385
|
* Flag display if some form values changed
|
|
17382
17386
|
*/
|
|
17383
17387
|
_this.unsaved = false;
|
|
@@ -17867,18 +17871,18 @@
|
|
|
17867
17871
|
|
|
17868
17872
|
var SoleBusinessLossForm = /** @class */ (function (_super) {
|
|
17869
17873
|
__extends(SoleBusinessLossForm, _super);
|
|
17870
|
-
function SoleBusinessLossForm(loss,
|
|
17874
|
+
function SoleBusinessLossForm(loss, profit) {
|
|
17871
17875
|
var _this = this;
|
|
17872
17876
|
var _a;
|
|
17873
17877
|
_this = _super.call(this, {
|
|
17874
17878
|
openBalance: new forms.FormControl(loss.openBalance, forms.Validators.required),
|
|
17875
17879
|
offsetRule: new forms.FormControl((_a = loss.offsetRule) === null || _a === void 0 ? void 0 : _a.id),
|
|
17876
17880
|
// sum of depreciations/transactions claim amount - openBalance
|
|
17877
|
-
balance: new forms.FormControl({ value:
|
|
17881
|
+
balance: new forms.FormControl({ value: profit - loss.openBalance, disabled: true }),
|
|
17878
17882
|
}, loss) || this;
|
|
17879
17883
|
_this.loss = loss;
|
|
17880
17884
|
_this.get('openBalance').valueChanges.subscribe(function (openBalance) {
|
|
17881
|
-
_this.get('balance').setValue(
|
|
17885
|
+
_this.get('balance').setValue(profit - openBalance);
|
|
17882
17886
|
});
|
|
17883
17887
|
return _this;
|
|
17884
17888
|
}
|