taxtank-core 0.28.69 → 0.28.70
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/bundles/taxtank-core.umd.js +36 -63
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/depreciation.collection.js +4 -11
- package/esm2015/lib/collections/transaction/transaction-base.collection.js +3 -15
- package/esm2015/lib/collections/transaction/transaction.collection.js +12 -18
- package/esm2015/lib/db/Models/sole/sole-details.js +1 -1
- package/esm2015/lib/db/Models/transaction/transaction-base.js +7 -4
- package/esm2015/lib/models/depreciation/depreciation.js +9 -11
- package/esm2015/lib/models/transaction/transaction.js +4 -4
- package/fesm2015/taxtank-core.js +33 -56
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/depreciation.collection.d.ts +1 -7
- package/lib/collections/transaction/transaction-base.collection.d.ts +1 -8
- package/lib/collections/transaction/transaction.collection.d.ts +3 -10
- package/lib/db/Models/transaction/transaction-base.d.ts +3 -0
- package/lib/models/depreciation/depreciation.d.ts +2 -2
- package/lib/models/transaction/transaction.d.ts +1 -3
- package/package.json +1 -1
package/fesm2015/taxtank-core.js
CHANGED
|
@@ -2908,19 +2908,22 @@ class TransactionBase extends AbstractModel {
|
|
|
2908
2908
|
return !!this.business;
|
|
2909
2909
|
}
|
|
2910
2910
|
get amountWithGst() {
|
|
2911
|
-
return this.isGST ?
|
|
2911
|
+
return this.isGST ? this.amount * ChartAccounts.GSTCoefficient : this.amount;
|
|
2912
2912
|
}
|
|
2913
2913
|
get gstAmount() {
|
|
2914
|
-
return
|
|
2914
|
+
return this.amountWithGst - this.amount;
|
|
2915
2915
|
}
|
|
2916
2916
|
get gstClaimAmount() {
|
|
2917
2917
|
return this.gstAmount * this.claimRatio;
|
|
2918
2918
|
}
|
|
2919
|
+
/**
|
|
2920
|
+
* base grossAmount, extends in child classes
|
|
2921
|
+
*/
|
|
2919
2922
|
get grossAmount() {
|
|
2920
2923
|
return this.amount + this.gstAmount;
|
|
2921
2924
|
}
|
|
2922
2925
|
get grossClaimAmount() {
|
|
2923
|
-
return
|
|
2926
|
+
return this.grossAmount * this.claimRatio;
|
|
2924
2927
|
}
|
|
2925
2928
|
}
|
|
2926
2929
|
__decorate([
|
|
@@ -3447,8 +3450,7 @@ class Depreciation extends Depreciation$1 {
|
|
|
3447
3450
|
var _a, _b;
|
|
3448
3451
|
return plainToClass(Transaction, Object.assign(params, this, {
|
|
3449
3452
|
amount: -((_a = this.currentYearForecast) === null || _a === void 0 ? void 0 : _a.amount) || 0,
|
|
3450
|
-
claimAmount: ((_b = this.currentYearForecast) === null || _b === void 0 ? void 0 : _b.claimAmount) || 0,
|
|
3451
|
-
date: this.purchaseDate
|
|
3453
|
+
claimAmount: -((_b = this.currentYearForecast) === null || _b === void 0 ? void 0 : _b.claimAmount) || 0,
|
|
3452
3454
|
}));
|
|
3453
3455
|
}
|
|
3454
3456
|
/**
|
|
@@ -3459,18 +3461,17 @@ class Depreciation extends Depreciation$1 {
|
|
|
3459
3461
|
return ((_a = this.currentYearForecast) === null || _a === void 0 ? void 0 : _a.claimAmount) || 0;
|
|
3460
3462
|
}
|
|
3461
3463
|
get amountWithGst() {
|
|
3462
|
-
// only new assets
|
|
3463
|
-
if (
|
|
3464
|
-
return
|
|
3464
|
+
// gst applies only to new assets
|
|
3465
|
+
if (this.isNew()) {
|
|
3466
|
+
return super.amountWithGst;
|
|
3465
3467
|
}
|
|
3466
|
-
return
|
|
3468
|
+
return this.amount;
|
|
3467
3469
|
}
|
|
3468
3470
|
/**
|
|
3469
|
-
*
|
|
3471
|
+
* assets purchased in the current financial year
|
|
3470
3472
|
*/
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
return -((_a = this.currentYearForecast) === null || _a === void 0 ? void 0 : _a.amount) - this.gstAmount;
|
|
3473
|
+
isNew() {
|
|
3474
|
+
return new FinancialYear(this.purchaseDate).year === new FinancialYear().year;
|
|
3474
3475
|
}
|
|
3475
3476
|
}
|
|
3476
3477
|
Depreciation.WRITTEN_OFF_THRESHOLD = 300;
|
|
@@ -3662,12 +3663,12 @@ class Transaction extends Transaction$1 {
|
|
|
3662
3663
|
isAllocated(allocations) {
|
|
3663
3664
|
return this.grossAmount === this.getAllocatedAmount(allocations);
|
|
3664
3665
|
}
|
|
3665
|
-
/**
|
|
3666
|
-
* Get transaction allocated amount
|
|
3667
|
-
*/
|
|
3668
3666
|
getAllocatedAmount(allocations) {
|
|
3669
3667
|
return allocations.filterBy('transaction.id', this.id).sumBy('amount');
|
|
3670
3668
|
}
|
|
3669
|
+
getAllocatedClaimAmount(allocations) {
|
|
3670
|
+
return this.getAllocatedAmount(allocations) * this.claimRatio;
|
|
3671
|
+
}
|
|
3671
3672
|
/**
|
|
3672
3673
|
* Get transaction unallocated amount
|
|
3673
3674
|
*/
|
|
@@ -6205,17 +6206,11 @@ class TransactionCollection extends ExportableCollection {
|
|
|
6205
6206
|
constructor(transactions = [], depreciations = []) {
|
|
6206
6207
|
super([...transactions, ...depreciations.map((depreciation) => depreciation.toTransaction())]);
|
|
6207
6208
|
}
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
*/
|
|
6211
|
-
getWithBusiness() {
|
|
6212
|
-
return this.filter((transaction) => !!transaction.business);
|
|
6209
|
+
getSoleTransactions() {
|
|
6210
|
+
return this.filter((transaction) => transaction.isSoleTank());
|
|
6213
6211
|
}
|
|
6214
|
-
/**
|
|
6215
|
-
* Get total amount of all transactions in the collection
|
|
6216
|
-
*/
|
|
6217
6212
|
get amount() {
|
|
6218
|
-
return
|
|
6213
|
+
return this.sumBy('amount');
|
|
6219
6214
|
}
|
|
6220
6215
|
/**
|
|
6221
6216
|
* Difference between allocated amount and total amount
|
|
@@ -6413,17 +6408,17 @@ class TransactionCollection extends ExportableCollection {
|
|
|
6413
6408
|
return chartData;
|
|
6414
6409
|
}
|
|
6415
6410
|
/**
|
|
6416
|
-
* user pays GST only from allocated part
|
|
6417
|
-
*
|
|
6418
|
-
* @param allocations
|
|
6411
|
+
* user pays GST only from allocated part (or paid) of income
|
|
6419
6412
|
*/
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
let allocatedGST = 0;
|
|
6413
|
+
calculateAllocatedClaimAmount(allocations) {
|
|
6414
|
+
let allocatedClaimAmount = 0;
|
|
6423
6415
|
this.filterBy('isGST', true).toArray().forEach((transaction) => {
|
|
6424
|
-
|
|
6416
|
+
allocatedClaimAmount += transaction.getAllocatedClaimAmount(allocations);
|
|
6425
6417
|
});
|
|
6426
|
-
return
|
|
6418
|
+
return allocatedClaimAmount;
|
|
6419
|
+
}
|
|
6420
|
+
calculateAllocatedGST(allocations) {
|
|
6421
|
+
return this.calculateAllocatedClaimAmount(allocations) * ChartAccounts.GSTRatio;
|
|
6427
6422
|
}
|
|
6428
6423
|
getAllocatedAmount(allocations) {
|
|
6429
6424
|
return allocations.getByTransactionsIds(this.getIds()).sumBy('amount');
|
|
@@ -6472,23 +6467,11 @@ class TransactionAllocationCollection extends Collection {
|
|
|
6472
6467
|
* used to combine transactions/depreciations
|
|
6473
6468
|
*/
|
|
6474
6469
|
class TransactionBaseCollection extends Collection {
|
|
6475
|
-
filterByBusiness(business) {
|
|
6476
|
-
return this.filterBy('business.id', business.id);
|
|
6477
|
-
}
|
|
6478
6470
|
getClaimAmountByBusinessId(businessId) {
|
|
6479
6471
|
return +this.filterBy('business.id', businessId).items.map((transaction) => transaction instanceof Depreciation ? -transaction.claimAmount : transaction['claimAmount']).reduce((sum, claimAmount) => sum + claimAmount, 0).toFixed(2);
|
|
6480
6472
|
}
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
*/
|
|
6484
|
-
getWithBusiness() {
|
|
6485
|
-
return this.filter((transaction) => !!transaction.business);
|
|
6486
|
-
}
|
|
6487
|
-
getIncomeTransactions() {
|
|
6488
|
-
return this.create(this.items.filter((transaction) => transaction.isIncome()));
|
|
6489
|
-
}
|
|
6490
|
-
getExpenseTransactions() {
|
|
6491
|
-
return this.create(this.items.filter((transaction) => transaction.isExpense() && !transaction.isInterest()));
|
|
6473
|
+
getSoleTransactions() {
|
|
6474
|
+
return this.filter((transaction) => transaction.isSoleTank());
|
|
6492
6475
|
}
|
|
6493
6476
|
}
|
|
6494
6477
|
|
|
@@ -6776,17 +6759,11 @@ class ClientPortfolioReportCollection extends Collection {
|
|
|
6776
6759
|
* @TODO extend from TransactionBaseCollection
|
|
6777
6760
|
*/
|
|
6778
6761
|
class DepreciationCollection extends Collection {
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
*/
|
|
6782
|
-
getWithBusiness() {
|
|
6783
|
-
return this.filter((depreciation) => !!depreciation.business);
|
|
6762
|
+
getSoleTransactions() {
|
|
6763
|
+
return this.filter((depreciation) => depreciation.isSoleTank());
|
|
6784
6764
|
}
|
|
6785
|
-
/**
|
|
6786
|
-
* assets purchased in the current financial year
|
|
6787
|
-
*/
|
|
6788
6765
|
getNew() {
|
|
6789
|
-
return this.filter((depreciation) =>
|
|
6766
|
+
return this.filter((depreciation) => depreciation.isNew());
|
|
6790
6767
|
}
|
|
6791
6768
|
/**
|
|
6792
6769
|
* Get total amount of all depreciations in the collection
|