taxtank-core 0.10.4 → 0.10.7

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 (31) hide show
  1. package/bundles/taxtank-core.umd.js +247 -139
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/collection.js +8 -1
  4. package/esm2015/lib/collections/report/property/property-report-item-depreciation.collection.js +12 -9
  5. package/esm2015/lib/collections/report/property/property-report-item-transaction.collection.js +12 -9
  6. package/esm2015/lib/collections/report/property/property-report-item.collection.js +13 -0
  7. package/esm2015/lib/db/Enums/property/property-category-list.enum.js +2 -1
  8. package/esm2015/lib/models/export/export-data-table.js +6 -0
  9. package/esm2015/lib/models/report/property/property-report-item-depreciation.js +10 -4
  10. package/esm2015/lib/models/report/property/property-report-item-transaction.js +2 -2
  11. package/esm2015/lib/models/report/property/property-report-item.js +10 -1
  12. package/esm2015/lib/services/http/transaction/transaction.service.js +11 -1
  13. package/esm2015/lib/services/pdf/pdf.service.js +47 -22
  14. package/esm2015/lib/services/property/property-holding-costs/property-holding-costs.service.js +53 -0
  15. package/esm2015/lib/services/report/property/property-transaction-report.service.js +14 -50
  16. package/esm2015/public-api.js +5 -1
  17. package/fesm2015/taxtank-core.js +221 -131
  18. package/fesm2015/taxtank-core.js.map +1 -1
  19. package/lib/collections/collection.d.ts +4 -0
  20. package/lib/collections/report/property/property-report-item-depreciation.collection.d.ts +4 -4
  21. package/lib/collections/report/property/property-report-item-transaction.collection.d.ts +4 -4
  22. package/lib/collections/report/property/property-report-item.collection.d.ts +9 -0
  23. package/lib/db/Enums/property/property-category-list.enum.d.ts +2 -1
  24. package/lib/models/export/export-data-table.d.ts +9 -0
  25. package/lib/models/report/property/property-report-item.d.ts +4 -0
  26. package/lib/services/http/transaction/transaction.service.d.ts +4 -0
  27. package/lib/services/pdf/pdf.service.d.ts +14 -1
  28. package/lib/services/property/property-holding-costs/property-holding-costs.service.d.ts +24 -0
  29. package/lib/services/report/property/property-transaction-report.service.d.ts +5 -12
  30. package/package.json +1 -1
  31. package/public-api.d.ts +4 -0
@@ -1,5 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, Inject, NgModule, EventEmitter } from '@angular/core';
3
+ import * as i2 from '@angular/common';
3
4
  import { CommonModule } from '@angular/common';
4
5
  import * as i1 from '@angular/common/http';
5
6
  import { HttpParams, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
@@ -821,6 +822,47 @@ class CollectionDictionary {
821
822
  }
822
823
  }
823
824
 
825
+ // replace array element with the new one (only arrays of objects)
826
+ function replace(array, item, matchField = 'id') {
827
+ const index = array.findIndex((i) => i[matchField] === item[matchField]);
828
+ array.splice(index, 1, item);
829
+ }
830
+
831
+ // sort array of objects by field
832
+ function sort(array, field = 'id', isDesc = true) {
833
+ array.sort((a, b) => {
834
+ if (a[field] > b[field]) {
835
+ return !isDesc ? 1 : -1;
836
+ }
837
+ if (a[field] < b[field]) {
838
+ return !isDesc ? -1 : 1;
839
+ }
840
+ return 0;
841
+ });
842
+ }
843
+
844
+ // sort array of objects by field
845
+ function sortDeep(array, fieldsQueue = ['id'], isDesc = true) {
846
+ array.sort((a, b) => {
847
+ const aValue = getValue(a, fieldsQueue);
848
+ const bValue = getValue(b, fieldsQueue);
849
+ if (aValue > bValue) {
850
+ return !isDesc ? 1 : -1;
851
+ }
852
+ if (aValue < bValue) {
853
+ return !isDesc ? -1 : 1;
854
+ }
855
+ return 0;
856
+ });
857
+ }
858
+ function getValue(obj, fields) {
859
+ let value = obj;
860
+ fields.forEach((field) => {
861
+ value = value[field];
862
+ });
863
+ return value;
864
+ }
865
+
824
866
  const DEFAULT_INDEX = 'other';
825
867
  /**
826
868
  * Base collection class. Contains common properties and methods for all collections
@@ -892,6 +934,12 @@ class Collection {
892
934
  filter(callback) {
893
935
  return new Collection(this.items.filter(callback));
894
936
  }
937
+ /**
938
+ * Sort collection items by provided field
939
+ */
940
+ sortBy(filed = 'id', isDesc = true) {
941
+ sort(this.items, filed, isDesc);
942
+ }
895
943
  get first() {
896
944
  return first(this.items);
897
945
  }
@@ -2821,6 +2869,7 @@ var TaxExemptionEnum;
2821
2869
  var PropertyCategoryListEnum;
2822
2870
  (function (PropertyCategoryListEnum) {
2823
2871
  PropertyCategoryListEnum[PropertyCategoryListEnum["OWNER_OCCUPIED"] = 3] = "OWNER_OCCUPIED";
2872
+ PropertyCategoryListEnum[PropertyCategoryListEnum["VACANT_LAND"] = 5] = "VACANT_LAND";
2824
2873
  })(PropertyCategoryListEnum || (PropertyCategoryListEnum = {}));
2825
2874
 
2826
2875
  var TaxExemptionMetadataEnum;
@@ -3816,11 +3865,25 @@ class DepreciationReportItemCollection extends DepreciationCollection {
3816
3865
  }
3817
3866
  }
3818
3867
 
3868
+ /**
3869
+ * Base collection to work with property report items
3870
+ */
3871
+ class PropertyReportItemCollection extends Collection {
3872
+ getIncomes() {
3873
+ return this.create(this.items.filter((item) => item.isIncome()));
3874
+ }
3875
+ getExpenses() {
3876
+ return this.create(this.items.filter((item) => item.isExpense()));
3877
+ }
3878
+ }
3879
+
3819
3880
  /**
3820
3881
  * Class with property transactions report entities
3821
3882
  */
3822
3883
  class PropertyReportItem {
3823
3884
  constructor(property, chartAccounts) {
3885
+ this.chartAccounts = chartAccounts;
3886
+ this.propertyId = property.id;
3824
3887
  this.claimPercent = property.claimPercent;
3825
3888
  this.sharePercent = property.sharePercent;
3826
3889
  this.subCode = chartAccounts.taxReturnItem.subCode;
@@ -3832,6 +3895,12 @@ class PropertyReportItem {
3832
3895
  get shareClaimAmount() {
3833
3896
  return this.claimAmount * (this.sharePercent / 100);
3834
3897
  }
3898
+ isIncome() {
3899
+ return CHART_ACCOUNTS_CATEGORIES.income.includes(this.chartAccounts.category);
3900
+ }
3901
+ isExpense() {
3902
+ return CHART_ACCOUNTS_CATEGORIES.expense.includes(this.chartAccounts.category);
3903
+ }
3835
3904
  }
3836
3905
 
3837
3906
  /**
@@ -3840,7 +3909,7 @@ class PropertyReportItem {
3840
3909
  class PropertyReportItemTransaction extends PropertyReportItem {
3841
3910
  constructor(transactions, property, chartAccounts) {
3842
3911
  super(property, chartAccounts);
3843
- this.amount = transactions.amount;
3912
+ this.amount = Math.abs(transactions.amount);
3844
3913
  this.description = chartAccounts.name;
3845
3914
  }
3846
3915
  }
@@ -3848,42 +3917,55 @@ class PropertyReportItemTransaction extends PropertyReportItem {
3848
3917
  /**
3849
3918
  * Collection to work with transaction-based property report items
3850
3919
  */
3851
- class PropertyReportItemTransactionCollection extends Collection {
3852
- constructor(transactions, property, chartAccounts) {
3920
+ class PropertyReportItemTransactionCollection extends PropertyReportItemCollection {
3921
+ constructor(transactions, properties, chartAccounts) {
3853
3922
  super();
3854
- this.setItems(transactions, property, chartAccounts);
3855
- }
3856
- setItems(transactions, property, chartAccounts) {
3857
- const transactionsDictionary = new CollectionDictionary(transactions, 'chartAccounts.id');
3858
- this.items = transactionsDictionary.keys.map((chartAccountId) => {
3859
- return new PropertyReportItemTransaction(transactionsDictionary.get(chartAccountId), property, chartAccounts.getById(+chartAccountId));
3923
+ this.setItems(transactions, properties, chartAccounts);
3924
+ }
3925
+ setItems(transactions, properties, chartAccounts) {
3926
+ this.items = [];
3927
+ properties.items.forEach((property) => {
3928
+ const transactionsDictionary = new CollectionDictionary(transactions.getByPropertiesIds([property.id]), 'chartAccounts.id');
3929
+ transactionsDictionary.keys.map((chartAccountId) => {
3930
+ this.items.push(new PropertyReportItemTransaction(transactionsDictionary.get(chartAccountId), property, chartAccounts.getById(+chartAccountId)));
3931
+ });
3860
3932
  });
3861
3933
  }
3862
3934
  }
3863
3935
 
3936
+ /**
3937
+ * Const with labels based on depreciation type
3938
+ */
3939
+ const DEPRECIATION_TYPE_LABELS = {
3940
+ 1: 'Plant & Equipment',
3941
+ 2: 'Building & Improvements'
3942
+ };
3864
3943
  /**
3865
3944
  * Class with depreciation-based property transactions report entities
3866
3945
  */
3867
3946
  class PropertyReportItemDepreciation extends PropertyReportItem {
3868
3947
  constructor(depreciations, property, chartAccounts) {
3869
3948
  super(property, chartAccounts);
3870
- this.amount = depreciations.getCurrentYearForecastAmount();
3871
- this.description = DepreciationTypeEnum[depreciations.first.type];
3949
+ this.amount = Math.abs(depreciations.getCurrentYearForecastAmount());
3950
+ this.description = DEPRECIATION_TYPE_LABELS[depreciations.first.type];
3872
3951
  }
3873
3952
  }
3874
3953
 
3875
3954
  /**
3876
3955
  * Collection to work with depreciation-based property report items
3877
3956
  */
3878
- class PropertyReportItemDepreciationCollection extends Collection {
3879
- constructor(depreciations, property, chartAccounts) {
3957
+ class PropertyReportItemDepreciationCollection extends PropertyReportItemCollection {
3958
+ constructor(depreciations, properties, chartAccounts) {
3880
3959
  super();
3881
- this.setItems(depreciations, property, chartAccounts);
3882
- }
3883
- setItems(depreciations, property, chartAccounts) {
3884
- const depreciationsbyType = new CollectionDictionary(depreciations, 'type');
3885
- this.items = depreciationsbyType.keys.map((type) => {
3886
- return new PropertyReportItemDepreciation(depreciationsbyType.get(type), property, chartAccounts.getById(depreciationsbyType.get(type).first.chartAccounts.id));
3960
+ this.setItems(depreciations, properties, chartAccounts);
3961
+ }
3962
+ setItems(depreciations, properties, chartAccounts) {
3963
+ this.items = [];
3964
+ properties.items.forEach((property) => {
3965
+ const depreciationsByType = new CollectionDictionary(depreciations, 'type');
3966
+ depreciationsByType.keys.map((type) => {
3967
+ this.items.push(new PropertyReportItemDepreciation(depreciationsByType.get(type), property, chartAccounts.getById(depreciationsByType.get(type).first.chartAccounts.id)));
3968
+ });
3887
3969
  });
3888
3970
  }
3889
3971
  }
@@ -5537,6 +5619,12 @@ var AppEventTypeEnum;
5537
5619
  AppEventTypeEnum[AppEventTypeEnum["VEHICLE_CLAIM_CREATED"] = 37] = "VEHICLE_CLAIM_CREATED";
5538
5620
  })(AppEventTypeEnum || (AppEventTypeEnum = {}));
5539
5621
 
5622
+ /**
5623
+ * Data table structure suitable for export
5624
+ */
5625
+ class ExportDataTable {
5626
+ }
5627
+
5540
5628
  var ExportFormatEnum;
5541
5629
  (function (ExportFormatEnum) {
5542
5630
  ExportFormatEnum["PDF"] = "PDF";
@@ -6523,47 +6611,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
6523
6611
  args: ['environment']
6524
6612
  }] }]; } });
6525
6613
 
6526
- // replace array element with the new one (only arrays of objects)
6527
- function replace(array, item, matchField = 'id') {
6528
- const index = array.findIndex((i) => i[matchField] === item[matchField]);
6529
- array.splice(index, 1, item);
6530
- }
6531
-
6532
- // sort array of objects by field
6533
- function sort(array, field = 'id', isDesc = true) {
6534
- array.sort((a, b) => {
6535
- if (a[field] > b[field]) {
6536
- return !isDesc ? 1 : -1;
6537
- }
6538
- if (a[field] < b[field]) {
6539
- return !isDesc ? -1 : 1;
6540
- }
6541
- return 0;
6542
- });
6543
- }
6544
-
6545
- // sort array of objects by field
6546
- function sortDeep(array, fieldsQueue = ['id'], isDesc = true) {
6547
- array.sort((a, b) => {
6548
- const aValue = getValue(a, fieldsQueue);
6549
- const bValue = getValue(b, fieldsQueue);
6550
- if (aValue > bValue) {
6551
- return !isDesc ? 1 : -1;
6552
- }
6553
- if (aValue < bValue) {
6554
- return !isDesc ? -1 : 1;
6555
- }
6556
- return 0;
6557
- });
6558
- }
6559
- function getValue(obj, fields) {
6560
- let value = obj;
6561
- fields.forEach((field) => {
6562
- value = value[field];
6563
- });
6564
- return value;
6565
- }
6566
-
6567
6614
  class EventDispatcherService {
6568
6615
  constructor() {
6569
6616
  this.eventSubject = new Subject();
@@ -8904,45 +8951,70 @@ const PDF_CONFIG = {
8904
8951
  */
8905
8952
  class PdfService {
8906
8953
  /**
8907
- * Export file form provided HTML tables
8954
+ * Export file from provided HTML tables
8908
8955
  */
8909
8956
  exportTables(tables, title, fileName) {
8910
8957
  const document = this.generateFromTables(tables, title);
8911
8958
  document.save(`${fileName}.pdf`);
8912
8959
  }
8960
+ /**
8961
+ * Export file from provided array-like table data
8962
+ */
8963
+ exportFromDataTables(dataTables, title, fileName) {
8964
+ const document = this.generateFromDataTables(title, dataTables);
8965
+ document.save(`${fileName}.pdf`);
8966
+ }
8967
+ /**
8968
+ * Generate file from array-like table data
8969
+ */
8970
+ generateFromDataTables(title, dataTables) {
8971
+ const pdf = new jsPDF();
8972
+ this.setDocumentTitle(pdf, title);
8973
+ this.setDocumentLogo(pdf);
8974
+ dataTables.forEach((dataTable) => {
8975
+ autoTable(pdf, Object.assign({ head: [dataTable.header], body: dataTable.rows, foot: [dataTable.footer] }, this.setTableOptions(pdf, dataTable.caption)));
8976
+ });
8977
+ return pdf;
8978
+ }
8913
8979
  generateFromTables(tables, title) {
8914
8980
  const pdf = new jsPDF();
8915
8981
  this.setDocumentTitle(pdf, title);
8916
8982
  this.setDocumentLogo(pdf);
8917
8983
  tables.forEach((table) => {
8918
- var _a;
8919
8984
  // Add table caption if not provided
8920
8985
  if (!table.caption) {
8921
8986
  table.createCaption();
8922
8987
  table.caption.innerText = '';
8923
8988
  }
8924
- // coords of last table
8925
- const lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
8926
- pdf.text(table.caption.innerText, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
8927
- // get caption height based on caption content height
8928
- const captionHeight = pdf.getTextDimensions(pdf.splitTextToSize((_a = table.caption) === null || _a === void 0 ? void 0 : _a.innerText, pdf.internal.pageSize.width)).h;
8929
- // table options
8930
- const options = {
8931
- html: table,
8932
- startY: lastTableCoords + captionHeight + PDF_CONFIG.contentTitleCoords.marginTop,
8933
- headStyles: PDF_CONFIG.table.headStyles,
8934
- footStyles: PDF_CONFIG.table.footStyles,
8935
- didParseCell: (data) => {
8936
- // Align last column content to right
8937
- if (data.table.columns.length > 1 && (data.column.index === data.table.columns.length - 1)) {
8938
- data.cell.styles.halign = 'right';
8939
- }
8940
- }
8941
- };
8942
- autoTable(pdf, options);
8989
+ autoTable(pdf, Object.assign({ html: table }, this.setTableOptions(pdf, table.caption.innerText)));
8943
8990
  });
8944
8991
  return pdf;
8945
8992
  }
8993
+ /**
8994
+ * Set basic options for PDF table
8995
+ */
8996
+ setTableOptions(pdf, tableCaption = '') {
8997
+ const lastTableCoords = pdf['lastAutoTable'].finalY || PDF_CONFIG.contentCoords.marginTop;
8998
+ // get caption height based on caption content height
8999
+ const captionHeight = pdf.getTextDimensions(pdf.splitTextToSize(tableCaption, pdf.internal.pageSize.width)).h;
9000
+ pdf.text(tableCaption, PDF_CONFIG.contentCoords.marginLeft, lastTableCoords + PDF_CONFIG.contentCoords.marginTop);
9001
+ return {
9002
+ headStyles: {
9003
+ fillColor: PDF_CONFIG.text.colorPrimary,
9004
+ },
9005
+ footStyles: {
9006
+ fillColor: PDF_CONFIG.text.colorWhite,
9007
+ textColor: PDF_CONFIG.text.colorBlack
9008
+ },
9009
+ startY: lastTableCoords + captionHeight + PDF_CONFIG.contentTitleCoords.marginTop,
9010
+ didParseCell: (data) => {
9011
+ // Align last column content to right
9012
+ if (data.table.columns.length > 1 && (data.column.index === data.table.columns.length - 1)) {
9013
+ data.cell.styles.halign = 'right';
9014
+ }
9015
+ }
9016
+ };
9017
+ }
8946
9018
  setDocumentTitle(doc, title) {
8947
9019
  doc.setFontSize(PDF_CONFIG.text.fontSize)
8948
9020
  .setFont(PDF_CONFIG.text.fontName, PDF_CONFIG.text.fontStyle, PDF_CONFIG.text.fontWeight)
@@ -9230,6 +9302,15 @@ class TransactionService extends RestService {
9230
9302
  return transactions.filter((transaction) => transaction.isWorkTank());
9231
9303
  }));
9232
9304
  }
9305
+ /**
9306
+ * Get list of property holding costs (transactions related to vacant land property)
9307
+ */
9308
+ getPropertyHoldingCosts(propertyId) {
9309
+ return this.http.get(`${this.environment.apiV2}/${this.url}?propertyId=${propertyId}&propertyCategoryId=${PropertyCategoryListEnum.VACANT_LAND}`)
9310
+ .pipe(map((transactionsBase) => {
9311
+ return transactionsBase.map((transactionBase) => plainToClass(Transaction, transactionBase));
9312
+ }));
9313
+ }
9233
9314
  /**
9234
9315
  * get list of taxable transactions with tank type 'Work'
9235
9316
  */
@@ -9470,54 +9551,26 @@ class PropertyTransactionReportService {
9470
9551
  this.chartAccountsService = chartAccountsService;
9471
9552
  }
9472
9553
  /**
9473
- * Get collections dictionary of income report items, grouped by property id
9474
- */
9475
- getIncomes() {
9476
- return combineLatest([
9477
- this.getProperties(),
9478
- this.getTransactions(),
9479
- this.getChartAccounts(),
9480
- ]).pipe(map(([properties, transactions, chartAccounts]) => {
9481
- return this.initIncomeItemsData(transactions, properties, chartAccounts);
9482
- }));
9483
- }
9484
- /**
9485
- * Get collections dictionary of expense report items, grouped by property id
9554
+ * Get collection of report items based on transactions & depreciations
9486
9555
  */
9487
- getExpenses() {
9556
+ get() {
9488
9557
  return combineLatest([
9489
- this.getProperties(),
9558
+ this.propertyService.get(),
9490
9559
  this.getTransactions(),
9491
9560
  this.getDepreciations(),
9492
- this.getChartAccounts()
9561
+ this.chartAccountsService.getChartAccounts()
9493
9562
  ]).pipe(map(([properties, transactions, depreciations, chartAccounts]) => {
9494
- return this.initExpenseItemsData(transactions, depreciations, properties, chartAccounts);
9563
+ return new CollectionDictionary(this.create(transactions, depreciations, new PropertyCollection(properties), new Collection(chartAccounts)), 'propertyId');
9495
9564
  }));
9496
9565
  }
9497
- initIncomeItemsData(transactions, properties, chartAccounts) {
9498
- // empty collection dictionary to be filled with income report items
9499
- const incomesByProperty = new CollectionDictionary(new Collection([]), 'property.id');
9500
- const incomeTransactionsByProperty = new CollectionDictionary(transactions.getIncomeTransactions(), 'property.id');
9501
- incomeTransactionsByProperty.keys.forEach((propertyId) => {
9502
- incomesByProperty.add(propertyId, new PropertyReportItemTransactionCollection(incomeTransactionsByProperty.get(propertyId), properties.getById(+propertyId), chartAccounts));
9503
- });
9504
- return incomesByProperty;
9505
- }
9506
- initExpenseItemsData(transactions, depreciations, properties, chartAccounts) {
9507
- // empty collection dictionary to be filled with expense report items
9508
- const expensesByProperty = new CollectionDictionary(new Collection([]), 'property.id');
9509
- const transactionsByProperty = new CollectionDictionary(transactions.getExpenseTransactions(), 'property.id');
9510
- const depreciationsByProperty = new CollectionDictionary(depreciations, 'property.id');
9511
- transactionsByProperty.keys.forEach((propertyId) => {
9512
- expensesByProperty.add(propertyId, new Collection([
9513
- ...new PropertyReportItemTransactionCollection(transactionsByProperty.get(propertyId), properties.getById(+propertyId), chartAccounts).items,
9514
- ...new PropertyReportItemDepreciationCollection(depreciationsByProperty.get(propertyId), properties.getById(+propertyId), chartAccounts).items
9515
- ]));
9516
- });
9517
- return expensesByProperty;
9566
+ create(transactions, depreciations, properties, chartAccounts) {
9567
+ return new PropertyReportItemCollection([
9568
+ ...new PropertyReportItemTransactionCollection(transactions, properties, chartAccounts).items,
9569
+ ...new PropertyReportItemDepreciationCollection(depreciations, properties, chartAccounts).items,
9570
+ ]);
9518
9571
  }
9519
9572
  /**
9520
- * Get colection of property transactions
9573
+ * Get collection of property transactions
9521
9574
  */
9522
9575
  getTransactions() {
9523
9576
  return this.transactionService.get().pipe(map((transactions) => {
@@ -9532,19 +9585,10 @@ class PropertyTransactionReportService {
9532
9585
  return this.depreciationService.get().pipe(map((depreciations) => {
9533
9586
  return new DepreciationCollection(depreciations)
9534
9587
  .getByChartAccountsCategories(CHART_ACCOUNTS_CATEGORIES.property)
9588
+ // we don't need borrowing expenses for this report
9535
9589
  .getWithoutBorrowingExpenses();
9536
9590
  }));
9537
9591
  }
9538
- getProperties() {
9539
- return this.propertyService.get().pipe(map((properties) => {
9540
- return new PropertyCollection(properties);
9541
- }));
9542
- }
9543
- getChartAccounts() {
9544
- return this.chartAccountsService.getChartAccounts().pipe(map((chartAccounts) => {
9545
- return new Collection(chartAccounts);
9546
- }));
9547
- }
9548
9592
  }
9549
9593
  PropertyTransactionReportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyTransactionReportService, deps: [{ token: PropertyService }, { token: TransactionService }, { token: DepreciationService }, { token: ChartAccountsService }], target: i0.ɵɵFactoryTarget.Injectable });
9550
9594
  PropertyTransactionReportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyTransactionReportService, providedIn: 'root' });
@@ -9672,6 +9716,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
9672
9716
  }]
9673
9717
  }] });
9674
9718
 
9719
+ /**
9720
+ * Service to work with holding costs (transactions related to vacant land property)
9721
+ */
9722
+ class PropertyHoldingCostsService {
9723
+ constructor(pdfService, currencyPipe, datePipe) {
9724
+ this.pdfService = pdfService;
9725
+ this.currencyPipe = currencyPipe;
9726
+ this.datePipe = datePipe;
9727
+ this.url = 'transactions';
9728
+ this.modelClass = Transaction;
9729
+ }
9730
+ initDataTable(holdingCosts) {
9731
+ return plainToClass(ExportDataTable, {
9732
+ header: ['Date', 'Description', 'Debit', 'Credit'],
9733
+ rows: this.getDataTableRows(holdingCosts),
9734
+ footer: [
9735
+ 'Total',
9736
+ '',
9737
+ this.currencyPipe.transform(holdingCosts.sumBy('debit')).toString(),
9738
+ this.currencyPipe.transform(holdingCosts.sumBy('credit')).toString(),
9739
+ ]
9740
+ });
9741
+ }
9742
+ /**
9743
+ * Get data for the exporting table rows
9744
+ */
9745
+ getDataTableRows(holdingCosts) {
9746
+ return holdingCosts.items.map((transaction) => {
9747
+ return [
9748
+ this.datePipe.transform(transaction.date, 'dd/MM/YYYY').toString(),
9749
+ transaction.description,
9750
+ this.currencyPipe.transform(transaction.debit).toString(),
9751
+ this.currencyPipe.transform(transaction.credit).toString()
9752
+ ];
9753
+ });
9754
+ }
9755
+ }
9756
+ PropertyHoldingCostsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyHoldingCostsService, deps: [{ token: PdfService }, { token: i2.CurrencyPipe }, { token: i2.DatePipe }], target: i0.ɵɵFactoryTarget.Injectable });
9757
+ PropertyHoldingCostsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyHoldingCostsService, providedIn: 'root' });
9758
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PropertyHoldingCostsService, decorators: [{
9759
+ type: Injectable,
9760
+ args: [{
9761
+ providedIn: 'root'
9762
+ }]
9763
+ }], ctorParameters: function () { return [{ type: PdfService }, { type: i2.CurrencyPipe }, { type: i2.DatePipe }]; } });
9764
+
9675
9765
  /**
9676
9766
  * Service for work with Property Categories
9677
9767
  */
@@ -11056,5 +11146,5 @@ class ResetPasswordForm extends AbstractForm {
11056
11146
  * Generated bundle index. Do not edit.
11057
11147
  */
11058
11148
 
11059
- export { AbstractForm, Address, AddressService, AddressTypeEnum, AlphabetColorsEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Bank, BankAccount, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqConfig, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, ChartAccounts, ChartAccountsCategoryEnum, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientInvite, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEFAULT_VEHICLE_EXPENSE, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCapitalProjectService, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationLvpAssetTypeEnum, DepreciationLvpReportItem, DepreciationLvpReportItemCollection, DepreciationReceipt, DepreciationReportItem, DepreciationReportItemCollection, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderService, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeService, Endpoint, EquityPositionChartService, EventDispatcherService, ExportFormatEnum, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSalaryEnum, IncomeSourceTypeListWorkEnum, InterceptorsModule, IntercomService, InviteStatusEnum, JwtService, KompassifyService, Loan, LoanBankTypeEnum, LoanCollection, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LogbookCollection, LogbookPeriod, LoginForm, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, Notification, Occupation, OccupationService, PasswordForm, PdfService, Phone, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCategory, PropertyCategoryMovement, PropertyCategoryMovementService, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertyReportItem, PropertyReportItemDepreciationCollection, PropertyReportItemTransaction, PropertyReportItemTransactionCollection, PropertySale, PropertySaleService, PropertySaleTaxExemptionMetadata, PropertyService, PropertyShare, PropertyShareAccessEnum, PropertyShareService, PropertyShareStatusEnum, PropertySubscription, PropertyTransactionReportService, PropertyValuation, RegisterClientForm, RegisterFirmForm, RegistrationInvite, RegistrationInviteStatusEnum, ReportItem, ReportItemCollection, ReportItemDetails, ResetPasswordForm, SUBSCRIPTION_DESCRIPTION, SUBSCRIPTION_TITLE, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentStatusEnum, ServicePrice, ServicePriceCollection, ServicePriceRecurringIntervalEnum, ServicePriceTypeEnum, ServiceProduct, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, ShareFilterOptionsEnum, SoleForecast, SoleForecastService, SpareDocumentSpareTypeEnum, SseService, SubscriptionService, SubscriptionTypeEnum, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxExemption, TaxExemptionEnum, TaxExemptionMetadata, TaxExemptionMetadataEnum, TaxExemptionService, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Toast, ToastService, ToastTypeEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionCalculationService, TransactionCollection, TransactionMetadata, TransactionOperationEnum, TransactionReceipt, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, USER_ROLES, USER_WORK_POSITION, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserMedicareExemptionEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, Vehicle, VehicleClaim, VehicleClaimMethodEnum, VehicleLogbook, VehicleLogbookPurposeEnum, VehicleService, WORK_TANK_LOGBOOK_PURPOSE_OPTIONS, XlsxService, cloneDeep, compare, compareMatOptions, createDate, displayMatOptions, enumToList, getDocIcon, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
11149
+ export { AbstractForm, Address, AddressService, AddressTypeEnum, AlphabetColorsEnum, AppEvent, AppEventTypeEnum, AssetEntityTypeEnum, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Bank, BankAccount, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankConnection, BankConnectionService, BankConnectionStatusEnum, BankService, BankTransaction, BankTransactionCalculationService, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasiqConfig, BasiqJob, BasiqService, BasiqToken, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, ChartAccounts, ChartAccountsCategoryEnum, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsListEnum, ChartAccountsMetadata, ChartAccountsMetadataListEnum, ChartAccountsMetadataTypeEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartData, ChartSerie, Chat, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientInvite, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEFAULT_VEHICLE_EXPENSE, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCapitalProjectService, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationLvpAssetTypeEnum, DepreciationLvpReportItem, DepreciationLvpReportItemCollection, DepreciationReceipt, DepreciationReportItem, DepreciationReportItemCollection, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderService, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeService, Endpoint, EquityPositionChartService, EventDispatcherService, ExportDataTable, ExportFormatEnum, FinancialYear, Firm, FirmService, FirmTypeEnum, HeaderTitleService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastService, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSalaryEnum, IncomeSourceTypeListWorkEnum, InterceptorsModule, IntercomService, InviteStatusEnum, JwtService, KompassifyService, Loan, LoanBankTypeEnum, LoanCollection, LoanFrequencyEnum, LoanInterestTypeEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LogbookCollection, LogbookPeriod, LoginForm, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, Notification, Occupation, OccupationService, PasswordForm, PdfService, Phone, PhoneTypeEnum, PreloaderService, Property, PropertyCalculationService, PropertyCategory, PropertyCategoryListEnum, PropertyCategoryMovement, PropertyCategoryMovementService, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentService, PropertyEquityChartData, PropertyEquityChartItem, PropertyForecast, PropertyHoldingCostsService, PropertyReportItem, PropertyReportItemCollection, PropertyReportItemDepreciationCollection, PropertyReportItemTransaction, PropertyReportItemTransactionCollection, PropertySale, PropertySaleService, PropertySaleTaxExemptionMetadata, PropertyService, PropertyShare, PropertyShareAccessEnum, PropertyShareService, PropertyShareStatusEnum, PropertySubscription, PropertyTransactionReportService, PropertyValuation, RegisterClientForm, RegisterFirmForm, RegistrationInvite, RegistrationInviteStatusEnum, ReportItem, ReportItemCollection, ReportItemDetails, ResetPasswordForm, SUBSCRIPTION_DESCRIPTION, SUBSCRIPTION_TITLE, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentStatusEnum, ServicePrice, ServicePriceCollection, ServicePriceRecurringIntervalEnum, ServicePriceTypeEnum, ServiceProduct, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, ShareFilterOptionsEnum, SoleForecast, SoleForecastService, SpareDocumentSpareTypeEnum, SseService, SubscriptionService, SubscriptionTypeEnum, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxExemption, TaxExemptionEnum, TaxExemptionMetadata, TaxExemptionMetadataEnum, TaxExemptionService, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Toast, ToastService, ToastTypeEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionCalculationService, TransactionCollection, TransactionMetadata, TransactionOperationEnum, TransactionReceipt, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, USER_ROLES, USER_WORK_POSITION, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserMedicareExemptionEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, Vehicle, VehicleClaim, VehicleClaimMethodEnum, VehicleLogbook, VehicleLogbookPurposeEnum, VehicleService, WORK_TANK_LOGBOOK_PURPOSE_OPTIONS, XlsxService, cloneDeep, compare, compareMatOptions, createDate, displayMatOptions, enumToList, getDocIcon, replace, roundTo, sort, sortDeep, taxReviewFilterPredicate };
11060
11150
  //# sourceMappingURL=taxtank-core.js.map