taxtank-core 2.1.63 → 2.1.65

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.
@@ -1768,6 +1768,18 @@ class AllocationGroup extends AbstractModel {
1768
1768
  get isAutoAllocated() {
1769
1769
  return this.allocations.first?.isAutoAllocated;
1770
1770
  }
1771
+ get operationLabel() {
1772
+ switch (this.operation) {
1773
+ case TransactionOperationEnum.ALLOCATE:
1774
+ return 'Allocate';
1775
+ case TransactionOperationEnum.ALLOCATE_INVOICE:
1776
+ return 'Match Invoice';
1777
+ case TransactionOperationEnum.FIND_AND_MATCH:
1778
+ return 'Find and Match';
1779
+ case TransactionOperationEnum.TRANSFER:
1780
+ return 'Transfer';
1781
+ }
1782
+ }
1771
1783
  }
1772
1784
 
1773
1785
  /**
@@ -2391,12 +2403,6 @@ class ExportableCollection extends Collection {
2391
2403
  }
2392
2404
  }
2393
2405
 
2394
- /**
2395
- * export table column
2396
- */
2397
- class ExportCell {
2398
- }
2399
-
2400
2406
  /**
2401
2407
  * type of export table column value
2402
2408
  */
@@ -2408,6 +2414,15 @@ var ExportCellTypeEnum;
2408
2414
  ExportCellTypeEnum[ExportCellTypeEnum["PERCENT"] = 3] = "PERCENT";
2409
2415
  })(ExportCellTypeEnum || (ExportCellTypeEnum = {}));
2410
2416
 
2417
+ /**
2418
+ * export table column
2419
+ */
2420
+ class ExportCell {
2421
+ constructor() {
2422
+ this.type = ExportCellTypeEnum.STRING;
2423
+ }
2424
+ }
2425
+
2411
2426
  class LoanPaymentCollection extends ExportableCollection {
2412
2427
  getExportHeader() {
2413
2428
  return [
@@ -9938,12 +9953,40 @@ class DocumentFolderCollection extends Collection {
9938
9953
  }
9939
9954
  }
9940
9955
 
9941
- class AllocationGroupCollection extends Collection {
9956
+ class AllocationGroupCollection extends ExportableCollection {
9942
9957
  constructor(items) {
9943
9958
  super(items);
9944
9959
  // @TODO Alex: could be useful for other collections, move to base class
9945
9960
  this.sortBy('date');
9946
9961
  }
9962
+ getExportHeader() {
9963
+ const header = ['Type', 'Date', 'Description', 'Category', 'Amount', 'Currency'];
9964
+ if (this.first?.exchangeRate) {
9965
+ header.push('Conversion Rate', 'Amount AUD');
9966
+ }
9967
+ return header;
9968
+ }
9969
+ getExportFooter() {
9970
+ return [
9971
+ plainToClass(ExportCell, { value: '', type: ExportCellTypeEnum.STRING }),
9972
+ ];
9973
+ }
9974
+ getExportBody() {
9975
+ return this.items.map((group) => {
9976
+ const cell = [
9977
+ plainToClass(ExportCell, { value: group.operationLabel }),
9978
+ plainToClass(ExportCell, { value: group.date, type: ExportCellTypeEnum.DATE }),
9979
+ plainToClass(ExportCell, { value: group.description }),
9980
+ plainToClass(ExportCell, { value: group.category }),
9981
+ plainToClass(ExportCell, { value: group.allocations.sumBy('amount'), type: ExportCellTypeEnum.CURRENCY }),
9982
+ plainToClass(ExportCell, { value: group.bankTransactions.first.currency }),
9983
+ ];
9984
+ if (this.first?.exchangeRate) {
9985
+ cell.push(plainToClass(ExportCell, { value: group.exchangeRate }), plainToClass(ExportCell, { value: group.amount, type: ExportCellTypeEnum.CURRENCY }));
9986
+ }
9987
+ return cell;
9988
+ });
9989
+ }
9947
9990
  }
9948
9991
 
9949
9992
  class AllocationRuleCollection extends Collection {
@@ -11210,6 +11253,9 @@ class BankAccount extends BankAccount$1 {
11210
11253
  get convertedBalance() {
11211
11254
  return this.currentBalance / this.exchangeRate;
11212
11255
  }
11256
+ get convertedCloseBalance() {
11257
+ return this.closeBalance / this.exchangeRate;
11258
+ }
11213
11259
  }
11214
11260
  __decorate([
11215
11261
  Type(() => BankAccountProperty)
@@ -21143,10 +21189,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
21143
21189
  }], ctorParameters: () => [] });
21144
21190
 
21145
21191
  var Currencies = [
21146
- {
21147
- code: "AUD",
21148
- name: "Australian Dollar"
21149
- },
21150
21192
  {
21151
21193
  code: "USD",
21152
21194
  name: "US Dollar"
@@ -22531,24 +22573,19 @@ class XlsxService {
22531
22573
  */
22532
22574
  exportArrayToExcel(exportableCollection, name, params) {
22533
22575
  const workbook = xlsx.utils.book_new();
22534
- // create empty worksheet
22535
- const worksheet = {
22536
- SheetNames: [],
22537
- Sheets: {}
22538
- };
22539
22576
  const exportData = exportableCollection.export(params);
22540
- const exportAoa = exportableCollection.getBodyAoa(exportData);
22541
22577
  const { sheetName, fileName } = this.getFileName(name);
22542
- xlsx.utils.sheet_add_aoa(worksheet, [exportData.header], { origin: -1 });
22543
- // add table table data to the worksheet
22544
- xlsx.utils.sheet_add_aoa(worksheet, exportAoa, { origin: -1 });
22545
- // set empty row after current table
22546
- xlsx.utils.sheet_add_aoa(worksheet, [], { origin: -1 });
22547
- xlsx.utils.book_append_sheet(workbook, worksheet);
22548
- const excelFile = xlsx.write(workbook, { bookType: 'xlsx', type: 'array', compression: true });
22549
- const data = new Blob([excelFile], {
22550
- type: EXCEL_TYPE
22578
+ const worksheet = xlsx.utils.aoa_to_sheet([
22579
+ exportData.header,
22580
+ ...exportableCollection.getBodyAoa(exportData)
22581
+ ]);
22582
+ xlsx.utils.book_append_sheet(workbook, worksheet, sheetName);
22583
+ const excelFile = xlsx.write(workbook, {
22584
+ bookType: 'xlsx',
22585
+ type: 'array',
22586
+ compression: true
22551
22587
  });
22588
+ const data = new Blob([excelFile], { type: EXCEL_TYPE });
22552
22589
  FileSaver.saveAs(data, `${fileName}.xlsx`);
22553
22590
  }
22554
22591
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: XlsxService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }