taxtank-core 0.16.12 → 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.
Files changed (80) hide show
  1. package/bundles/taxtank-core.umd.js +370 -383
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/bank-transaction.collection.js +1 -1
  4. package/esm2015/lib/collections/collection-dictionary.js +16 -1
  5. package/esm2015/lib/collections/depreciation.collection.js +2 -2
  6. package/esm2015/lib/collections/exportable.collection.js +17 -0
  7. package/esm2015/lib/collections/loan/loan-payment.collection.js +31 -0
  8. package/esm2015/lib/collections/loan/loan.collection.js +18 -0
  9. package/esm2015/lib/collections/report/property/property-report-item-transaction.collection.js +1 -1
  10. package/esm2015/lib/collections/report/vehicle-expense/vehicle-expense.collection.js +1 -1
  11. package/esm2015/lib/collections/tax-summary/report-item.collection.js +50 -120
  12. package/esm2015/lib/collections/tax-summary/tax-return-categories.const.js +65 -0
  13. package/esm2015/lib/collections/transaction/transaction-allocation.collection.js +40 -0
  14. package/esm2015/lib/collections/transaction/transaction.collection.js +167 -0
  15. package/esm2015/lib/db/Enums/tax-return-category-list.enum.js +21 -7
  16. package/esm2015/lib/models/bank/bank-transaction.js +1 -1
  17. package/esm2015/lib/models/export/export-cell-type.enum.js +10 -0
  18. package/esm2015/lib/models/export/export-cell.js +6 -0
  19. package/esm2015/lib/models/export/export-data-table.js +1 -7
  20. package/esm2015/lib/models/income-source/income-source-chart-data.js +1 -1
  21. package/esm2015/lib/models/loan/loan-payment.js +2 -24
  22. package/esm2015/lib/models/logbook/vehicle-claim.js +1 -1
  23. package/esm2015/lib/models/property/property-equity-chart-data.js +1 -1
  24. package/esm2015/lib/models/report/property/property-report-item-transaction.js +1 -1
  25. package/esm2015/lib/models/tax-summary/report-item.js +8 -1
  26. package/esm2015/lib/models/tax-summary/tax-summary.js +28 -9
  27. package/esm2015/lib/models/transaction/transaction.js +1 -1
  28. package/esm2015/lib/services/account-setup/account-setup.service.js +2 -2
  29. package/esm2015/lib/services/bank/bank-account-calculation.service.js +1 -1
  30. package/esm2015/lib/services/bank/bank-transaction-calculation.service.js +1 -1
  31. package/esm2015/lib/services/export/export-formatter.service.js +31 -0
  32. package/esm2015/lib/services/pdf/pdf.service.js +9 -4
  33. package/esm2015/lib/services/property/property-calculation/property-calculation.service.js +1 -1
  34. package/esm2015/lib/services/report/property/property-transaction-report.service.js +2 -2
  35. package/esm2015/lib/services/transaction/transaction-calculation.service.js +2 -2
  36. package/esm2015/public-api.js +8 -10
  37. package/fesm2015/taxtank-core.js +307 -286
  38. package/fesm2015/taxtank-core.js.map +1 -1
  39. package/lib/collections/bank-transaction.collection.d.ts +1 -1
  40. package/lib/collections/collection-dictionary.d.ts +5 -0
  41. package/lib/collections/depreciation.collection.d.ts +1 -1
  42. package/lib/collections/exportable.collection.d.ts +9 -0
  43. package/lib/collections/loan/loan-payment.collection.d.ts +7 -0
  44. package/lib/collections/{loan.collection.d.ts → loan/loan.collection.d.ts} +2 -2
  45. package/lib/collections/report/property/property-report-item-transaction.collection.d.ts +1 -1
  46. package/lib/collections/report/vehicle-expense/vehicle-expense.collection.d.ts +1 -1
  47. package/lib/collections/tax-summary/report-item.collection.d.ts +17 -51
  48. package/lib/collections/tax-summary/tax-return-categories.const.d.ts +6 -0
  49. package/lib/collections/{transaction-allocation.collection.d.ts → transaction/transaction-allocation.collection.d.ts} +6 -6
  50. package/lib/collections/{transaction.collection.d.ts → transaction/transaction.collection.d.ts} +9 -5
  51. package/lib/db/Enums/tax-return-category-list.enum.d.ts +20 -6
  52. package/lib/models/bank/bank-transaction.d.ts +1 -1
  53. package/lib/models/export/export-cell-type.enum.d.ts +8 -0
  54. package/lib/models/export/export-cell.d.ts +8 -0
  55. package/lib/models/export/export-data-table.d.ts +3 -2
  56. package/lib/models/income-source/income-source-chart-data.d.ts +1 -1
  57. package/lib/models/loan/loan-payment.d.ts +1 -5
  58. package/lib/models/logbook/vehicle-claim.d.ts +1 -1
  59. package/lib/models/property/property-equity-chart-data.d.ts +1 -1
  60. package/lib/models/report/property/property-report-item-transaction.d.ts +1 -1
  61. package/lib/models/tax-summary/report-item.d.ts +3 -2
  62. package/lib/models/transaction/transaction.d.ts +1 -1
  63. package/lib/services/bank/bank-account-calculation.service.d.ts +1 -1
  64. package/lib/services/bank/bank-transaction-calculation.service.d.ts +1 -1
  65. package/lib/services/export/export-formatter.service.d.ts +11 -0
  66. package/lib/services/pdf/pdf.service.d.ts +3 -0
  67. package/lib/services/property/property-calculation/property-calculation.service.d.ts +2 -2
  68. package/lib/services/report/property/property-transaction-report.service.d.ts +1 -1
  69. package/lib/services/transaction/transaction-calculation.service.d.ts +2 -2
  70. package/package.json +1 -1
  71. package/public-api.d.ts +7 -9
  72. package/esm2015/lib/collections/loan.collection.js +0 -18
  73. package/esm2015/lib/collections/transaction-allocation.collection.js +0 -40
  74. package/esm2015/lib/collections/transaction.collection.js +0 -143
  75. package/esm2015/lib/interfaces/exportable.interface.js +0 -2
  76. package/esm2015/lib/services/data-table/data-table.service.js +0 -47
  77. package/esm2015/lib/services/property/property-holding-costs/property-holding-costs.service.js +0 -53
  78. package/lib/interfaces/exportable.interface.d.ts +0 -9
  79. package/lib/services/data-table/data-table.service.d.ts +0 -19
  80. package/lib/services/property/property-holding-costs/property-holding-costs.service.d.ts +0 -24
@@ -1188,6 +1188,22 @@
1188
1188
  CollectionDictionary.prototype.length = function () {
1189
1189
  return this.keys.length;
1190
1190
  };
1191
+ /**
1192
+ * @Todo find a better solution to get list of the sorted keys
1193
+ * Get array of the "keys" by provided order
1194
+ */
1195
+ CollectionDictionary.prototype.getSortedKeys = function (isDesc) {
1196
+ if (isDesc === void 0) { isDesc = false; }
1197
+ return this.keys.sort(function (a, b) {
1198
+ if (a > b) {
1199
+ return !isDesc ? 1 : -1;
1200
+ }
1201
+ if (a < b) {
1202
+ return !isDesc ? -1 : 1;
1203
+ }
1204
+ return 0;
1205
+ });
1206
+ };
1191
1207
  /**
1192
1208
  * Group collection items by passed path into items object
1193
1209
  */
@@ -1860,6 +1876,50 @@
1860
1876
  TankTypeEnum[TankTypeEnum["SOLE"] = 4] = "SOLE";
1861
1877
  })(exports.TankTypeEnum || (exports.TankTypeEnum = {}));
1862
1878
 
1879
+ /**
1880
+ * export table column
1881
+ */
1882
+ var ExportCell = /** @class */ (function () {
1883
+ function ExportCell() {
1884
+ }
1885
+ return ExportCell;
1886
+ }());
1887
+
1888
+ /**
1889
+ * type of export table column value
1890
+ */
1891
+ var ExportCellTypeEnum;
1892
+ (function (ExportCellTypeEnum) {
1893
+ ExportCellTypeEnum[ExportCellTypeEnum["STRING"] = 0] = "STRING";
1894
+ ExportCellTypeEnum[ExportCellTypeEnum["CURRENCY"] = 1] = "CURRENCY";
1895
+ ExportCellTypeEnum[ExportCellTypeEnum["DATE"] = 2] = "DATE";
1896
+ })(ExportCellTypeEnum || (ExportCellTypeEnum = {}));
1897
+
1898
+ var ExportDataTable = /** @class */ (function () {
1899
+ function ExportDataTable() {
1900
+ }
1901
+ return ExportDataTable;
1902
+ }());
1903
+
1904
+ var ExportableCollection = /** @class */ (function (_super) {
1905
+ __extends(ExportableCollection, _super);
1906
+ function ExportableCollection() {
1907
+ return _super !== null && _super.apply(this, arguments) || this;
1908
+ }
1909
+ ExportableCollection.prototype.getExportFooter = function (type) {
1910
+ return [];
1911
+ };
1912
+ ;
1913
+ ExportableCollection.prototype.export = function (type) {
1914
+ return classTransformer.plainToClass(ExportDataTable, {
1915
+ header: this.getExportHeader(type),
1916
+ body: this.getExportBody(type),
1917
+ footer: [this.getExportFooter(type)]
1918
+ });
1919
+ };
1920
+ return ExportableCollection;
1921
+ }(Collection));
1922
+
1863
1923
  /**
1864
1924
  * Collection of transactions
1865
1925
  */
@@ -2031,8 +2091,29 @@
2031
2091
  }
2032
2092
  }));
2033
2093
  };
2094
+ TransactionCollection.prototype.getExportHeader = function () {
2095
+ return ['Date', 'Description', 'Debit', 'Credit'];
2096
+ };
2097
+ TransactionCollection.prototype.getExportFooter = function () {
2098
+ return [
2099
+ classTransformer.plainToClass(ExportCell, { value: 'Total', type: ExportCellTypeEnum.STRING }),
2100
+ classTransformer.plainToClass(ExportCell, { value: '', type: ExportCellTypeEnum.STRING }),
2101
+ classTransformer.plainToClass(ExportCell, { value: this.sumBy('debit'), type: ExportCellTypeEnum.CURRENCY }),
2102
+ classTransformer.plainToClass(ExportCell, { value: this.sumBy('credit'), type: ExportCellTypeEnum.CURRENCY })
2103
+ ];
2104
+ };
2105
+ TransactionCollection.prototype.getExportBody = function () {
2106
+ return this.items.map(function (transaction) {
2107
+ return [
2108
+ classTransformer.plainToClass(ExportCell, { value: transaction.date, type: ExportCellTypeEnum.DATE }),
2109
+ classTransformer.plainToClass(ExportCell, { value: transaction.description, type: ExportCellTypeEnum.STRING }),
2110
+ classTransformer.plainToClass(ExportCell, { value: transaction.debit, type: ExportCellTypeEnum.CURRENCY }),
2111
+ classTransformer.plainToClass(ExportCell, { value: transaction.credit, type: ExportCellTypeEnum.CURRENCY })
2112
+ ];
2113
+ });
2114
+ };
2034
2115
  return TransactionCollection;
2035
- }(Collection));
2116
+ }(ExportableCollection));
2036
2117
 
2037
2118
  var DepreciationCollection = /** @class */ (function (_super) {
2038
2119
  __extends(DepreciationCollection, _super);
@@ -2243,6 +2324,38 @@
2243
2324
  return LoanCollection;
2244
2325
  }(Collection));
2245
2326
 
2327
+ var LoanPaymentCollection = /** @class */ (function (_super) {
2328
+ __extends(LoanPaymentCollection, _super);
2329
+ function LoanPaymentCollection() {
2330
+ return _super !== null && _super.apply(this, arguments) || this;
2331
+ }
2332
+ LoanPaymentCollection.prototype.getExportHeader = function () {
2333
+ return [
2334
+ 'Pmt No.',
2335
+ 'Date',
2336
+ 'Payment Due',
2337
+ 'Interest Accrued',
2338
+ 'Principal Paid',
2339
+ 'Principal Balance',
2340
+ 'Payout'
2341
+ ];
2342
+ };
2343
+ LoanPaymentCollection.prototype.getExportBody = function () {
2344
+ return this.items.map(function (payment) {
2345
+ return [
2346
+ classTransformer.plainToClass(ExportCell, { value: payment.number, type: ExportCellTypeEnum.STRING }),
2347
+ classTransformer.plainToClass(ExportCell, { value: payment.date, type: ExportCellTypeEnum.DATE }),
2348
+ classTransformer.plainToClass(ExportCell, { value: payment.paymentDue, type: ExportCellTypeEnum.CURRENCY }),
2349
+ classTransformer.plainToClass(ExportCell, { value: payment.interestAccrued, type: ExportCellTypeEnum.CURRENCY }),
2350
+ classTransformer.plainToClass(ExportCell, { value: payment.principalPaid, type: ExportCellTypeEnum.CURRENCY }),
2351
+ classTransformer.plainToClass(ExportCell, { value: payment.principalBalance, type: ExportCellTypeEnum.CURRENCY }),
2352
+ classTransformer.plainToClass(ExportCell, { value: payment.payout, type: ExportCellTypeEnum.CURRENCY }),
2353
+ ];
2354
+ });
2355
+ };
2356
+ return LoanPaymentCollection;
2357
+ }(ExportableCollection));
2358
+
2246
2359
  var MessageCollection = /** @class */ (function (_super) {
2247
2360
  __extends(MessageCollection, _super);
2248
2361
  function MessageCollection() {
@@ -4568,34 +4681,6 @@
4568
4681
  LoanVehicleTypeEnum[LoanVehicleTypeEnum["COMMERCIAL_HIRE_PURCHASE"] = 10] = "COMMERCIAL_HIRE_PURCHASE";
4569
4682
  })(exports.LoanVehicleTypeEnum || (exports.LoanVehicleTypeEnum = {}));
4570
4683
 
4571
- /**
4572
- * Class with structure of the data-table rows
4573
- */
4574
- var ExportRow = /** @class */ (function () {
4575
- function ExportRow() {
4576
- }
4577
- return ExportRow;
4578
- }());
4579
-
4580
- /**
4581
- * Enum which shows what type (in terms of business logic) of the data-table row item
4582
- */
4583
- var ExportRowDataTypeEnum;
4584
- (function (ExportRowDataTypeEnum) {
4585
- ExportRowDataTypeEnum[ExportRowDataTypeEnum["STRING"] = 0] = "STRING";
4586
- ExportRowDataTypeEnum[ExportRowDataTypeEnum["CURRENCY"] = 1] = "CURRENCY";
4587
- ExportRowDataTypeEnum[ExportRowDataTypeEnum["DATE"] = 2] = "DATE";
4588
- })(ExportRowDataTypeEnum || (ExportRowDataTypeEnum = {}));
4589
-
4590
- var EXPORT_DATA_TABLE_COLUMNS = [
4591
- 'Pmt No.',
4592
- 'Date',
4593
- 'Payment Due',
4594
- 'Interest Accrued',
4595
- 'Principal Paid',
4596
- 'Principal Balance',
4597
- 'Payout'
4598
- ];
4599
4684
  // @Todo no base model from backend list
4600
4685
  /**
4601
4686
  * Loan payment class
@@ -4603,17 +4688,6 @@
4603
4688
  var LoanPayment = /** @class */ (function () {
4604
4689
  function LoanPayment() {
4605
4690
  }
4606
- LoanPayment.prototype.toDataTableRows = function () {
4607
- return [
4608
- classTransformer.plainToClass(ExportRow, { data: this.number, type: ExportRowDataTypeEnum.STRING }),
4609
- classTransformer.plainToClass(ExportRow, { data: this.date, type: ExportRowDataTypeEnum.DATE }),
4610
- classTransformer.plainToClass(ExportRow, { data: this.paymentDue, type: ExportRowDataTypeEnum.CURRENCY }),
4611
- classTransformer.plainToClass(ExportRow, { data: this.interestAccrued, type: ExportRowDataTypeEnum.CURRENCY }),
4612
- classTransformer.plainToClass(ExportRow, { data: this.principalPaid, type: ExportRowDataTypeEnum.CURRENCY }),
4613
- classTransformer.plainToClass(ExportRow, { data: this.principalBalance, type: ExportRowDataTypeEnum.CURRENCY }),
4614
- classTransformer.plainToClass(ExportRow, { data: this.payout, type: ExportRowDataTypeEnum.CURRENCY }),
4615
- ];
4616
- };
4617
4691
  return LoanPayment;
4618
4692
  }());
4619
4693
  __decorate([
@@ -5482,265 +5556,219 @@
5482
5556
  return ServiceSubscriptionCollection;
5483
5557
  }(Collection));
5484
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
+
5485
5667
  exports.TaxReturnCategoryListEnum = void 0;
5486
5668
  (function (TaxReturnCategoryListEnum) {
5487
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";
5488
5678
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["WORK_EXPENSES"] = 7] = "WORK_EXPENSES";
5489
5679
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["GROSS_RENT"] = 8] = "GROSS_RENT";
5680
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_RENTAL_DEDUCTIONS"] = 12] = "OTHER_RENTAL_DEDUCTIONS";
5490
5681
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["INTEREST_DEDUCTIONS"] = 9] = "INTEREST_DEDUCTIONS";
5491
5682
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["CAPITAL_WORKS"] = 10] = "CAPITAL_WORKS";
5492
5683
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["DEPRECIATION"] = 11] = "DEPRECIATION";
5493
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_RENTAL_DEDUCTIONS"] = 12] = "OTHER_RENTAL_DEDUCTIONS";
5494
- 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";
5495
5687
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["PARTNERSHIPS_TRUSTS"] = 13] = "PARTNERSHIPS_TRUSTS";
5496
- 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";
5497
5690
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["CAPITAL_GAINS"] = 15] = "CAPITAL_GAINS";
5498
5691
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["FOREIGN_SOURCE_INCOME"] = 16] = "FOREIGN_SOURCE_INCOME";
5499
- 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";
5500
5696
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_DEDUCTIONS"] = 18] = "OTHER_DEDUCTIONS";
5697
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_OFFSETS"] = 27] = "TAX_OFFSETS";
5698
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["BORROWING_EXPENSES"] = 29] = "BORROWING_EXPENSES";
5501
5699
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["GROSS_TAX_PAYABLE"] = 19] = "GROSS_TAX_PAYABLE";
5502
5700
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_ON_TAXABLE_INCOME"] = 20] = "TAX_ON_TAXABLE_INCOME";
5503
5701
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["MEDICARE"] = 21] = "MEDICARE";
5504
5702
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["STUDENT_LOAN_REPAYMENT"] = 22] = "STUDENT_LOAN_REPAYMENT";
5505
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_CREDITS"] = 23] = "TAX_CREDITS";
5506
5703
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_WITHHELD"] = 24] = "TAX_WITHHELD";
5507
5704
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_INSTALMENTS"] = 25] = "TAX_INSTALMENTS";
5508
5705
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["FRANKING_CREDITS"] = 26] = "FRANKING_CREDITS";
5509
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_OFFSETS"] = 27] = "TAX_OFFSETS";
5510
5706
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_PAYABLE"] = 28] = "TAX_PAYABLE";
5511
5707
  })(exports.TaxReturnCategoryListEnum || (exports.TaxReturnCategoryListEnum = {}));
5512
5708
 
5513
- exports.TaxReturnCategorySectionEnum = void 0;
5514
- (function (TaxReturnCategorySectionEnum) {
5515
- TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["WORK_TANK"] = 1] = "WORK_TANK";
5516
- TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["PROPERTY_TANK"] = 2] = "PROPERTY_TANK";
5517
- TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["OTHER_INCOME"] = 3] = "OTHER_INCOME";
5518
- TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["SUMMARY"] = 4] = "SUMMARY";
5519
- })(exports.TaxReturnCategorySectionEnum || (exports.TaxReturnCategorySectionEnum = {}));
5520
-
5521
- /**
5522
- * collection for tax return category items
5523
- */
5524
- var ReportItemCollection = /** @class */ (function (_super) {
5525
- __extends(ReportItemCollection, _super);
5526
- function ReportItemCollection() {
5527
- 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
+ ]
5528
5770
  }
5529
- Object.defineProperty(ReportItemCollection.prototype, "salary", {
5530
- /**
5531
- * Work income
5532
- */
5533
- get: function () {
5534
- var _a;
5535
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.SALARY)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5536
- },
5537
- enumerable: false,
5538
- configurable: true
5539
- });
5540
- Object.defineProperty(ReportItemCollection.prototype, "workExpenses", {
5541
- /**
5542
- * Work expenses
5543
- */
5544
- get: function () {
5545
- var _a;
5546
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.WORK_EXPENSES)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5547
- },
5548
- enumerable: false,
5549
- configurable: true
5550
- });
5551
- Object.defineProperty(ReportItemCollection.prototype, "rentalIncome", {
5552
- /**
5553
- * Property income
5554
- */
5555
- get: function () {
5556
- var _a;
5557
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.GROSS_RENT)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5558
- },
5559
- enumerable: false,
5560
- configurable: true
5561
- });
5562
- Object.defineProperty(ReportItemCollection.prototype, "rentalDeductions", {
5563
- /**
5564
- * Property rental deductions
5565
- */
5566
- get: function () {
5567
- var _a;
5568
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.OTHER_RENTAL_DEDUCTIONS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5569
- },
5570
- enumerable: false,
5571
- configurable: true
5572
- });
5573
- Object.defineProperty(ReportItemCollection.prototype, "propertyExpenses", {
5574
- /**
5575
- * Property expenses
5576
- */
5577
- get: function () {
5578
- return this.rentalDeductions + this.borrowingExpenses;
5579
- },
5580
- enumerable: false,
5581
- configurable: true
5582
- });
5583
- Object.defineProperty(ReportItemCollection.prototype, "interestDeductions", {
5584
- /**
5585
- * Property interest
5586
- */
5587
- get: function () {
5588
- var _a;
5589
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.INTEREST_DEDUCTIONS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5590
- },
5591
- enumerable: false,
5592
- configurable: true
5593
- });
5594
- Object.defineProperty(ReportItemCollection.prototype, "capitalWorks", {
5595
- /**
5596
- * Property capital works depreciations
5597
- */
5598
- get: function () {
5599
- var _a;
5600
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.CAPITAL_WORKS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5601
- },
5602
- enumerable: false,
5603
- configurable: true
5604
- });
5605
- Object.defineProperty(ReportItemCollection.prototype, "plantEquipment", {
5606
- /**
5607
- * Property plant & equipment depreciations
5608
- */
5609
- get: function () {
5610
- var _a;
5611
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.DEPRECIATION)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5612
- },
5613
- enumerable: false,
5614
- configurable: true
5615
- });
5616
- Object.defineProperty(ReportItemCollection.prototype, "propertyDepreciations", {
5617
- /**
5618
- * Total property depreciaions
5619
- */
5620
- get: function () {
5621
- return this.capitalWorks + this.plantEquipment;
5622
- },
5623
- enumerable: false,
5624
- configurable: true
5625
- });
5626
- Object.defineProperty(ReportItemCollection.prototype, "partnershipsAndTrusts", {
5627
- get: function () {
5628
- var _a;
5629
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.PARTNERSHIPS_TRUSTS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5630
- },
5631
- enumerable: false,
5632
- configurable: true
5633
- });
5634
- Object.defineProperty(ReportItemCollection.prototype, "pciAndSbeIncome", {
5635
- get: function () {
5636
- var _a;
5637
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.PCI_SBE_INCOME)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5638
- },
5639
- enumerable: false,
5640
- configurable: true
5641
- });
5642
- Object.defineProperty(ReportItemCollection.prototype, "capitalGains", {
5643
- get: function () {
5644
- var _a;
5645
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.CAPITAL_GAINS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5646
- },
5647
- enumerable: false,
5648
- configurable: true
5649
- });
5650
- Object.defineProperty(ReportItemCollection.prototype, "foreignSourceIncome", {
5651
- get: function () {
5652
- var _a;
5653
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.FOREIGN_SOURCE_INCOME)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5654
- },
5655
- enumerable: false,
5656
- configurable: true
5657
- });
5658
- Object.defineProperty(ReportItemCollection.prototype, "otherIncome", {
5659
- /**
5660
- * Other income
5661
- */
5662
- get: function () {
5663
- var _a;
5664
- return (((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.OTHER_INCOME)) === null || _a === void 0 ? void 0 : _a.amount) || 0) +
5665
- this.partnershipsAndTrusts +
5666
- this.pciAndSbeIncome +
5667
- this.capitalGains +
5668
- this.foreignSourceIncome;
5669
- },
5670
- enumerable: false,
5671
- configurable: true
5672
- });
5673
- Object.defineProperty(ReportItemCollection.prototype, "otherDeductions", {
5674
- /**
5675
- * Other expenses
5676
- */
5677
- get: function () {
5678
- var _a;
5679
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.OTHER_DEDUCTIONS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5680
- },
5681
- enumerable: false,
5682
- configurable: true
5683
- });
5684
- Object.defineProperty(ReportItemCollection.prototype, "taxInstalments", {
5685
- get: function () {
5686
- var _a;
5687
- return ((_a = this.getTaxCreditsCollection().getByCategory(exports.TaxReturnCategoryListEnum.TAX_INSTALMENTS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5688
- },
5689
- enumerable: false,
5690
- configurable: true
5691
- });
5692
- Object.defineProperty(ReportItemCollection.prototype, "frankingCredits", {
5693
- get: function () {
5694
- var _a;
5695
- return ((_a = this.getTaxCreditsCollection().getByCategory(exports.TaxReturnCategoryListEnum.FRANKING_CREDITS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5696
- },
5697
- enumerable: false,
5698
- configurable: true
5699
- });
5700
- Object.defineProperty(ReportItemCollection.prototype, "taxOffsets", {
5701
- get: function () {
5702
- var _a;
5703
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.TAX_OFFSETS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5704
- },
5705
- enumerable: false,
5706
- configurable: true
5707
- });
5708
- Object.defineProperty(ReportItemCollection.prototype, "borrowingExpenses", {
5709
- get: function () {
5710
- var _a;
5711
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.BORROWING_EXPENSES)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5712
- },
5713
- enumerable: false,
5714
- configurable: true
5715
- });
5716
- Object.defineProperty(ReportItemCollection.prototype, "grossTaxPayable", {
5717
- get: function () {
5718
- var _a;
5719
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.GROSS_TAX_PAYABLE)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5720
- },
5721
- enumerable: false,
5722
- configurable: true
5723
- });
5724
- /**
5725
- * taxWithheld by section (work or other)
5726
- */
5727
- ReportItemCollection.prototype.getTaxWithheld = function (section) {
5728
- if (section === void 0) { section = exports.TaxReturnCategorySectionEnum.WORK_TANK; }
5729
- var _a;
5730
- 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;
5731
- };
5732
- ReportItemCollection.prototype.getTaxCreditsCollection = function () {
5733
- var _a;
5734
- return new ReportItemCollection(((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.TAX_CREDITS)) === null || _a === void 0 ? void 0 : _a.items) || []);
5735
- };
5736
- ReportItemCollection.prototype.getTotalAmountByIncomeSourceName = function (name) {
5737
- return this.items.reduce((function (sum, item) { return sum + item.getAmountByIncomeSourceName(name); }), 0);
5738
- };
5739
- ReportItemCollection.prototype.getByCategory = function (category) {
5740
- return this.items.find(function (item) { return item.taxReturnCategory.id === category; });
5741
- };
5742
- return ReportItemCollection;
5743
- }(Collection));
5771
+ };
5744
5772
 
5745
5773
  /**
5746
5774
  * Collection of tax review
@@ -6241,6 +6269,14 @@
6241
6269
  TaxCalculationTypeEnum[TaxCalculationTypeEnum["ETP_TAX_FREE"] = 9] = "ETP_TAX_FREE";
6242
6270
  })(exports.TaxCalculationTypeEnum || (exports.TaxCalculationTypeEnum = {}));
6243
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
+
6244
6280
  exports.TaxReviewStatusEnum = void 0;
6245
6281
  (function (TaxReviewStatusEnum) {
6246
6282
  TaxReviewStatusEnum[TaxReviewStatusEnum["NEW"] = 0] = "NEW";
@@ -7618,16 +7654,6 @@
7618
7654
  AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 42] = "VEHICLE_LOGBOOK_DELETED";
7619
7655
  })(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
7620
7656
 
7621
- /**
7622
- * Data table structure suitable for export
7623
- */
7624
- var ExportDataTable = /** @class */ (function () {
7625
- function ExportDataTable() {
7626
- this.footer = [];
7627
- }
7628
- return ExportDataTable;
7629
- }());
7630
-
7631
7657
  exports.ExportFormatEnum = void 0;
7632
7658
  (function (ExportFormatEnum) {
7633
7659
  ExportFormatEnum["PDF"] = "PDF";
@@ -8518,6 +8544,13 @@
8518
8544
  };
8519
8545
  return ReportItem;
8520
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);
8521
8554
 
8522
8555
  /**
8523
8556
  * Used in tax summary reports to show specific details relating to an amount in the report.
@@ -8579,7 +8612,7 @@
8579
8612
  });
8580
8613
  Object.defineProperty(TaxSummary.prototype, "taxPercent", {
8581
8614
  get: function () {
8582
- return this.summary.items.grossTaxPayable / this.summary.netAmount;
8615
+ return this.summary.items.findByCategory(exports.TaxReturnCategoryListEnum.GROSS_TAX_PAYABLE).amount / this.summary.netAmount;
8583
8616
  },
8584
8617
  enumerable: false,
8585
8618
  configurable: true
@@ -8590,7 +8623,8 @@
8590
8623
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8591
8624
  */
8592
8625
  get: function () {
8593
- 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);
8594
8628
  },
8595
8629
  enumerable: false,
8596
8630
  configurable: true
@@ -8601,7 +8635,10 @@
8601
8635
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8602
8636
  */
8603
8637
  get: function () {
8604
- 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);
8605
8642
  },
8606
8643
  enumerable: false,
8607
8644
  configurable: true
@@ -8612,7 +8649,10 @@
8612
8649
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8613
8650
  */
8614
8651
  get: function () {
8615
- 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);
8616
8656
  },
8617
8657
  enumerable: false,
8618
8658
  configurable: true
@@ -8623,7 +8663,8 @@
8623
8663
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8624
8664
  */
8625
8665
  get: function () {
8626
- 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);
8627
8668
  },
8628
8669
  enumerable: false,
8629
8670
  configurable: true
@@ -8634,7 +8675,11 @@
8634
8675
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8635
8676
  */
8636
8677
  get: function () {
8637
- 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);
8638
8683
  },
8639
8684
  enumerable: false,
8640
8685
  configurable: true
@@ -8645,7 +8690,12 @@
8645
8690
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8646
8691
  */
8647
8692
  get: function () {
8648
- 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);
8649
8699
  },
8650
8700
  enumerable: false,
8651
8701
  configurable: true
@@ -11686,43 +11736,29 @@
11686
11736
  }] }];
11687
11737
  } });
11688
11738
 
11689
- /**
11690
- * Service to handle array-like data table logic
11691
- */
11692
- var DataTableService = /** @class */ (function () {
11693
- function DataTableService(currencyPipe, datePipe) {
11739
+ var ExportFormatterService = /** @class */ (function () {
11740
+ function ExportFormatterService(currencyPipe, datePipe) {
11694
11741
  this.currencyPipe = currencyPipe;
11695
11742
  this.datePipe = datePipe;
11696
11743
  }
11697
- DataTableService.prototype.initDataTable = function (exportableModels, headerColumns) {
11698
- return classTransformer.plainToClass(ExportDataTable, {
11699
- header: headerColumns,
11700
- rows: this.getDataTableRows(exportableModels),
11701
- });
11702
- };
11703
- /**
11704
- * Get data for the exporting table rows
11705
- */
11706
- DataTableService.prototype.getDataTableRows = function (exportableModels) {
11744
+ ExportFormatterService.prototype.format = function (rows) {
11707
11745
  var _this = this;
11708
- return exportableModels.map(function (model) {
11709
- return model.toDataTableRows().map(function (row) {
11710
- switch (row.type) {
11711
- case ExportRowDataTypeEnum.DATE:
11712
- return _this.datePipe.transform(row.data, 'dd/MM/YYYY').toString();
11713
- case ExportRowDataTypeEnum.CURRENCY:
11714
- return _this.currencyPipe.transform(row.data).toString();
11715
- default:
11716
- return row.data.toString();
11717
- }
11718
- });
11719
- });
11746
+ return rows.map(function (row) { return row.map(function (column) {
11747
+ switch (column.type) {
11748
+ case ExportCellTypeEnum.DATE:
11749
+ return _this.datePipe.transform(column.value, 'dd/MM/YYYY').toString();
11750
+ case ExportCellTypeEnum.CURRENCY:
11751
+ return _this.currencyPipe.transform(column.value).toString();
11752
+ default:
11753
+ return column.value.toString();
11754
+ }
11755
+ }); });
11720
11756
  };
11721
- return DataTableService;
11757
+ return ExportFormatterService;
11722
11758
  }());
11723
- DataTableService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, deps: [{ token: i1__namespace$1.CurrencyPipe }, { token: i1__namespace$1.DatePipe }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
11724
- DataTableService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, providedIn: 'root' });
11725
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, decorators: [{
11759
+ ExportFormatterService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ExportFormatterService, deps: [{ token: i1__namespace$1.CurrencyPipe }, { token: i1__namespace$1.DatePipe }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
11760
+ ExportFormatterService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ExportFormatterService, providedIn: 'root' });
11761
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ExportFormatterService, decorators: [{
11726
11762
  type: i0.Injectable,
11727
11763
  args: [{
11728
11764
  providedIn: 'root'
@@ -12285,10 +12321,12 @@
12285
12321
  };
12286
12322
 
12287
12323
  /**
12324
+ * @TODO vik refactor
12288
12325
  * Service to work with PDF (generate, download, e.t.c.)
12289
12326
  */
12290
12327
  var PdfService = /** @class */ (function () {
12291
- function PdfService() {
12328
+ function PdfService(formatter) {
12329
+ this.formatter = formatter;
12292
12330
  }
12293
12331
  /**
12294
12332
  * Export file from provided HTML tables
@@ -12313,7 +12351,7 @@
12313
12351
  this.setDocumentTitle(pdf, title);
12314
12352
  this.setDocumentLogo(pdf);
12315
12353
  dataTables.forEach(function (dataTable) {
12316
- autoTable__default["default"](pdf, Object.assign({ head: [dataTable.header], body: dataTable.rows, foot: [dataTable.footer || []] }, _this.setTableOptions(pdf, dataTable.caption)));
12354
+ autoTable__default["default"](pdf, Object.assign({ head: [dataTable.header], body: _this.formatter.format(dataTable.body), foot: _this.formatter.format(dataTable.footer) }, _this.setTableOptions(pdf, dataTable.caption)));
12317
12355
  });
12318
12356
  return pdf;
12319
12357
  };
@@ -12370,14 +12408,14 @@
12370
12408
  };
12371
12409
  return PdfService;
12372
12410
  }());
12373
- PdfService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
12411
+ PdfService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, deps: [{ token: ExportFormatterService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
12374
12412
  PdfService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, providedIn: 'root' });
12375
12413
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, decorators: [{
12376
12414
  type: i0.Injectable,
12377
12415
  args: [{
12378
12416
  providedIn: 'root'
12379
12417
  }]
12380
- }] });
12418
+ }], ctorParameters: function () { return [{ type: ExportFormatterService }]; } });
12381
12419
 
12382
12420
  /**
12383
12421
  * Service to handle Property transactions report items data (get income / expense report items, e.t.c.)
@@ -12568,54 +12606,6 @@
12568
12606
  }]
12569
12607
  }] });
12570
12608
 
12571
- /**
12572
- * Service to work with holding costs (transactions related to vacant land property)
12573
- */
12574
- var PropertyHoldingCostsService = /** @class */ (function () {
12575
- function PropertyHoldingCostsService(pdfService, currencyPipe, datePipe) {
12576
- this.pdfService = pdfService;
12577
- this.currencyPipe = currencyPipe;
12578
- this.datePipe = datePipe;
12579
- this.url = 'transactions';
12580
- this.modelClass = Transaction;
12581
- }
12582
- PropertyHoldingCostsService.prototype.initDataTable = function (holdingCosts) {
12583
- return classTransformer.plainToClass(ExportDataTable, {
12584
- header: ['Date', 'Description', 'Debit', 'Credit'],
12585
- rows: this.getDataTableRows(holdingCosts),
12586
- footer: [
12587
- 'Total',
12588
- '',
12589
- this.currencyPipe.transform(holdingCosts.sumBy('debit')).toString(),
12590
- this.currencyPipe.transform(holdingCosts.sumBy('credit')).toString(),
12591
- ]
12592
- });
12593
- };
12594
- /**
12595
- * Get data for the exporting table rows
12596
- */
12597
- PropertyHoldingCostsService.prototype.getDataTableRows = function (holdingCosts) {
12598
- var _this = this;
12599
- return holdingCosts.items.map(function (transaction) {
12600
- return [
12601
- _this.datePipe.transform(transaction.date, 'dd/MM/YYYY').toString(),
12602
- transaction.description,
12603
- _this.currencyPipe.transform(transaction.debit).toString(),
12604
- _this.currencyPipe.transform(transaction.credit).toString()
12605
- ];
12606
- });
12607
- };
12608
- return PropertyHoldingCostsService;
12609
- }());
12610
- PropertyHoldingCostsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, deps: [{ token: PdfService }, { token: i1__namespace$1.CurrencyPipe }, { token: i1__namespace$1.DatePipe }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
12611
- PropertyHoldingCostsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, providedIn: 'root' });
12612
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, decorators: [{
12613
- type: i0.Injectable,
12614
- args: [{
12615
- providedIn: 'root'
12616
- }]
12617
- }], ctorParameters: function () { return [{ type: PdfService }, { type: i1__namespace$1.CurrencyPipe }, { type: i1__namespace$1.DatePipe }]; } });
12618
-
12619
12609
  /**
12620
12610
  * Service for work with Property Categories
12621
12611
  */
@@ -14100,10 +14090,6 @@
14100
14090
  return VehicleClaimForm;
14101
14091
  }(AbstractForm));
14102
14092
 
14103
- /**
14104
- * Public API Surface of tt-core
14105
- */
14106
-
14107
14093
  /**
14108
14094
  * Generated bundle index. Do not edit.
14109
14095
  */
@@ -14176,7 +14162,6 @@
14176
14162
  exports.DEFAULT_VEHICLE_EXPENSE = DEFAULT_VEHICLE_EXPENSE;
14177
14163
  exports.DEPRECIATION_GROUPS = DEPRECIATION_GROUPS;
14178
14164
  exports.DOCUMENT_FILE_TYPES = DOCUMENT_FILE_TYPES;
14179
- exports.DataTableService = DataTableService;
14180
14165
  exports.Depreciation = Depreciation;
14181
14166
  exports.DepreciationCapitalProject = DepreciationCapitalProject;
14182
14167
  exports.DepreciationCapitalProjectService = DepreciationCapitalProjectService;
@@ -14195,7 +14180,6 @@
14195
14180
  exports.DocumentFolder = DocumentFolder;
14196
14181
  exports.DocumentFolderService = DocumentFolderService;
14197
14182
  exports.ENDPOINTS = ENDPOINTS;
14198
- exports.EXPORT_DATA_TABLE_COLUMNS = EXPORT_DATA_TABLE_COLUMNS;
14199
14183
  exports.EmployeeCollection = EmployeeCollection;
14200
14184
  exports.EmployeeDetails = EmployeeDetails;
14201
14185
  exports.EmployeeInvite = EmployeeInvite;
@@ -14205,6 +14189,8 @@
14205
14189
  exports.EquityPositionChartService = EquityPositionChartService;
14206
14190
  exports.EventDispatcherService = EventDispatcherService;
14207
14191
  exports.ExportDataTable = ExportDataTable;
14192
+ exports.ExportFormatterService = ExportFormatterService;
14193
+ exports.ExportableCollection = ExportableCollection;
14208
14194
  exports.FinancialYear = FinancialYear;
14209
14195
  exports.Firm = Firm;
14210
14196
  exports.FirmService = FirmService;
@@ -14224,6 +14210,7 @@
14224
14210
  exports.Loan = Loan;
14225
14211
  exports.LoanCollection = LoanCollection;
14226
14212
  exports.LoanPayment = LoanPayment;
14213
+ exports.LoanPaymentCollection = LoanPaymentCollection;
14227
14214
  exports.LoanPayout = LoanPayout;
14228
14215
  exports.LoanService = LoanService;
14229
14216
  exports.LogbookPeriod = LogbookPeriod;
@@ -14257,7 +14244,6 @@
14257
14244
  exports.PropertyEquityChartData = PropertyEquityChartData;
14258
14245
  exports.PropertyEquityChartItem = PropertyEquityChartItem;
14259
14246
  exports.PropertyForecast = PropertyForecast;
14260
- exports.PropertyHoldingCostsService = PropertyHoldingCostsService;
14261
14247
  exports.PropertyReportItem = PropertyReportItem;
14262
14248
  exports.PropertyReportItemCollection = PropertyReportItemCollection;
14263
14249
  exports.PropertyReportItemDepreciationCollection = PropertyReportItemDepreciationCollection;
@@ -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;