taxtank-core 0.17.0 → 0.17.1

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.
@@ -5556,265 +5556,219 @@
5556
5556
  return ServiceSubscriptionCollection;
5557
5557
  }(Collection));
5558
5558
 
5559
+ /**
5560
+ * collection for tax return category items
5561
+ */
5562
+ var ReportItemCollection = /** @class */ (function (_super) {
5563
+ __extends(ReportItemCollection, _super);
5564
+ function ReportItemCollection() {
5565
+ return _super !== null && _super.apply(this, arguments) || this;
5566
+ }
5567
+ /**
5568
+ * Recursively get collection of report items by Tax Summary Section.
5569
+ * Search items which has details
5570
+ */
5571
+ ReportItemCollection.prototype.getBySection = function (section) {
5572
+ var e_1, _a;
5573
+ var result = [];
5574
+ try {
5575
+ for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
5576
+ var reportItem = _c.value;
5577
+ if (reportItem.details.length && reportItem.taxReturnCategory.section === section) {
5578
+ result.push(reportItem);
5579
+ }
5580
+ else {
5581
+ result.push.apply(result, __spreadArray([], __read(reportItem.items.getBySection(section).toArray())));
5582
+ }
5583
+ }
5584
+ }
5585
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
5586
+ finally {
5587
+ try {
5588
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
5589
+ }
5590
+ finally { if (e_1) throw e_1.error; }
5591
+ }
5592
+ return this.create(result);
5593
+ };
5594
+ /**
5595
+ * Recursively find report item by Tax Return Category ID
5596
+ */
5597
+ ReportItemCollection.prototype.findByCategory = function (categoryId) {
5598
+ var e_2, _a;
5599
+ var result;
5600
+ try {
5601
+ for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
5602
+ var reportItem = _c.value;
5603
+ if (result) {
5604
+ break;
5605
+ }
5606
+ if (reportItem.taxReturnCategory.id === categoryId) {
5607
+ result = reportItem;
5608
+ }
5609
+ else {
5610
+ result = reportItem.items.findByCategory(categoryId);
5611
+ }
5612
+ }
5613
+ }
5614
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
5615
+ finally {
5616
+ try {
5617
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
5618
+ }
5619
+ finally { if (e_2) throw e_2.error; }
5620
+ }
5621
+ return result;
5622
+ };
5623
+ /**
5624
+ * Get Collection of report items by Tax Return Categories IDs
5625
+ */
5626
+ ReportItemCollection.prototype.getByCategories = function (categories) {
5627
+ var _this = this;
5628
+ return this.create(compact__default["default"](categories.map(function (category) { return _this.findByCategory(category); })));
5629
+ };
5630
+ /**
5631
+ * A short call to a chain of methods that we often use.
5632
+ * Get total amount of report items by Tax Return categories and Tax Summary Section.
5633
+ */
5634
+ ReportItemCollection.prototype.sumByCategoriesAndSection = function (categories, section) {
5635
+ return this.getByCategories(categories).getBySection(section).sumBy('amount');
5636
+ };
5637
+ /**
5638
+ * Get collection of all report item details related to passed income source
5639
+ * @TODO Alex: consider to create and move to ReportItemDetailsCollection
5640
+ */
5641
+ ReportItemCollection.prototype.getDetailsByIncomeSource = function (incomeSource) {
5642
+ var e_3, _a;
5643
+ var result = [];
5644
+ try {
5645
+ for (var _b = __values(this.items), _c = _b.next(); !_c.done; _c = _b.next()) {
5646
+ var reportItem = _c.value;
5647
+ if (reportItem.details.length) {
5648
+ result.push.apply(result, __spreadArray([], __read(reportItem.details.filter(function (details) { return details.name === incomeSource.name; }))));
5649
+ }
5650
+ else {
5651
+ result.push.apply(result, __spreadArray([], __read(reportItem.items.getDetailsByIncomeSource(incomeSource).toArray())));
5652
+ }
5653
+ }
5654
+ }
5655
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
5656
+ finally {
5657
+ try {
5658
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
5659
+ }
5660
+ finally { if (e_3) throw e_3.error; }
5661
+ }
5662
+ return new Collection(result);
5663
+ };
5664
+ return ReportItemCollection;
5665
+ }(Collection));
5666
+
5559
5667
  exports.TaxReturnCategoryListEnum = void 0;
5560
5668
  (function (TaxReturnCategoryListEnum) {
5561
5669
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["SALARY"] = 1] = "SALARY";
5670
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["ALLOWANCES_EARNINGS_TIPS_DIRECTOR_FEES"] = 30] = "ALLOWANCES_EARNINGS_TIPS_DIRECTOR_FEES";
5671
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["EMPLOYER_LUMP_SUM_PAYMENTS"] = 31] = "EMPLOYER_LUMP_SUM_PAYMENTS";
5672
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["ETP"] = 32] = "ETP";
5673
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["GOVERNMENT_ALLOWANCES"] = 2] = "GOVERNMENT_ALLOWANCES";
5674
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["GOVERNMENT_PENSIONS"] = 33] = "GOVERNMENT_PENSIONS";
5675
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["ANNUITIES_SUPER_INCOME_STREAMS"] = 3] = "ANNUITIES_SUPER_INCOME_STREAMS";
5676
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["SUPERANNUATION_LUMP_SUM_PAYMENTS"] = 34] = "SUPERANNUATION_LUMP_SUM_PAYMENTS";
5677
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["ATTRIBUTED_PSI_INCOME"] = 4] = "ATTRIBUTED_PSI_INCOME";
5562
5678
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["WORK_EXPENSES"] = 7] = "WORK_EXPENSES";
5563
5679
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["GROSS_RENT"] = 8] = "GROSS_RENT";
5680
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_RENTAL_DEDUCTIONS"] = 12] = "OTHER_RENTAL_DEDUCTIONS";
5564
5681
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["INTEREST_DEDUCTIONS"] = 9] = "INTEREST_DEDUCTIONS";
5565
5682
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["CAPITAL_WORKS"] = 10] = "CAPITAL_WORKS";
5566
5683
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["DEPRECIATION"] = 11] = "DEPRECIATION";
5567
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_RENTAL_DEDUCTIONS"] = 12] = "OTHER_RENTAL_DEDUCTIONS";
5568
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["BORROWING_EXPENSES"] = 29] = "BORROWING_EXPENSES";
5684
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["GROSS_INTEREST"] = 5] = "GROSS_INTEREST";
5685
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["DIVIDENDS"] = 6] = "DIVIDENDS";
5686
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["SHARE_SCHEMES"] = 35] = "SHARE_SCHEMES";
5569
5687
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["PARTNERSHIPS_TRUSTS"] = 13] = "PARTNERSHIPS_TRUSTS";
5570
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["PCI_SBE_INCOME"] = 14] = "PCI_SBE_INCOME";
5688
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["PSI_SBE_INCOME"] = 14] = "PSI_SBE_INCOME";
5689
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["SOLE_TRADER_BUSINESS_INCOME"] = 38] = "SOLE_TRADER_BUSINESS_INCOME";
5571
5690
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["CAPITAL_GAINS"] = 15] = "CAPITAL_GAINS";
5572
5691
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["FOREIGN_SOURCE_INCOME"] = 16] = "FOREIGN_SOURCE_INCOME";
5573
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_INCOME"] = 17] = "OTHER_INCOME";
5692
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["BONUSES_FROM_LIFE_INSURANCE"] = 17] = "BONUSES_FROM_LIFE_INSURANCE";
5693
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["FORESTRY_MANAGED_INVESTMENT_SCHEMES"] = 39] = "FORESTRY_MANAGED_INVESTMENT_SCHEMES";
5694
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_INCOME"] = 40] = "OTHER_INCOME";
5695
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_CREDITS"] = 23] = "TAX_CREDITS";
5574
5696
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_DEDUCTIONS"] = 18] = "OTHER_DEDUCTIONS";
5697
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_OFFSETS"] = 27] = "TAX_OFFSETS";
5698
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["BORROWING_EXPENSES"] = 29] = "BORROWING_EXPENSES";
5575
5699
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["GROSS_TAX_PAYABLE"] = 19] = "GROSS_TAX_PAYABLE";
5576
5700
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_ON_TAXABLE_INCOME"] = 20] = "TAX_ON_TAXABLE_INCOME";
5577
5701
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["MEDICARE"] = 21] = "MEDICARE";
5578
5702
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["STUDENT_LOAN_REPAYMENT"] = 22] = "STUDENT_LOAN_REPAYMENT";
5579
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_CREDITS"] = 23] = "TAX_CREDITS";
5580
5703
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_WITHHELD"] = 24] = "TAX_WITHHELD";
5581
5704
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_INSTALMENTS"] = 25] = "TAX_INSTALMENTS";
5582
5705
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["FRANKING_CREDITS"] = 26] = "FRANKING_CREDITS";
5583
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_OFFSETS"] = 27] = "TAX_OFFSETS";
5584
5706
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_PAYABLE"] = 28] = "TAX_PAYABLE";
5585
5707
  })(exports.TaxReturnCategoryListEnum || (exports.TaxReturnCategoryListEnum = {}));
5586
5708
 
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;
5709
+ var TAX_RETURN_CATEGORIES = {
5710
+ work: {
5711
+ income: [
5712
+ exports.TaxReturnCategoryListEnum.SALARY,
5713
+ exports.TaxReturnCategoryListEnum.ALLOWANCES_EARNINGS_TIPS_DIRECTOR_FEES,
5714
+ exports.TaxReturnCategoryListEnum.EMPLOYER_LUMP_SUM_PAYMENTS,
5715
+ exports.TaxReturnCategoryListEnum.ETP,
5716
+ exports.TaxReturnCategoryListEnum.GOVERNMENT_ALLOWANCES,
5717
+ exports.TaxReturnCategoryListEnum.GOVERNMENT_PENSIONS,
5718
+ exports.TaxReturnCategoryListEnum.ANNUITIES_SUPER_INCOME_STREAMS,
5719
+ exports.TaxReturnCategoryListEnum.SUPERANNUATION_LUMP_SUM_PAYMENTS,
5720
+ exports.TaxReturnCategoryListEnum.ATTRIBUTED_PSI_INCOME
5721
+ ],
5722
+ expenses: [
5723
+ exports.TaxReturnCategoryListEnum.WORK_EXPENSES
5724
+ ],
5725
+ interest: [
5726
+ exports.TaxReturnCategoryListEnum.GROSS_INTEREST
5727
+ ],
5728
+ taxWithheld: [
5729
+ exports.TaxReturnCategoryListEnum.TAX_WITHHELD
5730
+ ]
5731
+ },
5732
+ property: {
5733
+ income: [
5734
+ exports.TaxReturnCategoryListEnum.GROSS_RENT
5735
+ ],
5736
+ expenses: [
5737
+ exports.TaxReturnCategoryListEnum.OTHER_RENTAL_DEDUCTIONS
5738
+ ],
5739
+ interest: [
5740
+ exports.TaxReturnCategoryListEnum.INTEREST_DEDUCTIONS
5741
+ ],
5742
+ depreciation: [
5743
+ exports.TaxReturnCategoryListEnum.CAPITAL_WORKS,
5744
+ exports.TaxReturnCategoryListEnum.DEPRECIATION
5745
+ ]
5746
+ },
5747
+ other: {
5748
+ income: [
5749
+ exports.TaxReturnCategoryListEnum.GROSS_INTEREST,
5750
+ exports.TaxReturnCategoryListEnum.DIVIDENDS,
5751
+ exports.TaxReturnCategoryListEnum.SHARE_SCHEMES,
5752
+ exports.TaxReturnCategoryListEnum.PARTNERSHIPS_TRUSTS,
5753
+ exports.TaxReturnCategoryListEnum.PSI_SBE_INCOME,
5754
+ exports.TaxReturnCategoryListEnum.SOLE_TRADER_BUSINESS_INCOME,
5755
+ exports.TaxReturnCategoryListEnum.CAPITAL_GAINS,
5756
+ exports.TaxReturnCategoryListEnum.FOREIGN_SOURCE_INCOME,
5757
+ exports.TaxReturnCategoryListEnum.BONUSES_FROM_LIFE_INSURANCE,
5758
+ exports.TaxReturnCategoryListEnum.FORESTRY_MANAGED_INVESTMENT_SCHEMES,
5759
+ exports.TaxReturnCategoryListEnum.OTHER_INCOME
5760
+ ],
5761
+ expenses: [
5762
+ exports.TaxReturnCategoryListEnum.OTHER_DEDUCTIONS
5763
+ ],
5764
+ taxCredits: [
5765
+ exports.TaxReturnCategoryListEnum.TAX_CREDITS
5766
+ ],
5767
+ taxOffsets: [
5768
+ exports.TaxReturnCategoryListEnum.TAX_OFFSETS
5769
+ ]
5602
5770
  }
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));
5771
+ };
5818
5772
 
5819
5773
  /**
5820
5774
  * Collection of tax review
@@ -6315,6 +6269,14 @@
6315
6269
  TaxCalculationTypeEnum[TaxCalculationTypeEnum["ETP_TAX_FREE"] = 9] = "ETP_TAX_FREE";
6316
6270
  })(exports.TaxCalculationTypeEnum || (exports.TaxCalculationTypeEnum = {}));
6317
6271
 
6272
+ exports.TaxReturnCategorySectionEnum = void 0;
6273
+ (function (TaxReturnCategorySectionEnum) {
6274
+ TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["WORK_TANK"] = 1] = "WORK_TANK";
6275
+ TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["PROPERTY_TANK"] = 2] = "PROPERTY_TANK";
6276
+ TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["OTHER_INCOME"] = 3] = "OTHER_INCOME";
6277
+ TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["SUMMARY"] = 4] = "SUMMARY";
6278
+ })(exports.TaxReturnCategorySectionEnum || (exports.TaxReturnCategorySectionEnum = {}));
6279
+
6318
6280
  exports.TaxReviewStatusEnum = void 0;
6319
6281
  (function (TaxReviewStatusEnum) {
6320
6282
  TaxReviewStatusEnum[TaxReviewStatusEnum["NEW"] = 0] = "NEW";
@@ -8582,6 +8544,13 @@
8582
8544
  };
8583
8545
  return ReportItem;
8584
8546
  }());
8547
+ __decorate([
8548
+ classTransformer.Type(function () { return ReportItem; }),
8549
+ classTransformer.Transform(function (_b) {
8550
+ var value = _b.value;
8551
+ return new ReportItemCollection(value);
8552
+ })
8553
+ ], ReportItem.prototype, "items", void 0);
8585
8554
 
8586
8555
  /**
8587
8556
  * Used in tax summary reports to show specific details relating to an amount in the report.
@@ -8643,7 +8612,7 @@
8643
8612
  });
8644
8613
  Object.defineProperty(TaxSummary.prototype, "taxPercent", {
8645
8614
  get: function () {
8646
- return this.summary.items.grossTaxPayable / this.summary.netAmount;
8615
+ return this.summary.items.findByCategory(exports.TaxReturnCategoryListEnum.GROSS_TAX_PAYABLE).amount / this.summary.netAmount;
8647
8616
  },
8648
8617
  enumerable: false,
8649
8618
  configurable: true
@@ -8654,7 +8623,8 @@
8654
8623
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8655
8624
  */
8656
8625
  get: function () {
8657
- return this.workNetTotal - Math.abs(this.summary.items.getTaxWithheld(exports.TaxReturnCategorySectionEnum.WORK_TANK));
8626
+ var taxWithheld = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.work.taxWithheld, exports.TaxSummarySectionEnum.WORK_TANK);
8627
+ return this.workNetTotal - Math.abs(taxWithheld);
8658
8628
  },
8659
8629
  enumerable: false,
8660
8630
  configurable: true
@@ -8665,7 +8635,10 @@
8665
8635
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8666
8636
  */
8667
8637
  get: function () {
8668
- return this.work.items.salary - Math.abs(this.work.items.workExpenses);
8638
+ var income = this.work.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.work.income, exports.TaxSummarySectionEnum.WORK_TANK);
8639
+ var expenses = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.work.expenses, exports.TaxSummarySectionEnum.WORK_TANK);
8640
+ var interest = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.work.interest, exports.TaxSummarySectionEnum.WORK_TANK);
8641
+ return income - Math.abs(expenses) - Math.abs(interest);
8669
8642
  },
8670
8643
  enumerable: false,
8671
8644
  configurable: true
@@ -8676,7 +8649,10 @@
8676
8649
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8677
8650
  */
8678
8651
  get: function () {
8679
- return this.property.items.rentalIncome - Math.abs(this.property.items.rentalDeductions) - Math.abs(this.property.items.interestDeductions);
8652
+ var income = this.property.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.property.income, exports.TaxSummarySectionEnum.PROPERTY_TANK);
8653
+ var expenses = this.property.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.property.expenses, exports.TaxSummarySectionEnum.PROPERTY_TANK);
8654
+ var interest = this.property.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.property.interest, exports.TaxSummarySectionEnum.PROPERTY_TANK);
8655
+ return income - Math.abs(expenses) - Math.abs(interest);
8680
8656
  },
8681
8657
  enumerable: false,
8682
8658
  configurable: true
@@ -8687,7 +8663,8 @@
8687
8663
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8688
8664
  */
8689
8665
  get: function () {
8690
- return this.propertyNetCash - Math.abs(this.property.items.propertyDepreciations);
8666
+ var depreciation = this.property.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.property.depreciation, exports.TaxSummarySectionEnum.PROPERTY_TANK);
8667
+ return this.propertyNetCash - Math.abs(depreciation);
8691
8668
  },
8692
8669
  enumerable: false,
8693
8670
  configurable: true
@@ -8698,7 +8675,11 @@
8698
8675
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8699
8676
  */
8700
8677
  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);
8678
+ var income = this.otherIncome.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.other.income, exports.TaxSummarySectionEnum.OTHER_INCOME);
8679
+ var expenses = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.other.expenses, exports.TaxSummarySectionEnum.OTHER_INCOME);
8680
+ var taxWithheld = this.summary.items.sumByCategoriesAndSection([exports.TaxReturnCategoryListEnum.TAX_WITHHELD], exports.TaxSummarySectionEnum.OTHER_INCOME);
8681
+ var taxInstalments = this.summary.items.sumByCategoriesAndSection([exports.TaxReturnCategoryListEnum.TAX_INSTALMENTS], exports.TaxSummarySectionEnum.OTHER_INCOME);
8682
+ return income - Math.abs(expenses) - Math.abs(taxWithheld) - Math.abs(taxInstalments);
8702
8683
  },
8703
8684
  enumerable: false,
8704
8685
  configurable: true
@@ -8709,7 +8690,12 @@
8709
8690
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8710
8691
  */
8711
8692
  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);
8693
+ var income = this.otherIncome.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.other.income, exports.TaxSummarySectionEnum.OTHER_INCOME);
8694
+ var expenses = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.other.expenses, exports.TaxSummarySectionEnum.OTHER_INCOME);
8695
+ var taxOffsets = this.summary.items.sumByCategoriesAndSection([exports.TaxReturnCategoryListEnum.TAX_OFFSETS], exports.TaxSummarySectionEnum.SUMMARY);
8696
+ var taxInstallments = this.summary.items.sumByCategoriesAndSection([exports.TaxReturnCategoryListEnum.TAX_INSTALMENTS], exports.TaxSummarySectionEnum.OTHER_INCOME);
8697
+ var frankingCredits = this.summary.items.sumByCategoriesAndSection([exports.TaxReturnCategoryListEnum.FRANKING_CREDITS], exports.TaxSummarySectionEnum.OTHER_INCOME);
8698
+ return income - Math.abs(expenses) + Math.abs(taxOffsets) + Math.abs(taxInstallments) + Math.abs(frankingCredits);
8713
8699
  },
8714
8700
  enumerable: false,
8715
8701
  configurable: true
@@ -14295,6 +14281,7 @@
14295
14281
  exports.SoleForecastService = SoleForecastService;
14296
14282
  exports.SseService = SseService;
14297
14283
  exports.SubscriptionService = SubscriptionService;
14284
+ exports.TAX_RETURN_CATEGORIES = TAX_RETURN_CATEGORIES;
14298
14285
  exports.TYPE_LOAN = TYPE_LOAN;
14299
14286
  exports.TaxExemption = TaxExemption;
14300
14287
  exports.TaxExemptionMetadata = TaxExemptionMetadata;