taxtank-core 0.28.70 → 0.28.71
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 +32 -13
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/sole/sole-business-losses.collection.js +28 -14
- package/esm2015/lib/models/sole/sole-business-loss.js +5 -1
- package/fesm2015/taxtank-core.js +31 -13
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/sole/sole-business-losses.collection.d.ts +7 -1
- package/lib/models/sole/sole-business-loss.d.ts +4 -0
- package/package.json +1 -1
|
@@ -3179,6 +3179,10 @@
|
|
|
3179
3179
|
classTransformer.Type(function () { return SoleBusinessLossOffsetRule; })
|
|
3180
3180
|
], SoleBusinessLossOffsetRule.prototype, "parent", void 0);
|
|
3181
3181
|
|
|
3182
|
+
/**
|
|
3183
|
+
* If a sole trader business makes a tax loss in a current year, you can generally carry forward that loss and offset profit in future years.
|
|
3184
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4641357930/Rules+when+a+business+makes+a+loss+Tax+Summary#Offsetting-current-year-business-losses
|
|
3185
|
+
*/
|
|
3182
3186
|
var SoleBusinessLoss = /** @class */ (function (_super) {
|
|
3183
3187
|
__extends(SoleBusinessLoss, _super);
|
|
3184
3188
|
function SoleBusinessLoss() {
|
|
@@ -7591,27 +7595,42 @@
|
|
|
7591
7595
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
7592
7596
|
}
|
|
7593
7597
|
/**
|
|
7594
|
-
*
|
|
7598
|
+
* Business loss applied in current year, includes previous year losses and current year losses for businesses matching offset rule
|
|
7595
7599
|
*/
|
|
7596
7600
|
SoleBusinessLossesCollection.prototype.calculateBusinessLossApplied = function (transactions) {
|
|
7597
7601
|
var _this = this;
|
|
7598
|
-
|
|
7599
|
-
|
|
7602
|
+
// claim amounts for businesses that can be applied to be reduced by prior year business losses
|
|
7603
|
+
var claimAmountsByBusinessId = this.getClaimAmountsByBusinessId(transactions);
|
|
7604
|
+
return Object.keys(claimAmountsByBusinessId.items).reduce(function (sum, businessId) {
|
|
7605
|
+
var loss = _this.findBy('business.id', +businessId);
|
|
7606
|
+
var lossOpenBalance = (loss === null || loss === void 0 ? void 0 : loss.openBalance) || 0;
|
|
7607
|
+
// business loss can be applied to business profit or other income types profit in case in offset rule met
|
|
7608
|
+
return sum + (loss.offsetRule ? lossOpenBalance : Math.min(lossOpenBalance, claimAmountsByBusinessId.get(businessId)));
|
|
7609
|
+
}, 0);
|
|
7610
|
+
};
|
|
7611
|
+
/**
|
|
7612
|
+
* Get business claim amounts that can be applied to be reduced by prior year business losses:
|
|
7613
|
+
* businesses with income or businesses with a loss, but which met the non-commercial loss rules
|
|
7614
|
+
* https://www.ato.gov.au/Business/Non-commercial-losses/
|
|
7615
|
+
*/
|
|
7616
|
+
SoleBusinessLossesCollection.prototype.getClaimAmountsByBusinessId = function (transactions) {
|
|
7617
|
+
var _this = this;
|
|
7600
7618
|
var claimAmountsByBusinessId = new Dictionary([]);
|
|
7601
|
-
|
|
7602
|
-
|
|
7619
|
+
var transactionsByBusinessId = new CollectionDictionary(transactions, 'business.id');
|
|
7620
|
+
transactionsByBusinessId.keys.forEach(function (businessId) {
|
|
7621
|
+
var _a;
|
|
7622
|
+
// business loss may not exist if, when creating a business, user didn't add losses for previous years
|
|
7623
|
+
var lossOffsetRule = (_a = _this.findBy('business.id', +businessId)) === null || _a === void 0 ? void 0 : _a.offsetRule;
|
|
7624
|
+
var businessClaimAmount = transactionsByBusinessId
|
|
7603
7625
|
.get(businessId)
|
|
7604
7626
|
.getClaimAmountByBusinessId(+businessId);
|
|
7605
|
-
//
|
|
7606
|
-
if (businessClaimAmount
|
|
7607
|
-
|
|
7627
|
+
// no way to apply loss for business without profit if offset rules not met
|
|
7628
|
+
if (businessClaimAmount < 0 && !lossOffsetRule) {
|
|
7629
|
+
return;
|
|
7608
7630
|
}
|
|
7631
|
+
claimAmountsByBusinessId.add(businessId, businessClaimAmount);
|
|
7609
7632
|
});
|
|
7610
|
-
return
|
|
7611
|
-
var _a;
|
|
7612
|
-
var lossOpenBalance = ((_a = _this.findBy('business.id', +businessId)) === null || _a === void 0 ? void 0 : _a.openBalance) || 0;
|
|
7613
|
-
return sum + Math.min(lossOpenBalance, claimAmountsByBusinessId.get(businessId));
|
|
7614
|
-
}, 0);
|
|
7633
|
+
return claimAmountsByBusinessId;
|
|
7615
7634
|
};
|
|
7616
7635
|
return SoleBusinessLossesCollection;
|
|
7617
7636
|
}(Collection));
|