taxtank-core 0.16.13 → 0.17.2

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 +363 -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/depreciation.collection.js +2 -2
  5. package/esm2015/lib/collections/exportable.collection.js +17 -0
  6. package/esm2015/lib/collections/loan/loan-payment.collection.js +31 -0
  7. package/esm2015/lib/collections/loan/loan.collection.js +18 -0
  8. package/esm2015/lib/collections/report/property/property-report-item-transaction.collection.js +1 -1
  9. package/esm2015/lib/collections/report/vehicle-expense/vehicle-expense.collection.js +1 -1
  10. package/esm2015/lib/collections/tax-summary/report-item.collection.js +50 -120
  11. package/esm2015/lib/collections/tax-summary/tax-return-categories.const.js +65 -0
  12. package/esm2015/lib/collections/transaction/transaction-allocation.collection.js +40 -0
  13. package/esm2015/lib/collections/transaction/transaction.collection.js +167 -0
  14. package/esm2015/lib/db/Enums/tax-return-category-list.enum.js +21 -7
  15. package/esm2015/lib/models/bank/bank-transaction.js +1 -1
  16. package/esm2015/lib/models/export/export-cell-type.enum.js +10 -0
  17. package/esm2015/lib/models/export/export-cell.js +6 -0
  18. package/esm2015/lib/models/export/export-data-table.js +1 -7
  19. package/esm2015/lib/models/income-source/income-source-chart-data.js +1 -1
  20. package/esm2015/lib/models/loan/loan-payment.js +2 -24
  21. package/esm2015/lib/models/logbook/vehicle-claim.js +1 -1
  22. package/esm2015/lib/models/property/property-equity-chart-data.js +1 -1
  23. package/esm2015/lib/models/property/property-sale/property-sale.js +10 -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 +301 -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/depreciation.collection.d.ts +1 -1
  41. package/lib/collections/exportable.collection.d.ts +9 -0
  42. package/lib/collections/loan/loan-payment.collection.d.ts +7 -0
  43. package/lib/collections/{loan.collection.d.ts → loan/loan.collection.d.ts} +2 -2
  44. package/lib/collections/report/property/property-report-item-transaction.collection.d.ts +1 -1
  45. package/lib/collections/report/vehicle-expense/vehicle-expense.collection.d.ts +1 -1
  46. package/lib/collections/tax-summary/report-item.collection.d.ts +17 -51
  47. package/lib/collections/tax-summary/tax-return-categories.const.d.ts +6 -0
  48. package/lib/collections/{transaction-allocation.collection.d.ts → transaction/transaction-allocation.collection.d.ts} +6 -6
  49. package/lib/collections/{transaction.collection.d.ts → transaction/transaction.collection.d.ts} +9 -5
  50. package/lib/db/Enums/tax-return-category-list.enum.d.ts +20 -6
  51. package/lib/models/bank/bank-transaction.d.ts +1 -1
  52. package/lib/models/export/export-cell-type.enum.d.ts +8 -0
  53. package/lib/models/export/export-cell.d.ts +8 -0
  54. package/lib/models/export/export-data-table.d.ts +3 -2
  55. package/lib/models/income-source/income-source-chart-data.d.ts +1 -1
  56. package/lib/models/loan/loan-payment.d.ts +1 -5
  57. package/lib/models/logbook/vehicle-claim.d.ts +1 -1
  58. package/lib/models/property/property-equity-chart-data.d.ts +1 -1
  59. package/lib/models/property/property-sale/property-sale.d.ts +3 -0
  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
@@ -1876,6 +1876,50 @@
1876
1876
  TankTypeEnum[TankTypeEnum["SOLE"] = 4] = "SOLE";
1877
1877
  })(exports.TankTypeEnum || (exports.TankTypeEnum = {}));
1878
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
+
1879
1923
  /**
1880
1924
  * Collection of transactions
1881
1925
  */
@@ -2047,8 +2091,29 @@
2047
2091
  }
2048
2092
  }));
2049
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
+ };
2050
2115
  return TransactionCollection;
2051
- }(Collection));
2116
+ }(ExportableCollection));
2052
2117
 
2053
2118
  var DepreciationCollection = /** @class */ (function (_super) {
2054
2119
  __extends(DepreciationCollection, _super);
@@ -2259,6 +2324,38 @@
2259
2324
  return LoanCollection;
2260
2325
  }(Collection));
2261
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
+
2262
2359
  var MessageCollection = /** @class */ (function (_super) {
2263
2360
  __extends(MessageCollection, _super);
2264
2361
  function MessageCollection() {
@@ -4584,34 +4681,6 @@
4584
4681
  LoanVehicleTypeEnum[LoanVehicleTypeEnum["COMMERCIAL_HIRE_PURCHASE"] = 10] = "COMMERCIAL_HIRE_PURCHASE";
4585
4682
  })(exports.LoanVehicleTypeEnum || (exports.LoanVehicleTypeEnum = {}));
4586
4683
 
4587
- /**
4588
- * Class with structure of the data-table rows
4589
- */
4590
- var ExportRow = /** @class */ (function () {
4591
- function ExportRow() {
4592
- }
4593
- return ExportRow;
4594
- }());
4595
-
4596
- /**
4597
- * Enum which shows what type (in terms of business logic) of the data-table row item
4598
- */
4599
- var ExportRowDataTypeEnum;
4600
- (function (ExportRowDataTypeEnum) {
4601
- ExportRowDataTypeEnum[ExportRowDataTypeEnum["STRING"] = 0] = "STRING";
4602
- ExportRowDataTypeEnum[ExportRowDataTypeEnum["CURRENCY"] = 1] = "CURRENCY";
4603
- ExportRowDataTypeEnum[ExportRowDataTypeEnum["DATE"] = 2] = "DATE";
4604
- })(ExportRowDataTypeEnum || (ExportRowDataTypeEnum = {}));
4605
-
4606
- var EXPORT_DATA_TABLE_COLUMNS = [
4607
- 'Pmt No.',
4608
- 'Date',
4609
- 'Payment Due',
4610
- 'Interest Accrued',
4611
- 'Principal Paid',
4612
- 'Principal Balance',
4613
- 'Payout'
4614
- ];
4615
4684
  // @Todo no base model from backend list
4616
4685
  /**
4617
4686
  * Loan payment class
@@ -4619,17 +4688,6 @@
4619
4688
  var LoanPayment = /** @class */ (function () {
4620
4689
  function LoanPayment() {
4621
4690
  }
4622
- LoanPayment.prototype.toDataTableRows = function () {
4623
- return [
4624
- classTransformer.plainToClass(ExportRow, { data: this.number, type: ExportRowDataTypeEnum.STRING }),
4625
- classTransformer.plainToClass(ExportRow, { data: this.date, type: ExportRowDataTypeEnum.DATE }),
4626
- classTransformer.plainToClass(ExportRow, { data: this.paymentDue, type: ExportRowDataTypeEnum.CURRENCY }),
4627
- classTransformer.plainToClass(ExportRow, { data: this.interestAccrued, type: ExportRowDataTypeEnum.CURRENCY }),
4628
- classTransformer.plainToClass(ExportRow, { data: this.principalPaid, type: ExportRowDataTypeEnum.CURRENCY }),
4629
- classTransformer.plainToClass(ExportRow, { data: this.principalBalance, type: ExportRowDataTypeEnum.CURRENCY }),
4630
- classTransformer.plainToClass(ExportRow, { data: this.payout, type: ExportRowDataTypeEnum.CURRENCY }),
4631
- ];
4632
- };
4633
4691
  return LoanPayment;
4634
4692
  }());
4635
4693
  __decorate([
@@ -5498,265 +5556,219 @@
5498
5556
  return ServiceSubscriptionCollection;
5499
5557
  }(Collection));
5500
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
+
5501
5667
  exports.TaxReturnCategoryListEnum = void 0;
5502
5668
  (function (TaxReturnCategoryListEnum) {
5503
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";
5504
5678
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["WORK_EXPENSES"] = 7] = "WORK_EXPENSES";
5505
5679
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["GROSS_RENT"] = 8] = "GROSS_RENT";
5680
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_RENTAL_DEDUCTIONS"] = 12] = "OTHER_RENTAL_DEDUCTIONS";
5506
5681
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["INTEREST_DEDUCTIONS"] = 9] = "INTEREST_DEDUCTIONS";
5507
5682
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["CAPITAL_WORKS"] = 10] = "CAPITAL_WORKS";
5508
5683
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["DEPRECIATION"] = 11] = "DEPRECIATION";
5509
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_RENTAL_DEDUCTIONS"] = 12] = "OTHER_RENTAL_DEDUCTIONS";
5510
- 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";
5511
5687
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["PARTNERSHIPS_TRUSTS"] = 13] = "PARTNERSHIPS_TRUSTS";
5512
- 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";
5513
5690
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["CAPITAL_GAINS"] = 15] = "CAPITAL_GAINS";
5514
5691
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["FOREIGN_SOURCE_INCOME"] = 16] = "FOREIGN_SOURCE_INCOME";
5515
- 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";
5516
5696
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["OTHER_DEDUCTIONS"] = 18] = "OTHER_DEDUCTIONS";
5697
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_OFFSETS"] = 27] = "TAX_OFFSETS";
5698
+ TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["BORROWING_EXPENSES"] = 29] = "BORROWING_EXPENSES";
5517
5699
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["GROSS_TAX_PAYABLE"] = 19] = "GROSS_TAX_PAYABLE";
5518
5700
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_ON_TAXABLE_INCOME"] = 20] = "TAX_ON_TAXABLE_INCOME";
5519
5701
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["MEDICARE"] = 21] = "MEDICARE";
5520
5702
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["STUDENT_LOAN_REPAYMENT"] = 22] = "STUDENT_LOAN_REPAYMENT";
5521
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_CREDITS"] = 23] = "TAX_CREDITS";
5522
5703
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_WITHHELD"] = 24] = "TAX_WITHHELD";
5523
5704
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_INSTALMENTS"] = 25] = "TAX_INSTALMENTS";
5524
5705
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["FRANKING_CREDITS"] = 26] = "FRANKING_CREDITS";
5525
- TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_OFFSETS"] = 27] = "TAX_OFFSETS";
5526
5706
  TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_PAYABLE"] = 28] = "TAX_PAYABLE";
5527
5707
  })(exports.TaxReturnCategoryListEnum || (exports.TaxReturnCategoryListEnum = {}));
5528
5708
 
5529
- exports.TaxReturnCategorySectionEnum = void 0;
5530
- (function (TaxReturnCategorySectionEnum) {
5531
- TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["WORK_TANK"] = 1] = "WORK_TANK";
5532
- TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["PROPERTY_TANK"] = 2] = "PROPERTY_TANK";
5533
- TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["OTHER_INCOME"] = 3] = "OTHER_INCOME";
5534
- TaxReturnCategorySectionEnum[TaxReturnCategorySectionEnum["SUMMARY"] = 4] = "SUMMARY";
5535
- })(exports.TaxReturnCategorySectionEnum || (exports.TaxReturnCategorySectionEnum = {}));
5536
-
5537
- /**
5538
- * collection for tax return category items
5539
- */
5540
- var ReportItemCollection = /** @class */ (function (_super) {
5541
- __extends(ReportItemCollection, _super);
5542
- function ReportItemCollection() {
5543
- 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
+ ]
5544
5770
  }
5545
- Object.defineProperty(ReportItemCollection.prototype, "salary", {
5546
- /**
5547
- * Work income
5548
- */
5549
- get: function () {
5550
- var _a;
5551
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.SALARY)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5552
- },
5553
- enumerable: false,
5554
- configurable: true
5555
- });
5556
- Object.defineProperty(ReportItemCollection.prototype, "workExpenses", {
5557
- /**
5558
- * Work expenses
5559
- */
5560
- get: function () {
5561
- var _a;
5562
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.WORK_EXPENSES)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5563
- },
5564
- enumerable: false,
5565
- configurable: true
5566
- });
5567
- Object.defineProperty(ReportItemCollection.prototype, "rentalIncome", {
5568
- /**
5569
- * Property income
5570
- */
5571
- get: function () {
5572
- var _a;
5573
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.GROSS_RENT)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5574
- },
5575
- enumerable: false,
5576
- configurable: true
5577
- });
5578
- Object.defineProperty(ReportItemCollection.prototype, "rentalDeductions", {
5579
- /**
5580
- * Property rental deductions
5581
- */
5582
- get: function () {
5583
- var _a;
5584
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.OTHER_RENTAL_DEDUCTIONS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5585
- },
5586
- enumerable: false,
5587
- configurable: true
5588
- });
5589
- Object.defineProperty(ReportItemCollection.prototype, "propertyExpenses", {
5590
- /**
5591
- * Property expenses
5592
- */
5593
- get: function () {
5594
- return this.rentalDeductions + this.borrowingExpenses;
5595
- },
5596
- enumerable: false,
5597
- configurable: true
5598
- });
5599
- Object.defineProperty(ReportItemCollection.prototype, "interestDeductions", {
5600
- /**
5601
- * Property interest
5602
- */
5603
- get: function () {
5604
- var _a;
5605
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.INTEREST_DEDUCTIONS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5606
- },
5607
- enumerable: false,
5608
- configurable: true
5609
- });
5610
- Object.defineProperty(ReportItemCollection.prototype, "capitalWorks", {
5611
- /**
5612
- * Property capital works depreciations
5613
- */
5614
- get: function () {
5615
- var _a;
5616
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.CAPITAL_WORKS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5617
- },
5618
- enumerable: false,
5619
- configurable: true
5620
- });
5621
- Object.defineProperty(ReportItemCollection.prototype, "plantEquipment", {
5622
- /**
5623
- * Property plant & equipment depreciations
5624
- */
5625
- get: function () {
5626
- var _a;
5627
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.DEPRECIATION)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5628
- },
5629
- enumerable: false,
5630
- configurable: true
5631
- });
5632
- Object.defineProperty(ReportItemCollection.prototype, "propertyDepreciations", {
5633
- /**
5634
- * Total property depreciaions
5635
- */
5636
- get: function () {
5637
- return this.capitalWorks + this.plantEquipment;
5638
- },
5639
- enumerable: false,
5640
- configurable: true
5641
- });
5642
- Object.defineProperty(ReportItemCollection.prototype, "partnershipsAndTrusts", {
5643
- get: function () {
5644
- var _a;
5645
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.PARTNERSHIPS_TRUSTS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5646
- },
5647
- enumerable: false,
5648
- configurable: true
5649
- });
5650
- Object.defineProperty(ReportItemCollection.prototype, "pciAndSbeIncome", {
5651
- get: function () {
5652
- var _a;
5653
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.PCI_SBE_INCOME)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5654
- },
5655
- enumerable: false,
5656
- configurable: true
5657
- });
5658
- Object.defineProperty(ReportItemCollection.prototype, "capitalGains", {
5659
- get: function () {
5660
- var _a;
5661
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.CAPITAL_GAINS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5662
- },
5663
- enumerable: false,
5664
- configurable: true
5665
- });
5666
- Object.defineProperty(ReportItemCollection.prototype, "foreignSourceIncome", {
5667
- get: function () {
5668
- var _a;
5669
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.FOREIGN_SOURCE_INCOME)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5670
- },
5671
- enumerable: false,
5672
- configurable: true
5673
- });
5674
- Object.defineProperty(ReportItemCollection.prototype, "otherIncome", {
5675
- /**
5676
- * Other income
5677
- */
5678
- get: function () {
5679
- var _a;
5680
- return (((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.OTHER_INCOME)) === null || _a === void 0 ? void 0 : _a.amount) || 0) +
5681
- this.partnershipsAndTrusts +
5682
- this.pciAndSbeIncome +
5683
- this.capitalGains +
5684
- this.foreignSourceIncome;
5685
- },
5686
- enumerable: false,
5687
- configurable: true
5688
- });
5689
- Object.defineProperty(ReportItemCollection.prototype, "otherDeductions", {
5690
- /**
5691
- * Other expenses
5692
- */
5693
- get: function () {
5694
- var _a;
5695
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.OTHER_DEDUCTIONS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5696
- },
5697
- enumerable: false,
5698
- configurable: true
5699
- });
5700
- Object.defineProperty(ReportItemCollection.prototype, "taxInstalments", {
5701
- get: function () {
5702
- var _a;
5703
- return ((_a = this.getTaxCreditsCollection().getByCategory(exports.TaxReturnCategoryListEnum.TAX_INSTALMENTS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5704
- },
5705
- enumerable: false,
5706
- configurable: true
5707
- });
5708
- Object.defineProperty(ReportItemCollection.prototype, "frankingCredits", {
5709
- get: function () {
5710
- var _a;
5711
- return ((_a = this.getTaxCreditsCollection().getByCategory(exports.TaxReturnCategoryListEnum.FRANKING_CREDITS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5712
- },
5713
- enumerable: false,
5714
- configurable: true
5715
- });
5716
- Object.defineProperty(ReportItemCollection.prototype, "taxOffsets", {
5717
- get: function () {
5718
- var _a;
5719
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.TAX_OFFSETS)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5720
- },
5721
- enumerable: false,
5722
- configurable: true
5723
- });
5724
- Object.defineProperty(ReportItemCollection.prototype, "borrowingExpenses", {
5725
- get: function () {
5726
- var _a;
5727
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.BORROWING_EXPENSES)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5728
- },
5729
- enumerable: false,
5730
- configurable: true
5731
- });
5732
- Object.defineProperty(ReportItemCollection.prototype, "grossTaxPayable", {
5733
- get: function () {
5734
- var _a;
5735
- return ((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.GROSS_TAX_PAYABLE)) === null || _a === void 0 ? void 0 : _a.amount) || 0;
5736
- },
5737
- enumerable: false,
5738
- configurable: true
5739
- });
5740
- /**
5741
- * taxWithheld by section (work or other)
5742
- */
5743
- ReportItemCollection.prototype.getTaxWithheld = function (section) {
5744
- if (section === void 0) { section = exports.TaxReturnCategorySectionEnum.WORK_TANK; }
5745
- var _a;
5746
- 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;
5747
- };
5748
- ReportItemCollection.prototype.getTaxCreditsCollection = function () {
5749
- var _a;
5750
- return new ReportItemCollection(((_a = this.getByCategory(exports.TaxReturnCategoryListEnum.TAX_CREDITS)) === null || _a === void 0 ? void 0 : _a.items) || []);
5751
- };
5752
- ReportItemCollection.prototype.getTotalAmountByIncomeSourceName = function (name) {
5753
- return this.items.reduce((function (sum, item) { return sum + item.getAmountByIncomeSourceName(name); }), 0);
5754
- };
5755
- ReportItemCollection.prototype.getByCategory = function (category) {
5756
- return this.items.find(function (item) { return item.taxReturnCategory.id === category; });
5757
- };
5758
- return ReportItemCollection;
5759
- }(Collection));
5771
+ };
5760
5772
 
5761
5773
  /**
5762
5774
  * Collection of tax review
@@ -6257,6 +6269,14 @@
6257
6269
  TaxCalculationTypeEnum[TaxCalculationTypeEnum["ETP_TAX_FREE"] = 9] = "ETP_TAX_FREE";
6258
6270
  })(exports.TaxCalculationTypeEnum || (exports.TaxCalculationTypeEnum = {}));
6259
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
+
6260
6280
  exports.TaxReviewStatusEnum = void 0;
6261
6281
  (function (TaxReviewStatusEnum) {
6262
6282
  TaxReviewStatusEnum[TaxReviewStatusEnum["NEW"] = 0] = "NEW";
@@ -7634,16 +7654,6 @@
7634
7654
  AppEventTypeEnum[AppEventTypeEnum["VEHICLE_LOGBOOK_DELETED"] = 42] = "VEHICLE_LOGBOOK_DELETED";
7635
7655
  })(exports.AppEventTypeEnum || (exports.AppEventTypeEnum = {}));
7636
7656
 
7637
- /**
7638
- * Data table structure suitable for export
7639
- */
7640
- var ExportDataTable = /** @class */ (function () {
7641
- function ExportDataTable() {
7642
- this.footer = [];
7643
- }
7644
- return ExportDataTable;
7645
- }());
7646
-
7647
7657
  exports.ExportFormatEnum = void 0;
7648
7658
  (function (ExportFormatEnum) {
7649
7659
  ExportFormatEnum["PDF"] = "PDF";
@@ -8342,6 +8352,15 @@
8342
8352
  });
8343
8353
  return PropertySale;
8344
8354
  }(PropertySale$1));
8355
+ __decorate([
8356
+ classTransformer.Type(function () { return Number; })
8357
+ ], PropertySale.prototype, "commission", void 0);
8358
+ __decorate([
8359
+ classTransformer.Type(function () { return Number; })
8360
+ ], PropertySale.prototype, "legalFees", void 0);
8361
+ __decorate([
8362
+ classTransformer.Type(function () { return Number; })
8363
+ ], PropertySale.prototype, "otherCost", void 0);
8345
8364
  __decorate([
8346
8365
  classTransformer.Type(function () { return Date; })
8347
8366
  ], PropertySale.prototype, "settlementDate", void 0);
@@ -8534,6 +8553,13 @@
8534
8553
  };
8535
8554
  return ReportItem;
8536
8555
  }());
8556
+ __decorate([
8557
+ classTransformer.Type(function () { return ReportItem; }),
8558
+ classTransformer.Transform(function (_b) {
8559
+ var value = _b.value;
8560
+ return new ReportItemCollection(value);
8561
+ })
8562
+ ], ReportItem.prototype, "items", void 0);
8537
8563
 
8538
8564
  /**
8539
8565
  * Used in tax summary reports to show specific details relating to an amount in the report.
@@ -8595,7 +8621,7 @@
8595
8621
  });
8596
8622
  Object.defineProperty(TaxSummary.prototype, "taxPercent", {
8597
8623
  get: function () {
8598
- return this.summary.items.grossTaxPayable / this.summary.netAmount;
8624
+ return this.summary.items.findByCategory(exports.TaxReturnCategoryListEnum.GROSS_TAX_PAYABLE).amount / this.summary.netAmount;
8599
8625
  },
8600
8626
  enumerable: false,
8601
8627
  configurable: true
@@ -8606,7 +8632,8 @@
8606
8632
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8607
8633
  */
8608
8634
  get: function () {
8609
- return this.workNetTotal - Math.abs(this.summary.items.getTaxWithheld(exports.TaxReturnCategorySectionEnum.WORK_TANK));
8635
+ var taxWithheld = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.work.taxWithheld, exports.TaxSummarySectionEnum.WORK_TANK);
8636
+ return this.workNetTotal - Math.abs(taxWithheld);
8610
8637
  },
8611
8638
  enumerable: false,
8612
8639
  configurable: true
@@ -8617,7 +8644,10 @@
8617
8644
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8618
8645
  */
8619
8646
  get: function () {
8620
- return this.work.items.salary - Math.abs(this.work.items.workExpenses);
8647
+ var income = this.work.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.work.income, exports.TaxSummarySectionEnum.WORK_TANK);
8648
+ var expenses = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.work.expenses, exports.TaxSummarySectionEnum.WORK_TANK);
8649
+ var interest = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.work.interest, exports.TaxSummarySectionEnum.WORK_TANK);
8650
+ return income - Math.abs(expenses) - Math.abs(interest);
8621
8651
  },
8622
8652
  enumerable: false,
8623
8653
  configurable: true
@@ -8628,7 +8658,10 @@
8628
8658
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8629
8659
  */
8630
8660
  get: function () {
8631
- return this.property.items.rentalIncome - Math.abs(this.property.items.rentalDeductions) - Math.abs(this.property.items.interestDeductions);
8661
+ var income = this.property.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.property.income, exports.TaxSummarySectionEnum.PROPERTY_TANK);
8662
+ var expenses = this.property.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.property.expenses, exports.TaxSummarySectionEnum.PROPERTY_TANK);
8663
+ var interest = this.property.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.property.interest, exports.TaxSummarySectionEnum.PROPERTY_TANK);
8664
+ return income - Math.abs(expenses) - Math.abs(interest);
8632
8665
  },
8633
8666
  enumerable: false,
8634
8667
  configurable: true
@@ -8639,7 +8672,8 @@
8639
8672
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8640
8673
  */
8641
8674
  get: function () {
8642
- return this.propertyNetCash - Math.abs(this.property.items.propertyDepreciations);
8675
+ var depreciation = this.property.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.property.depreciation, exports.TaxSummarySectionEnum.PROPERTY_TANK);
8676
+ return this.propertyNetCash - Math.abs(depreciation);
8643
8677
  },
8644
8678
  enumerable: false,
8645
8679
  configurable: true
@@ -8650,7 +8684,11 @@
8650
8684
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8651
8685
  */
8652
8686
  get: function () {
8653
- 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);
8687
+ var income = this.otherIncome.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.other.income, exports.TaxSummarySectionEnum.OTHER_INCOME);
8688
+ var expenses = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.other.expenses, exports.TaxSummarySectionEnum.OTHER_INCOME);
8689
+ var taxWithheld = this.summary.items.sumByCategoriesAndSection([exports.TaxReturnCategoryListEnum.TAX_WITHHELD], exports.TaxSummarySectionEnum.OTHER_INCOME);
8690
+ var taxInstalments = this.summary.items.sumByCategoriesAndSection([exports.TaxReturnCategoryListEnum.TAX_INSTALMENTS], exports.TaxSummarySectionEnum.OTHER_INCOME);
8691
+ return income - Math.abs(expenses) - Math.abs(taxWithheld) - Math.abs(taxInstalments);
8654
8692
  },
8655
8693
  enumerable: false,
8656
8694
  configurable: true
@@ -8661,7 +8699,12 @@
8661
8699
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
8662
8700
  */
8663
8701
  get: function () {
8664
- 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);
8702
+ var income = this.otherIncome.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.other.income, exports.TaxSummarySectionEnum.OTHER_INCOME);
8703
+ var expenses = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.other.expenses, exports.TaxSummarySectionEnum.OTHER_INCOME);
8704
+ var taxOffsets = this.summary.items.sumByCategoriesAndSection([exports.TaxReturnCategoryListEnum.TAX_OFFSETS], exports.TaxSummarySectionEnum.SUMMARY);
8705
+ var taxInstallments = this.summary.items.sumByCategoriesAndSection([exports.TaxReturnCategoryListEnum.TAX_INSTALMENTS], exports.TaxSummarySectionEnum.OTHER_INCOME);
8706
+ var frankingCredits = this.summary.items.sumByCategoriesAndSection([exports.TaxReturnCategoryListEnum.FRANKING_CREDITS], exports.TaxSummarySectionEnum.OTHER_INCOME);
8707
+ return income - Math.abs(expenses) + Math.abs(taxOffsets) + Math.abs(taxInstallments) + Math.abs(frankingCredits);
8665
8708
  },
8666
8709
  enumerable: false,
8667
8710
  configurable: true
@@ -11702,43 +11745,29 @@
11702
11745
  }] }];
11703
11746
  } });
11704
11747
 
11705
- /**
11706
- * Service to handle array-like data table logic
11707
- */
11708
- var DataTableService = /** @class */ (function () {
11709
- function DataTableService(currencyPipe, datePipe) {
11748
+ var ExportFormatterService = /** @class */ (function () {
11749
+ function ExportFormatterService(currencyPipe, datePipe) {
11710
11750
  this.currencyPipe = currencyPipe;
11711
11751
  this.datePipe = datePipe;
11712
11752
  }
11713
- DataTableService.prototype.initDataTable = function (exportableModels, headerColumns) {
11714
- return classTransformer.plainToClass(ExportDataTable, {
11715
- header: headerColumns,
11716
- rows: this.getDataTableRows(exportableModels),
11717
- });
11718
- };
11719
- /**
11720
- * Get data for the exporting table rows
11721
- */
11722
- DataTableService.prototype.getDataTableRows = function (exportableModels) {
11753
+ ExportFormatterService.prototype.format = function (rows) {
11723
11754
  var _this = this;
11724
- return exportableModels.map(function (model) {
11725
- return model.toDataTableRows().map(function (row) {
11726
- switch (row.type) {
11727
- case ExportRowDataTypeEnum.DATE:
11728
- return _this.datePipe.transform(row.data, 'dd/MM/YYYY').toString();
11729
- case ExportRowDataTypeEnum.CURRENCY:
11730
- return _this.currencyPipe.transform(row.data).toString();
11731
- default:
11732
- return row.data.toString();
11733
- }
11734
- });
11735
- });
11755
+ return rows.map(function (row) { return row.map(function (column) {
11756
+ switch (column.type) {
11757
+ case ExportCellTypeEnum.DATE:
11758
+ return _this.datePipe.transform(column.value, 'dd/MM/YYYY').toString();
11759
+ case ExportCellTypeEnum.CURRENCY:
11760
+ return _this.currencyPipe.transform(column.value).toString();
11761
+ default:
11762
+ return column.value.toString();
11763
+ }
11764
+ }); });
11736
11765
  };
11737
- return DataTableService;
11766
+ return ExportFormatterService;
11738
11767
  }());
11739
- 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 });
11740
- DataTableService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, providedIn: 'root' });
11741
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DataTableService, decorators: [{
11768
+ 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 });
11769
+ ExportFormatterService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ExportFormatterService, providedIn: 'root' });
11770
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ExportFormatterService, decorators: [{
11742
11771
  type: i0.Injectable,
11743
11772
  args: [{
11744
11773
  providedIn: 'root'
@@ -12301,10 +12330,12 @@
12301
12330
  };
12302
12331
 
12303
12332
  /**
12333
+ * @TODO vik refactor
12304
12334
  * Service to work with PDF (generate, download, e.t.c.)
12305
12335
  */
12306
12336
  var PdfService = /** @class */ (function () {
12307
- function PdfService() {
12337
+ function PdfService(formatter) {
12338
+ this.formatter = formatter;
12308
12339
  }
12309
12340
  /**
12310
12341
  * Export file from provided HTML tables
@@ -12329,7 +12360,7 @@
12329
12360
  this.setDocumentTitle(pdf, title);
12330
12361
  this.setDocumentLogo(pdf);
12331
12362
  dataTables.forEach(function (dataTable) {
12332
- autoTable__default["default"](pdf, Object.assign({ head: [dataTable.header], body: dataTable.rows, foot: [dataTable.footer || []] }, _this.setTableOptions(pdf, dataTable.caption)));
12363
+ 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)));
12333
12364
  });
12334
12365
  return pdf;
12335
12366
  };
@@ -12386,14 +12417,14 @@
12386
12417
  };
12387
12418
  return PdfService;
12388
12419
  }());
12389
- PdfService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
12420
+ 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 });
12390
12421
  PdfService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, providedIn: 'root' });
12391
12422
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PdfService, decorators: [{
12392
12423
  type: i0.Injectable,
12393
12424
  args: [{
12394
12425
  providedIn: 'root'
12395
12426
  }]
12396
- }] });
12427
+ }], ctorParameters: function () { return [{ type: ExportFormatterService }]; } });
12397
12428
 
12398
12429
  /**
12399
12430
  * Service to handle Property transactions report items data (get income / expense report items, e.t.c.)
@@ -12584,54 +12615,6 @@
12584
12615
  }]
12585
12616
  }] });
12586
12617
 
12587
- /**
12588
- * Service to work with holding costs (transactions related to vacant land property)
12589
- */
12590
- var PropertyHoldingCostsService = /** @class */ (function () {
12591
- function PropertyHoldingCostsService(pdfService, currencyPipe, datePipe) {
12592
- this.pdfService = pdfService;
12593
- this.currencyPipe = currencyPipe;
12594
- this.datePipe = datePipe;
12595
- this.url = 'transactions';
12596
- this.modelClass = Transaction;
12597
- }
12598
- PropertyHoldingCostsService.prototype.initDataTable = function (holdingCosts) {
12599
- return classTransformer.plainToClass(ExportDataTable, {
12600
- header: ['Date', 'Description', 'Debit', 'Credit'],
12601
- rows: this.getDataTableRows(holdingCosts),
12602
- footer: [
12603
- 'Total',
12604
- '',
12605
- this.currencyPipe.transform(holdingCosts.sumBy('debit')).toString(),
12606
- this.currencyPipe.transform(holdingCosts.sumBy('credit')).toString(),
12607
- ]
12608
- });
12609
- };
12610
- /**
12611
- * Get data for the exporting table rows
12612
- */
12613
- PropertyHoldingCostsService.prototype.getDataTableRows = function (holdingCosts) {
12614
- var _this = this;
12615
- return holdingCosts.items.map(function (transaction) {
12616
- return [
12617
- _this.datePipe.transform(transaction.date, 'dd/MM/YYYY').toString(),
12618
- transaction.description,
12619
- _this.currencyPipe.transform(transaction.debit).toString(),
12620
- _this.currencyPipe.transform(transaction.credit).toString()
12621
- ];
12622
- });
12623
- };
12624
- return PropertyHoldingCostsService;
12625
- }());
12626
- 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 });
12627
- PropertyHoldingCostsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, providedIn: 'root' });
12628
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PropertyHoldingCostsService, decorators: [{
12629
- type: i0.Injectable,
12630
- args: [{
12631
- providedIn: 'root'
12632
- }]
12633
- }], ctorParameters: function () { return [{ type: PdfService }, { type: i1__namespace$1.CurrencyPipe }, { type: i1__namespace$1.DatePipe }]; } });
12634
-
12635
12618
  /**
12636
12619
  * Service for work with Property Categories
12637
12620
  */
@@ -14116,10 +14099,6 @@
14116
14099
  return VehicleClaimForm;
14117
14100
  }(AbstractForm));
14118
14101
 
14119
- /**
14120
- * Public API Surface of tt-core
14121
- */
14122
-
14123
14102
  /**
14124
14103
  * Generated bundle index. Do not edit.
14125
14104
  */
@@ -14192,7 +14171,6 @@
14192
14171
  exports.DEFAULT_VEHICLE_EXPENSE = DEFAULT_VEHICLE_EXPENSE;
14193
14172
  exports.DEPRECIATION_GROUPS = DEPRECIATION_GROUPS;
14194
14173
  exports.DOCUMENT_FILE_TYPES = DOCUMENT_FILE_TYPES;
14195
- exports.DataTableService = DataTableService;
14196
14174
  exports.Depreciation = Depreciation;
14197
14175
  exports.DepreciationCapitalProject = DepreciationCapitalProject;
14198
14176
  exports.DepreciationCapitalProjectService = DepreciationCapitalProjectService;
@@ -14211,7 +14189,6 @@
14211
14189
  exports.DocumentFolder = DocumentFolder;
14212
14190
  exports.DocumentFolderService = DocumentFolderService;
14213
14191
  exports.ENDPOINTS = ENDPOINTS;
14214
- exports.EXPORT_DATA_TABLE_COLUMNS = EXPORT_DATA_TABLE_COLUMNS;
14215
14192
  exports.EmployeeCollection = EmployeeCollection;
14216
14193
  exports.EmployeeDetails = EmployeeDetails;
14217
14194
  exports.EmployeeInvite = EmployeeInvite;
@@ -14221,6 +14198,8 @@
14221
14198
  exports.EquityPositionChartService = EquityPositionChartService;
14222
14199
  exports.EventDispatcherService = EventDispatcherService;
14223
14200
  exports.ExportDataTable = ExportDataTable;
14201
+ exports.ExportFormatterService = ExportFormatterService;
14202
+ exports.ExportableCollection = ExportableCollection;
14224
14203
  exports.FinancialYear = FinancialYear;
14225
14204
  exports.Firm = Firm;
14226
14205
  exports.FirmService = FirmService;
@@ -14240,6 +14219,7 @@
14240
14219
  exports.Loan = Loan;
14241
14220
  exports.LoanCollection = LoanCollection;
14242
14221
  exports.LoanPayment = LoanPayment;
14222
+ exports.LoanPaymentCollection = LoanPaymentCollection;
14243
14223
  exports.LoanPayout = LoanPayout;
14244
14224
  exports.LoanService = LoanService;
14245
14225
  exports.LogbookPeriod = LogbookPeriod;
@@ -14273,7 +14253,6 @@
14273
14253
  exports.PropertyEquityChartData = PropertyEquityChartData;
14274
14254
  exports.PropertyEquityChartItem = PropertyEquityChartItem;
14275
14255
  exports.PropertyForecast = PropertyForecast;
14276
- exports.PropertyHoldingCostsService = PropertyHoldingCostsService;
14277
14256
  exports.PropertyReportItem = PropertyReportItem;
14278
14257
  exports.PropertyReportItemCollection = PropertyReportItemCollection;
14279
14258
  exports.PropertyReportItemDepreciationCollection = PropertyReportItemDepreciationCollection;
@@ -14311,6 +14290,7 @@
14311
14290
  exports.SoleForecastService = SoleForecastService;
14312
14291
  exports.SseService = SseService;
14313
14292
  exports.SubscriptionService = SubscriptionService;
14293
+ exports.TAX_RETURN_CATEGORIES = TAX_RETURN_CATEGORIES;
14314
14294
  exports.TYPE_LOAN = TYPE_LOAN;
14315
14295
  exports.TaxExemption = TaxExemption;
14316
14296
  exports.TaxExemptionMetadata = TaxExemptionMetadata;