taxtank-core 0.17.0 → 0.17.3

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.
@@ -5034,7 +5034,12 @@
5034
5034
  classTransformer.Type(function () { return TransactionAllocation; })
5035
5035
  ], Transaction.prototype, "allocations", void 0);
5036
5036
  __decorate([
5037
- classTransformer.Exclude({ toPlainOnly: true })
5037
+ classTransformer.Exclude({ toPlainOnly: true }),
5038
+ classTransformer.Type(function () { return Country; }),
5039
+ classTransformer.Transform(function (_b) {
5040
+ var obj = _b.obj;
5041
+ return obj.file;
5042
+ })
5038
5043
  ], Transaction.prototype, "file", void 0);
5039
5044
 
5040
5045
  var BankTransaction = /** @class */ (function (_super) {
@@ -5556,265 +5561,219 @@
5556
5561
  return ServiceSubscriptionCollection;
5557
5562
  }(Collection));
5558
5563
 
5564
+ /**
5565
+ * collection for tax return category items
5566
+ */
5567
+ var ReportItemCollection = /** @class */ (function (_super) {
5568
+ __extends(ReportItemCollection, _super);
5569
+ function ReportItemCollection() {
5570
+ return _super !== null && _super.apply(this, arguments) || this;
5571
+ }
5572
+ /**
5573
+ * Recursively get collection of report items by Tax Summary Section.
5574
+ * Search items which has details
5575
+ */
5576
+ ReportItemCollection.prototype.getBySection = function (section) {
5577
+ var e_1, _a;
5578
+ var result = [];
5579
+ try {
5580
+ for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
5581
+ var reportItem = _c.value;
5582
+ if (reportItem.details.length && reportItem.taxReturnCategory.section === section) {
5583
+ result.push(reportItem);
5584
+ }
5585
+ else {
5586
+ result.push.apply(result, __spreadArray([], __read(reportItem.items.getBySection(section).toArray())));
5587
+ }
5588
+ }
5589
+ }
5590
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
5591
+ finally {
5592
+ try {
5593
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
5594
+ }
5595
+ finally { if (e_1) throw e_1.error; }
5596
+ }
5597
+ return this.create(result);
5598
+ };
5599
+ /**
5600
+ * Recursively find report item by Tax Return Category ID
5601
+ */
5602
+ ReportItemCollection.prototype.findByCategory = function (categoryId) {
5603
+ var e_2, _a;
5604
+ var result;
5605
+ try {
5606
+ for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
5607
+ var reportItem = _c.value;
5608
+ if (result) {
5609
+ break;
5610
+ }
5611
+ if (reportItem.taxReturnCategory.id === categoryId) {
5612
+ result = reportItem;
5613
+ }
5614
+ else {
5615
+ result = reportItem.items.findByCategory(categoryId);
5616
+ }
5617
+ }
5618
+ }
5619
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
5620
+ finally {
5621
+ try {
5622
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
5623
+ }
5624
+ finally { if (e_2) throw e_2.error; }
5625
+ }
5626
+ return result;
5627
+ };
5628
+ /**
5629
+ * Get Collection of report items by Tax Return Categories IDs
5630
+ */
5631
+ ReportItemCollection.prototype.getByCategories = function (categories) {
5632
+ var _this = this;
5633
+ return this.create(compact__default["default"](categories.map(function (category) { return _this.findByCategory(category); })));
5634
+ };
5635
+ /**
5636
+ * A short call to a chain of methods that we often use.
5637
+ * Get total amount of report items by Tax Return categories and Tax Summary Section.
5638
+ */
5639
+ ReportItemCollection.prototype.sumByCategoriesAndSection = function (categories, section) {
5640
+ return this.getByCategories(categories).getBySection(section).sumBy('amount');
5641
+ };
5642
+ /**
5643
+ * Get collection of all report item details related to passed income source
5644
+ * @TODO Alex: consider to create and move to ReportItemDetailsCollection
5645
+ */
5646
+ ReportItemCollection.prototype.getDetailsByIncomeSource = function (incomeSource) {
5647
+ var e_3, _a;
5648
+ var result = [];
5649
+ try {
5650
+ for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
5651
+ var reportItem = _c.value;
5652
+ if (reportItem.details.length) {
5653
+ result.push.apply(result, __spreadArray([], __read(reportItem.details.filter(function (details) { return details.name === incomeSource.name; }))));
5654
+ }
5655
+ else {
5656
+ result.push.apply(result, __spreadArray([], __read(reportItem.items.getDetailsByIncomeSource(incomeSource).toArray())));
5657
+ }
5658
+ }
5659
+ }
5660
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
5661
+ finally {
5662
+ try {
5663
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
5664
+ }
5665
+ finally { if (e_3) throw e_3.error; }
5666
+ }
5667
+ return new Collection(result);
5668
+ };
5669
+ return ReportItemCollection;
5670
+ }(Collection));
5671
+
5559
5672
  exports.TaxReturnCategoryListEnum = void 0;
5560
5673
  (function (TaxReturnCategoryListEnum) {
5561
5674
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["SALARY"] = 1] = "SALARY";
5675
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["ALLOWANCES_EARNINGS_TIPS_DIRECTOR_FEES"] = 30] = "ALLOWANCES_EARNINGS_TIPS_DIRECTOR_FEES";
5676
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["EMPLOYER_LUMP_SUM_PAYMENTS"] = 31] = "EMPLOYER_LUMP_SUM_PAYMENTS";
5677
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["ETP"] = 32] = "ETP";
5678
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["GOVERNMENT_ALLOWANCES"] = 2] = "GOVERNMENT_ALLOWANCES";
5679
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["GOVERNMENT_PENSIONS"] = 33] = "GOVERNMENT_PENSIONS";
5680
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["ANNUITIES_SUPER_INCOME_STREAMS"] = 3] = "ANNUITIES_SUPER_INCOME_STREAMS";
5681
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["SUPERANNUATION_LUMP_SUM_PAYMENTS"] = 34] = "SUPERANNUATION_LUMP_SUM_PAYMENTS";
5682
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["ATTRIBUTED_PSI_INCOME"] = 4] = "ATTRIBUTED_PSI_INCOME";
5562
5683
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["WORK_EXPENSES"] = 7] = "WORK_EXPENSES";
5563
5684
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["GROSS_RENT"] = 8] = "GROSS_RENT";
5685
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_RENTAL_DEDUCTIONS"] = 12] = "OTHER_RENTAL_DEDUCTIONS";
5564
5686
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["INTEREST_DEDUCTIONS"] = 9] = "INTEREST_DEDUCTIONS";
5565
5687
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["CAPITAL_WORKS"] = 10] = "CAPITAL_WORKS";
5566
5688
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["DEPRECIATION"] = 11] = "DEPRECIATION";
5567
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_RENTAL_DEDUCTIONS"] = 12] = "OTHER_RENTAL_DEDUCTIONS";
5568
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["BORROWING_EXPENSES"] = 29] = "BORROWING_EXPENSES";
5689
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["GROSS_INTEREST"] = 5] = "GROSS_INTEREST";
5690
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["DIVIDENDS"] = 6] = "DIVIDENDS";
5691
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["SHARE_SCHEMES"] = 35] = "SHARE_SCHEMES";
5569
5692
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["PARTNERSHIPS_TRUSTS"] = 13] = "PARTNERSHIPS_TRUSTS";
5570
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["PCI_SBE_INCOME"] = 14] = "PCI_SBE_INCOME";
5693
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["PSI_SBE_INCOME"] = 14] = "PSI_SBE_INCOME";
5694
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["SOLE_TRADER_BUSINESS_INCOME"] = 38] = "SOLE_TRADER_BUSINESS_INCOME";
5571
5695
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["CAPITAL_GAINS"] = 15] = "CAPITAL_GAINS";
5572
5696
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["FOREIGN_SOURCE_INCOME"] = 16] = "FOREIGN_SOURCE_INCOME";
5573
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_INCOME"] = 17] = "OTHER_INCOME";
5697
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["BONUSES_FROM_LIFE_INSURANCE"] = 17] = "BONUSES_FROM_LIFE_INSURANCE";
5698
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["FORESTRY_MANAGED_INVESTMENT_SCHEMES"] = 39] = "FORESTRY_MANAGED_INVESTMENT_SCHEMES";
5699
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_INCOME"] = 40] = "OTHER_INCOME";
5700
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_CREDITS"] = 23] = "TAX_CREDITS";
5574
5701
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_DEDUCTIONS"] = 18] = "OTHER_DEDUCTIONS";
5702
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_OFFSETS"] = 27] = "TAX_OFFSETS";
5703
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["BORROWING_EXPENSES"] = 29] = "BORROWING_EXPENSES";
5575
5704
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["GROSS_TAX_PAYABLE"] = 19] = "GROSS_TAX_PAYABLE";
5576
5705
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_ON_TAXABLE_INCOME"] = 20] = "TAX_ON_TAXABLE_INCOME";
5577
5706
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["MEDICARE"] = 21] = "MEDICARE";
5578
5707
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["STUDENT_LOAN_REPAYMENT"] = 22] = "STUDENT_LOAN_REPAYMENT";
5579
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_CREDITS"] = 23] = "TAX_CREDITS";
5580
5708
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_WITHHELD"] = 24] = "TAX_WITHHELD";
5581
5709
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_INSTALMENTS"] = 25] = "TAX_INSTALMENTS";
5582
5710
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["FRANKING_CREDITS"] = 26] = "FRANKING_CREDITS";
5583
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_OFFSETS"] = 27] = "TAX_OFFSETS";
5584
5711
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_PAYABLE"] = 28] = "TAX_PAYABLE";
5585
5712
  })(exports.TaxReturnCategoryListEnum || (exports.TaxReturnCategoryListEnum = {}));
5586
5713
 
5587
- exports.TaxReturnCategorySectionEnum = void 0;
5588
- (function (TaxReturnCategorySectionEnum) {
5589
- TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["WORK_TANK"] = 1] = "WORK_TANK";
5590
- TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["PROPERTY_TANK"] = 2] = "PROPERTY_TANK";
5591
- TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["OTHER_INCOME"] = 3] = "OTHER_INCOME";
5592
- TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["SUMMARY"] = 4] = "SUMMARY";
5593
- })(exports.TaxReturnCategorySectionEnum || (exports.TaxReturnCategorySectionEnum = {}));
5594
-
5595
- /**
5596
- * collection for tax return category items
5597
- */
5598
- var ReportItemCollection = /** @class */ (function (_super) {
5599
- __extends(ReportItemCollection, _super);
5600
- function ReportItemCollection() {
5601
- return _super !== null && _super.apply(this, arguments) || this;
5714
+ var TAX_RETURN_CATEGORIES = {
5715
+ work: {
5716
+ income: [
5717
+ exports.TaxReturnCategoryListEnum.SALARY,
5718
+ exports.TaxReturnCategoryListEnum.ALLOWANCES_EARNINGS_TIPS_DIRECTOR_FEES,
5719
+ exports.TaxReturnCategoryListEnum.EMPLOYER_LUMP_SUM_PAYMENTS,
5720
+ exports.TaxReturnCategoryListEnum.ETP,
5721
+ exports.TaxReturnCategoryListEnum.GOVERNMENT_ALLOWANCES,
5722
+ exports.TaxReturnCategoryListEnum.GOVERNMENT_PENSIONS,
5723
+ exports.TaxReturnCategoryListEnum.ANNUITIES_SUPER_INCOME_STREAMS,
5724
+ exports.TaxReturnCategoryListEnum.SUPERANNUATION_LUMP_SUM_PAYMENTS,
5725
+ exports.TaxReturnCategoryListEnum.ATTRIBUTED_PSI_INCOME
5726
+ ],
5727
+ expenses: [
5728
+ exports.TaxReturnCategoryListEnum.WORK_EXPENSES
5729
+ ],
5730
+ interest: [
5731
+ exports.TaxReturnCategoryListEnum.GROSS_INTEREST
5732
+ ],
5733
+ taxWithheld: [
5734
+ exports.TaxReturnCategoryListEnum.TAX_WITHHELD
5735
+ ]
5736
+ },
5737
+ property: {
5738
+ income: [
5739
+ exports.TaxReturnCategoryListEnum.GROSS_RENT
5740
+ ],
5741
+ expenses: [
5742
+ exports.TaxReturnCategoryListEnum.OTHER_RENTAL_DEDUCTIONS
5743
+ ],
5744
+ interest: [
5745
+ exports.TaxReturnCategoryListEnum.INTEREST_DEDUCTIONS
5746
+ ],
5747
+ depreciation: [
5748
+ exports.TaxReturnCategoryListEnum.CAPITAL_WORKS,
5749
+ exports.TaxReturnCategoryListEnum.DEPRECIATION
5750
+ ]
5751
+ },
5752
+ other: {
5753
+ income: [
5754
+ exports.TaxReturnCategoryListEnum.GROSS_INTEREST,
5755
+ exports.TaxReturnCategoryListEnum.DIVIDENDS,
5756
+ exports.TaxReturnCategoryListEnum.SHARE_SCHEMES,
5757
+ exports.TaxReturnCategoryListEnum.PARTNERSHIPS_TRUSTS,
5758
+ exports.TaxReturnCategoryListEnum.PSI_SBE_INCOME,
5759
+ exports.TaxReturnCategoryListEnum.SOLE_TRADER_BUSINESS_INCOME,
5760
+ exports.TaxReturnCategoryListEnum.CAPITAL_GAINS,
5761
+ exports.TaxReturnCategoryListEnum.FOREIGN_SOURCE_INCOME,
5762
+ exports.TaxReturnCategoryListEnum.BONUSES_FROM_LIFE_INSURANCE,
5763
+ exports.TaxReturnCategoryListEnum.FORESTRY_MANAGED_INVESTMENT_SCHEMES,
5764
+ exports.TaxReturnCategoryListEnum.OTHER_INCOME
5765
+ ],
5766
+ expenses: [
5767
+ exports.TaxReturnCategoryListEnum.OTHER_DEDUCTIONS
5768
+ ],
5769
+ taxCredits: [
5770
+ exports.TaxReturnCategoryListEnum.TAX_CREDITS
5771
+ ],
5772
+ taxOffsets: [
5773
+ exports.TaxReturnCategoryListEnum.TAX_OFFSETS
5774
+ ]
5602
5775
  }
5603
- Object.defineProperty(ReportItemCollection.prototype, "salary", {
5604
- /**
5605
- * Work income
5606
- */
5607
- get: function () {
5608
- var _a;
5609
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.SALARY)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5610
- },
5611
- enumerable: false,
5612
- configurable: true
5613
- });
5614
- Object.defineProperty(ReportItemCollection.prototype, "workExpenses", {
5615
- /**
5616
- * Work expenses
5617
- */
5618
- get: function () {
5619
- var _a;
5620
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.WORK_EXPENSES)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5621
- },
5622
- enumerable: false,
5623
- configurable: true
5624
- });
5625
- Object.defineProperty(ReportItemCollection.prototype, "rentalIncome", {
5626
- /**
5627
- * Property income
5628
- */
5629
- get: function () {
5630
- var _a;
5631
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.GROSS_RENT)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5632
- },
5633
- enumerable: false,
5634
- configurable: true
5635
- });
5636
- Object.defineProperty(ReportItemCollection.prototype, "rentalDeductions", {
5637
- /**
5638
- * Property rental deductions
5639
- */
5640
- get: function () {
5641
- var _a;
5642
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.OTHER_RENTAL_DEDUCTIONS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5643
- },
5644
- enumerable: false,
5645
- configurable: true
5646
- });
5647
- Object.defineProperty(ReportItemCollection.prototype, "propertyExpenses", {
5648
- /**
5649
- * Property expenses
5650
- */
5651
- get: function () {
5652
- return this.rentalDeductions + this.borrowingExpenses;
5653
- },
5654
- enumerable: false,
5655
- configurable: true
5656
- });
5657
- Object.defineProperty(ReportItemCollection.prototype, "interestDeductions", {
5658
- /**
5659
- * Property interest
5660
- */
5661
- get: function () {
5662
- var _a;
5663
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.INTEREST_DEDUCTIONS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5664
- },
5665
- enumerable: false,
5666
- configurable: true
5667
- });
5668
- Object.defineProperty(ReportItemCollection.prototype, "capitalWorks", {
5669
- /**
5670
- * Property capital works depreciations
5671
- */
5672
- get: function () {
5673
- var _a;
5674
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.CAPITAL_WORKS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5675
- },
5676
- enumerable: false,
5677
- configurable: true
5678
- });
5679
- Object.defineProperty(ReportItemCollection.prototype, "plantEquipment", {
5680
- /**
5681
- * Property plant & equipment depreciations
5682
- */
5683
- get: function () {
5684
- var _a;
5685
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.DEPRECIATION)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5686
- },
5687
- enumerable: false,
5688
- configurable: true
5689
- });
5690
- Object.defineProperty(ReportItemCollection.prototype, "propertyDepreciations", {
5691
- /**
5692
- * Total property depreciaions
5693
- */
5694
- get: function () {
5695
- return this.capitalWorks + this.plantEquipment;
5696
- },
5697
- enumerable: false,
5698
- configurable: true
5699
- });
5700
- Object.defineProperty(ReportItemCollection.prototype, "partnershipsAndTrusts", {
5701
- get: function () {
5702
- var _a;
5703
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.PARTNERSHIPS_TRUSTS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5704
- },
5705
- enumerable: false,
5706
- configurable: true
5707
- });
5708
- Object.defineProperty(ReportItemCollection.prototype, "pciAndSbeIncome", {
5709
- get: function () {
5710
- var _a;
5711
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.PCI_SBE_INCOME)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5712
- },
5713
- enumerable: false,
5714
- configurable: true
5715
- });
5716
- Object.defineProperty(ReportItemCollection.prototype, "capitalGains", {
5717
- get: function () {
5718
- var _a;
5719
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.CAPITAL_GAINS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5720
- },
5721
- enumerable: false,
5722
- configurable: true
5723
- });
5724
- Object.defineProperty(ReportItemCollection.prototype, "foreignSourceIncome", {
5725
- get: function () {
5726
- var _a;
5727
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.FOREIGN_SOURCE_INCOME)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5728
- },
5729
- enumerable: false,
5730
- configurable: true
5731
- });
5732
- Object.defineProperty(ReportItemCollection.prototype, "otherIncome", {
5733
- /**
5734
- * Other income
5735
- */
5736
- get: function () {
5737
- var _a;
5738
- return (((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.OTHER_INCOME)) === null || _a === void 0 ? void 0 : _a.amount) || 0) +
5739
- this.partnershipsAndTrusts +
5740
- this.pciAndSbeIncome +
5741
- this.capitalGains +
5742
- this.foreignSourceIncome;
5743
- },
5744
- enumerable: false,
5745
- configurable: true
5746
- });
5747
- Object.defineProperty(ReportItemCollection.prototype, "otherDeductions", {
5748
- /**
5749
- * Other expenses
5750
- */
5751
- get: function () {
5752
- var _a;
5753
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.OTHER_DEDUCTIONS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5754
- },
5755
- enumerable: false,
5756
- configurable: true
5757
- });
5758
- Object.defineProperty(ReportItemCollection.prototype, "taxInstalments", {
5759
- get: function () {
5760
- var _a;
5761
- return ((_a = this.getTaxCreditsCollection().getByCategory(exports.TaxReturnCategoryListEnum.TAX_INSTALMENTS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5762
- },
5763
- enumerable: false,
5764
- configurable: true
5765
- });
5766
- Object.defineProperty(ReportItemCollection.prototype, "frankingCredits", {
5767
- get: function () {
5768
- var _a;
5769
- return ((_a = this.getTaxCreditsCollection().getByCategory(exports.TaxReturnCategoryListEnum.FRANKING_CREDITS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5770
- },
5771
- enumerable: false,
5772
- configurable: true
5773
- });
5774
- Object.defineProperty(ReportItemCollection.prototype, "taxOffsets", {
5775
- get: function () {
5776
- var _a;
5777
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.TAX_OFFSETS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5778
- },
5779
- enumerable: false,
5780
- configurable: true
5781
- });
5782
- Object.defineProperty(ReportItemCollection.prototype, "borrowingExpenses", {
5783
- get: function () {
5784
- var _a;
5785
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.BORROWING_EXPENSES)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5786
- },
5787
- enumerable: false,
5788
- configurable: true
5789
- });
5790
- Object.defineProperty(ReportItemCollection.prototype, "grossTaxPayable", {
5791
- get: function () {
5792
- var _a;
5793
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.GROSS_TAX_PAYABLE)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5794
- },
5795
- enumerable: false,
5796
- configurable: true
5797
- });
5798
- /**
5799
- * taxWithheld by section (work or other)
5800
- */
5801
- ReportItemCollection.prototype.getTaxWithheld = function (section) {
5802
- if (section === void 0) { section = exports.TaxReturnCategorySectionEnum.WORK_TANK; }
5803
- var _a;
5804
- return ((_a = this.getTaxCreditsCollection().getByCategory(exports.TaxReturnCategoryListEnum.TAX_WITHHELD)) === null || _a === void 0 ? void 0 : _a.details.filter(function (details) { return details.section === section; }).reduce(function (sum, details) { return sum + details.amount; }, 0)) || 0;
5805
- };
5806
- ReportItemCollection.prototype.getTaxCreditsCollection = function () {
5807
- var _a;
5808
- return new ReportItemCollection(((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.TAX_CREDITS)) === null || _a === void 0 ? void 0 : _a.items) || []);
5809
- };
5810
- ReportItemCollection.prototype.getTotalAmountByIncomeSourceName = function (name) {
5811
- return this.items.reduce((function (sum, item) { return sum + item.getAmountByIncomeSourceName(name); }), 0);
5812
- };
5813
- ReportItemCollection.prototype.getByCategory = function (category) {
5814
- return this.items.find(function (item) { return item.taxReturnCategory.id === category; });
5815
- };
5816
- return ReportItemCollection;
5817
- }(Collection));
5776
+ };
5818
5777
 
5819
5778
  /**
5820
5779
  * Collection of tax review
@@ -6315,6 +6274,14 @@
6315
6274
  TaxCalculationTypeEnum[TaxCalculationTypeEnum["ETP_TAX_FREE"] = 9] = "ETP_TAX_FREE";
6316
6275
  })(exports.TaxCalculationTypeEnum || (exports.TaxCalculationTypeEnum = {}));
6317
6276
 
6277
+ exports.TaxReturnCategorySectionEnum = void 0;
6278
+ (function (TaxReturnCategorySectionEnum) {
6279
+ TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["WORK_TANK"] = 1] = "WORK_TANK";
6280
+ TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["PROPERTY_TANK"] = 2] = "PROPERTY_TANK";
6281
+ TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["OTHER_INCOME"] = 3] = "OTHER_INCOME";
6282
+ TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["SUMMARY"] = 4] = "SUMMARY";
6283
+ })(exports.TaxReturnCategorySectionEnum || (exports.TaxReturnCategorySectionEnum = {}));
6284
+
6318
6285
  exports.TaxReviewStatusEnum = void 0;
6319
6286
  (function (TaxReviewStatusEnum) {
6320
6287
  TaxReviewStatusEnum[TaxReviewStatusEnum["NEW"] = 0] = "NEW";
@@ -8390,6 +8357,15 @@
8390
8357
  });
8391
8358
  return PropertySale;
8392
8359
  }(PropertySale$1));
8360
+ __decorate([
8361
+ classTransformer.Type(function () { return Number; })
8362
+ ], PropertySale.prototype, "commission", void 0);
8363
+ __decorate([
8364
+ classTransformer.Type(function () { return Number; })
8365
+ ], PropertySale.prototype, "legalFees", void 0);
8366
+ __decorate([
8367
+ classTransformer.Type(function () { return Number; })
8368
+ ], PropertySale.prototype, "otherCost", void 0);
8393
8369
  __decorate([
8394
8370
  classTransformer.Type(function () { return Date; })
8395
8371
  ], PropertySale.prototype, "settlementDate", void 0);
@@ -8582,6 +8558,13 @@
8582
8558
  };
8583
8559
  return ReportItem;
8584
8560
  }());
8561
+ __decorate([
8562
+ classTransformer.Type(function () { return ReportItem; }),
8563
+ classTransformer.Transform(function (_b) {
8564
+ var value = _b.value;
8565
+ return new ReportItemCollection(value);
8566
+ })
8567
+ ], ReportItem.prototype, "items", void 0);
8585
8568
 
8586
8569
  /**
8587
8570
  * Used in tax summary reports to show specific details relating to an amount in the report.
@@ -8643,7 +8626,7 @@
8643
8626
  });
8644
8627
  Object.defineProperty(TaxSummary.prototype, "taxPercent", {
8645
8628
  get: function () {
8646
- return this.summary.items.grossTaxPayable / this.summary.netAmount;
8629
+ return this.summary.items.findByCategory(exports.TaxReturnCategoryListEnum.GROSS_TAX_PAYABLE).amount / this.summary.netAmount;
8647
8630
  },
8648
8631
  enumerable: false,
8649
8632
  configurable: true
@@ -8654,7 +8637,8 @@
8654
8637
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8655
8638
  */
8656
8639
  get: function () {
8657
- return this.workNetTotal - Math.abs(this.summary.items.getTaxWithheld(exports.TaxReturnCategorySectionEnum.WORK_TANK));
8640
+ var taxWithheld = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.work.taxWithheld, exports.TaxSummarySectionEnum.WORK_TANK);
8641
+ return this.workNetTotal - Math.abs(taxWithheld);
8658
8642
  },
8659
8643
  enumerable: false,
8660
8644
  configurable: true
@@ -8665,7 +8649,10 @@
8665
8649
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8666
8650
  */
8667
8651
  get: function () {
8668
- return this.work.items.salary - Math.abs(this.work.items.workExpenses);
8652
+ var income = this.work.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.work.income, exports.TaxSummarySectionEnum.WORK_TANK);
8653
+ var expenses = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.work.expenses, exports.TaxSummarySectionEnum.WORK_TANK);
8654
+ var interest = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.work.interest, exports.TaxSummarySectionEnum.WORK_TANK);
8655
+ return income - Math.abs(expenses) - Math.abs(interest);
8669
8656
  },
8670
8657
  enumerable: false,
8671
8658
  configurable: true
@@ -8676,7 +8663,10 @@
8676
8663
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8677
8664
  */
8678
8665
  get: function () {
8679
- return this.property.items.rentalIncome - Math.abs(this.property.items.rentalDeductions) - Math.abs(this.property.items.interestDeductions);
8666
+ var income = this.property.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.property.income, exports.TaxSummarySectionEnum.PROPERTY_TANK);
8667
+ var expenses = this.property.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.property.expenses, exports.TaxSummarySectionEnum.PROPERTY_TANK);
8668
+ var interest = this.property.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.property.interest, exports.TaxSummarySectionEnum.PROPERTY_TANK);
8669
+ return income - Math.abs(expenses) - Math.abs(interest);
8680
8670
  },
8681
8671
  enumerable: false,
8682
8672
  configurable: true
@@ -8687,7 +8677,8 @@
8687
8677
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8688
8678
  */
8689
8679
  get: function () {
8690
- return this.propertyNetCash - Math.abs(this.property.items.propertyDepreciations);
8680
+ var depreciation = this.property.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.property.depreciation, exports.TaxSummarySectionEnum.PROPERTY_TANK);
8681
+ return this.propertyNetCash - Math.abs(depreciation);
8691
8682
  },
8692
8683
  enumerable: false,
8693
8684
  configurable: true
@@ -8698,7 +8689,11 @@
8698
8689
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8699
8690
  */
8700
8691
  get: function () {
8701
- return this.otherIncome.items.otherIncome - Math.abs(this.otherIncome.items.otherDeductions) - Math.abs(this.summary.items.getTaxWithheld(exports.TaxReturnCategorySectionEnum.OTHER_INCOME)) - Math.abs(this.summary.items.taxInstalments);
8692
+ var income = this.otherIncome.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.other.income, exports.TaxSummarySectionEnum.OTHER_INCOME);
8693
+ var expenses = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.other.expenses, exports.TaxSummarySectionEnum.OTHER_INCOME);
8694
+ var taxWithheld = this.summary.items.sumByCategoriesAndSection([exports.TaxReturnCategoryListEnum.TAX_WITHHELD], exports.TaxSummarySectionEnum.OTHER_INCOME);
8695
+ var taxInstalments = this.summary.items.sumByCategoriesAndSection([exports.TaxReturnCategoryListEnum.TAX_INSTALMENTS], exports.TaxSummarySectionEnum.OTHER_INCOME);
8696
+ return income - Math.abs(expenses) - Math.abs(taxWithheld) - Math.abs(taxInstalments);
8702
8697
  },
8703
8698
  enumerable: false,
8704
8699
  configurable: true
@@ -8709,7 +8704,12 @@
8709
8704
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8710
8705
  */
8711
8706
  get: function () {
8712
- return this.otherIncome.items.otherIncome - Math.abs(this.otherIncome.items.otherDeductions) + Math.abs(this.summary.items.taxOffsets) + Math.abs(this.summary.items.taxInstalments) + Math.abs(this.summary.items.frankingCredits);
8707
+ var income = this.otherIncome.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.other.income, exports.TaxSummarySectionEnum.OTHER_INCOME);
8708
+ var expenses = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.other.expenses, exports.TaxSummarySectionEnum.OTHER_INCOME);
8709
+ var taxOffsets = this.summary.items.sumByCategoriesAndSection([exports.TaxReturnCategoryListEnum.TAX_OFFSETS], exports.TaxSummarySectionEnum.SUMMARY);
8710
+ var taxInstallments = this.summary.items.sumByCategoriesAndSection([exports.TaxReturnCategoryListEnum.TAX_INSTALMENTS], exports.TaxSummarySectionEnum.OTHER_INCOME);
8711
+ var frankingCredits = this.summary.items.sumByCategoriesAndSection([exports.TaxReturnCategoryListEnum.FRANKING_CREDITS], exports.TaxSummarySectionEnum.OTHER_INCOME);
8712
+ return income - Math.abs(expenses) + Math.abs(taxOffsets) + Math.abs(taxInstallments) + Math.abs(frankingCredits);
8713
8713
  },
8714
8714
  enumerable: false,
8715
8715
  configurable: true
@@ -14295,6 +14295,7 @@
14295
14295
  exports.SoleForecastService = SoleForecastService;
14296
14296
  exports.SseService = SseService;
14297
14297
  exports.SubscriptionService = SubscriptionService;
14298
+ exports.TAX_RETURN_CATEGORIES = TAX_RETURN_CATEGORIES;
14298
14299
  exports.TYPE_LOAN = TYPE_LOAN;
14299
14300
  exports.TaxExemption = TaxExemption;
14300
14301
  exports.TaxExemptionMetadata = TaxExemptionMetadata;