taxtank-core 2.1.62 → 2.1.64
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.
- package/fesm2022/taxtank-core.mjs +68 -27
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/index.d.ts +8 -2
- package/package.json +1 -1
|
@@ -1311,7 +1311,7 @@ class TransactionBase extends ObservableModel {
|
|
|
1311
1311
|
return this.currency !== 'AUD';
|
|
1312
1312
|
}
|
|
1313
1313
|
get foreignAmount() {
|
|
1314
|
-
return this.amount
|
|
1314
|
+
return this.amount * this.exchangeRate;
|
|
1315
1315
|
}
|
|
1316
1316
|
}
|
|
1317
1317
|
__decorate([
|
|
@@ -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
|
/**
|
|
@@ -2240,6 +2252,9 @@ class Collection {
|
|
|
2240
2252
|
}
|
|
2241
2253
|
return this.filter((item) => arrayValues.includes(get(item, path)));
|
|
2242
2254
|
}
|
|
2255
|
+
filterByDay(date = new Date(), path = 'date') {
|
|
2256
|
+
return this.filter(item => get(item, path).toISOString().slice(0, 10) === date.toISOString().slice(0, 10));
|
|
2257
|
+
}
|
|
2243
2258
|
filterByRange(path, from, to) {
|
|
2244
2259
|
return this.filter((item) => get(item, path) >= from && get(item, path) <= to);
|
|
2245
2260
|
}
|
|
@@ -2388,12 +2403,6 @@ class ExportableCollection extends Collection {
|
|
|
2388
2403
|
}
|
|
2389
2404
|
}
|
|
2390
2405
|
|
|
2391
|
-
/**
|
|
2392
|
-
* export table column
|
|
2393
|
-
*/
|
|
2394
|
-
class ExportCell {
|
|
2395
|
-
}
|
|
2396
|
-
|
|
2397
2406
|
/**
|
|
2398
2407
|
* type of export table column value
|
|
2399
2408
|
*/
|
|
@@ -2405,6 +2414,15 @@ var ExportCellTypeEnum;
|
|
|
2405
2414
|
ExportCellTypeEnum[ExportCellTypeEnum["PERCENT"] = 3] = "PERCENT";
|
|
2406
2415
|
})(ExportCellTypeEnum || (ExportCellTypeEnum = {}));
|
|
2407
2416
|
|
|
2417
|
+
/**
|
|
2418
|
+
* export table column
|
|
2419
|
+
*/
|
|
2420
|
+
class ExportCell {
|
|
2421
|
+
constructor() {
|
|
2422
|
+
this.type = ExportCellTypeEnum.STRING;
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2408
2426
|
class LoanPaymentCollection extends ExportableCollection {
|
|
2409
2427
|
getExportHeader() {
|
|
2410
2428
|
return [
|
|
@@ -2520,8 +2538,8 @@ class MoneyCalendarEventCollection extends CalendarEventCollection {
|
|
|
2520
2538
|
get incomes() {
|
|
2521
2539
|
return this.filter(event => event.extendedProps.chartAccounts.isIncome());
|
|
2522
2540
|
}
|
|
2523
|
-
filterByDate(dateFrom, dateTo) {
|
|
2524
|
-
return this.filterByRange('date', dateFrom
|
|
2541
|
+
filterByDate(dateFrom = new FinancialYear().startDate, dateTo = new FinancialYear().endDate) {
|
|
2542
|
+
return this.filterByRange('date', dateFrom, dateTo);
|
|
2525
2543
|
}
|
|
2526
2544
|
getByMonth(index) {
|
|
2527
2545
|
return new MoneyCalendarEventCollection(this.items.filter(event => event.inMonth(index)));
|
|
@@ -9935,12 +9953,40 @@ class DocumentFolderCollection extends Collection {
|
|
|
9935
9953
|
}
|
|
9936
9954
|
}
|
|
9937
9955
|
|
|
9938
|
-
class AllocationGroupCollection extends
|
|
9956
|
+
class AllocationGroupCollection extends ExportableCollection {
|
|
9939
9957
|
constructor(items) {
|
|
9940
9958
|
super(items);
|
|
9941
9959
|
// @TODO Alex: could be useful for other collections, move to base class
|
|
9942
9960
|
this.sortBy('date');
|
|
9943
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
|
+
}
|
|
9944
9990
|
}
|
|
9945
9991
|
|
|
9946
9992
|
class AllocationRuleCollection extends Collection {
|
|
@@ -11077,7 +11123,7 @@ class BankAccount extends BankAccount$1 {
|
|
|
11077
11123
|
* Get the current opening balance amount
|
|
11078
11124
|
*/
|
|
11079
11125
|
getOpeningBalance(year = FinancialYear.year, convertToAud = false) {
|
|
11080
|
-
return (this.getBalanceByYear(year)?.openingBalance || 0)
|
|
11126
|
+
return (this.getBalanceByYear(year)?.openingBalance || 0) / (convertToAud ? this.exchangeRate : 1);
|
|
11081
11127
|
}
|
|
11082
11128
|
/**
|
|
11083
11129
|
* Get bank account balance for current financial year
|
|
@@ -11205,7 +11251,7 @@ class BankAccount extends BankAccount$1 {
|
|
|
11205
11251
|
return this.currency !== 'AUD';
|
|
11206
11252
|
}
|
|
11207
11253
|
get convertedBalance() {
|
|
11208
|
-
return this.currentBalance
|
|
11254
|
+
return this.currentBalance / this.exchangeRate;
|
|
11209
11255
|
}
|
|
11210
11256
|
}
|
|
11211
11257
|
__decorate([
|
|
@@ -22528,24 +22574,19 @@ class XlsxService {
|
|
|
22528
22574
|
*/
|
|
22529
22575
|
exportArrayToExcel(exportableCollection, name, params) {
|
|
22530
22576
|
const workbook = xlsx.utils.book_new();
|
|
22531
|
-
// create empty worksheet
|
|
22532
|
-
const worksheet = {
|
|
22533
|
-
SheetNames: [],
|
|
22534
|
-
Sheets: {}
|
|
22535
|
-
};
|
|
22536
22577
|
const exportData = exportableCollection.export(params);
|
|
22537
|
-
const exportAoa = exportableCollection.getBodyAoa(exportData);
|
|
22538
22578
|
const { sheetName, fileName } = this.getFileName(name);
|
|
22539
|
-
xlsx.utils.
|
|
22540
|
-
|
|
22541
|
-
|
|
22542
|
-
|
|
22543
|
-
xlsx.utils.
|
|
22544
|
-
xlsx.
|
|
22545
|
-
|
|
22546
|
-
|
|
22547
|
-
|
|
22579
|
+
const worksheet = xlsx.utils.aoa_to_sheet([
|
|
22580
|
+
exportData.header,
|
|
22581
|
+
...exportableCollection.getBodyAoa(exportData)
|
|
22582
|
+
]);
|
|
22583
|
+
xlsx.utils.book_append_sheet(workbook, worksheet, sheetName);
|
|
22584
|
+
const excelFile = xlsx.write(workbook, {
|
|
22585
|
+
bookType: 'xlsx',
|
|
22586
|
+
type: 'array',
|
|
22587
|
+
compression: true
|
|
22548
22588
|
});
|
|
22589
|
+
const data = new Blob([excelFile], { type: EXCEL_TYPE });
|
|
22549
22590
|
FileSaver.saveAs(data, `${fileName}.xlsx`);
|
|
22550
22591
|
}
|
|
22551
22592
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: XlsxService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|