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
|
@@ -3738,14 +3738,14 @@
|
|
|
3738
3738
|
};
|
|
3739
3739
|
Object.defineProperty(TransactionBase.prototype, "amountWithGst", {
|
|
3740
3740
|
get: function () {
|
|
3741
|
-
return this.isGST ?
|
|
3741
|
+
return this.isGST ? this.amount * ChartAccounts.GSTCoefficient : this.amount;
|
|
3742
3742
|
},
|
|
3743
3743
|
enumerable: false,
|
|
3744
3744
|
configurable: true
|
|
3745
3745
|
});
|
|
3746
3746
|
Object.defineProperty(TransactionBase.prototype, "gstAmount", {
|
|
3747
3747
|
get: function () {
|
|
3748
|
-
return
|
|
3748
|
+
return this.amountWithGst - this.amount;
|
|
3749
3749
|
},
|
|
3750
3750
|
enumerable: false,
|
|
3751
3751
|
configurable: true
|
|
@@ -3758,6 +3758,9 @@
|
|
|
3758
3758
|
configurable: true
|
|
3759
3759
|
});
|
|
3760
3760
|
Object.defineProperty(TransactionBase.prototype, "grossAmount", {
|
|
3761
|
+
/**
|
|
3762
|
+
* base grossAmount, extends in child classes
|
|
3763
|
+
*/
|
|
3761
3764
|
get: function () {
|
|
3762
3765
|
return this.amount + this.gstAmount;
|
|
3763
3766
|
},
|
|
@@ -3766,7 +3769,7 @@
|
|
|
3766
3769
|
});
|
|
3767
3770
|
Object.defineProperty(TransactionBase.prototype, "grossClaimAmount", {
|
|
3768
3771
|
get: function () {
|
|
3769
|
-
return
|
|
3772
|
+
return this.grossAmount * this.claimRatio;
|
|
3770
3773
|
},
|
|
3771
3774
|
enumerable: false,
|
|
3772
3775
|
configurable: true
|
|
@@ -4478,8 +4481,7 @@
|
|
|
4478
4481
|
var _a, _b;
|
|
4479
4482
|
return classTransformer.plainToClass(Transaction, Object.assign(params, this, {
|
|
4480
4483
|
amount: -((_a = this.currentYearForecast) === null || _a === void 0 ? void 0 : _a.amount) || 0,
|
|
4481
|
-
claimAmount: ((_b = this.currentYearForecast) === null || _b === void 0 ? void 0 : _b.claimAmount) || 0,
|
|
4482
|
-
date: this.purchaseDate
|
|
4484
|
+
claimAmount: -((_b = this.currentYearForecast) === null || _b === void 0 ? void 0 : _b.claimAmount) || 0,
|
|
4483
4485
|
}));
|
|
4484
4486
|
};
|
|
4485
4487
|
Object.defineProperty(Depreciation.prototype, "claimAmount", {
|
|
@@ -4495,26 +4497,21 @@
|
|
|
4495
4497
|
});
|
|
4496
4498
|
Object.defineProperty(Depreciation.prototype, "amountWithGst", {
|
|
4497
4499
|
get: function () {
|
|
4498
|
-
// only new assets
|
|
4499
|
-
if (
|
|
4500
|
-
return
|
|
4500
|
+
// gst applies only to new assets
|
|
4501
|
+
if (this.isNew()) {
|
|
4502
|
+
return _super.prototype.amountWithGst;
|
|
4501
4503
|
}
|
|
4502
|
-
return
|
|
4503
|
-
},
|
|
4504
|
-
enumerable: false,
|
|
4505
|
-
configurable: true
|
|
4506
|
-
});
|
|
4507
|
-
Object.defineProperty(Depreciation.prototype, "grossAmount", {
|
|
4508
|
-
/**
|
|
4509
|
-
* @TODO temporary hack, in future backend should return negative numbers
|
|
4510
|
-
*/
|
|
4511
|
-
get: function () {
|
|
4512
|
-
var _a;
|
|
4513
|
-
return -((_a = this.currentYearForecast) === null || _a === void 0 ? void 0 : _a.amount) - this.gstAmount;
|
|
4504
|
+
return this.amount;
|
|
4514
4505
|
},
|
|
4515
4506
|
enumerable: false,
|
|
4516
4507
|
configurable: true
|
|
4517
4508
|
});
|
|
4509
|
+
/**
|
|
4510
|
+
* assets purchased in the current financial year
|
|
4511
|
+
*/
|
|
4512
|
+
Depreciation.prototype.isNew = function () {
|
|
4513
|
+
return new FinancialYear(this.purchaseDate).year === new FinancialYear().year;
|
|
4514
|
+
};
|
|
4518
4515
|
return Depreciation;
|
|
4519
4516
|
}(Depreciation$1));
|
|
4520
4517
|
Depreciation.WRITTEN_OFF_THRESHOLD = 300;
|
|
@@ -4745,12 +4742,12 @@
|
|
|
4745
4742
|
Transaction.prototype.isAllocated = function (allocations) {
|
|
4746
4743
|
return this.grossAmount === this.getAllocatedAmount(allocations);
|
|
4747
4744
|
};
|
|
4748
|
-
/**
|
|
4749
|
-
* Get transaction allocated amount
|
|
4750
|
-
*/
|
|
4751
4745
|
Transaction.prototype.getAllocatedAmount = function (allocations) {
|
|
4752
4746
|
return allocations.filterBy('transaction.id', this.id).sumBy('amount');
|
|
4753
4747
|
};
|
|
4748
|
+
Transaction.prototype.getAllocatedClaimAmount = function (allocations) {
|
|
4749
|
+
return this.getAllocatedAmount(allocations) * this.claimRatio;
|
|
4750
|
+
};
|
|
4754
4751
|
/**
|
|
4755
4752
|
* Get transaction unallocated amount
|
|
4756
4753
|
*/
|
|
@@ -7868,18 +7865,12 @@
|
|
|
7868
7865
|
if (depreciations === void 0) { depreciations = []; }
|
|
7869
7866
|
return _super.call(this, __spreadArray(__spreadArray([], __read(transactions)), __read(depreciations.map(function (depreciation) { return depreciation.toTransaction(); })))) || this;
|
|
7870
7867
|
}
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
*/
|
|
7874
|
-
TransactionCollection.prototype.getWithBusiness = function () {
|
|
7875
|
-
return this.filter(function (transaction) { return !!transaction.business; });
|
|
7868
|
+
TransactionCollection.prototype.getSoleTransactions = function () {
|
|
7869
|
+
return this.filter(function (transaction) { return transaction.isSoleTank(); });
|
|
7876
7870
|
};
|
|
7877
7871
|
Object.defineProperty(TransactionCollection.prototype, "amount", {
|
|
7878
|
-
/**
|
|
7879
|
-
* Get total amount of all transactions in the collection
|
|
7880
|
-
*/
|
|
7881
7872
|
get: function () {
|
|
7882
|
-
return
|
|
7873
|
+
return this.sumBy('amount');
|
|
7883
7874
|
},
|
|
7884
7875
|
enumerable: false,
|
|
7885
7876
|
configurable: true
|
|
@@ -8101,17 +8092,17 @@
|
|
|
8101
8092
|
return chartData;
|
|
8102
8093
|
};
|
|
8103
8094
|
/**
|
|
8104
|
-
* user pays GST only from allocated part
|
|
8105
|
-
*
|
|
8106
|
-
* @param allocations
|
|
8095
|
+
* user pays GST only from allocated part (or paid) of income
|
|
8107
8096
|
*/
|
|
8108
|
-
TransactionCollection.prototype.
|
|
8109
|
-
var
|
|
8110
|
-
var allocatedGST = 0;
|
|
8097
|
+
TransactionCollection.prototype.calculateAllocatedClaimAmount = function (allocations) {
|
|
8098
|
+
var allocatedClaimAmount = 0;
|
|
8111
8099
|
this.filterBy('isGST', true).toArray().forEach(function (transaction) {
|
|
8112
|
-
|
|
8100
|
+
allocatedClaimAmount += transaction.getAllocatedClaimAmount(allocations);
|
|
8113
8101
|
});
|
|
8114
|
-
return
|
|
8102
|
+
return allocatedClaimAmount;
|
|
8103
|
+
};
|
|
8104
|
+
TransactionCollection.prototype.calculateAllocatedGST = function (allocations) {
|
|
8105
|
+
return this.calculateAllocatedClaimAmount(allocations) * ChartAccounts.GSTRatio;
|
|
8115
8106
|
};
|
|
8116
8107
|
TransactionCollection.prototype.getAllocatedAmount = function (allocations) {
|
|
8117
8108
|
return allocations.getByTransactionsIds(this.getIds()).sumBy('amount');
|
|
@@ -8175,23 +8166,11 @@
|
|
|
8175
8166
|
function TransactionBaseCollection() {
|
|
8176
8167
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
8177
8168
|
}
|
|
8178
|
-
TransactionBaseCollection.prototype.filterByBusiness = function (business) {
|
|
8179
|
-
return this.filterBy('business.id', business.id);
|
|
8180
|
-
};
|
|
8181
8169
|
TransactionBaseCollection.prototype.getClaimAmountByBusinessId = function (businessId) {
|
|
8182
8170
|
return +this.filterBy('business.id', businessId).items.map(function (transaction) { return transaction instanceof Depreciation ? -transaction.claimAmount : transaction['claimAmount']; }).reduce(function (sum, claimAmount) { return sum + claimAmount; }, 0).toFixed(2);
|
|
8183
8171
|
};
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
*/
|
|
8187
|
-
TransactionBaseCollection.prototype.getWithBusiness = function () {
|
|
8188
|
-
return this.filter(function (transaction) { return !!transaction.business; });
|
|
8189
|
-
};
|
|
8190
|
-
TransactionBaseCollection.prototype.getIncomeTransactions = function () {
|
|
8191
|
-
return this.create(this.items.filter(function (transaction) { return transaction.isIncome(); }));
|
|
8192
|
-
};
|
|
8193
|
-
TransactionBaseCollection.prototype.getExpenseTransactions = function () {
|
|
8194
|
-
return this.create(this.items.filter(function (transaction) { return transaction.isExpense() && !transaction.isInterest(); }));
|
|
8172
|
+
TransactionBaseCollection.prototype.getSoleTransactions = function () {
|
|
8173
|
+
return this.filter(function (transaction) { return transaction.isSoleTank(); });
|
|
8195
8174
|
};
|
|
8196
8175
|
return TransactionBaseCollection;
|
|
8197
8176
|
}(Collection));
|
|
@@ -8591,17 +8570,11 @@
|
|
|
8591
8570
|
function DepreciationCollection() {
|
|
8592
8571
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
8593
8572
|
}
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
*/
|
|
8597
|
-
DepreciationCollection.prototype.getWithBusiness = function () {
|
|
8598
|
-
return this.filter(function (depreciation) { return !!depreciation.business; });
|
|
8573
|
+
DepreciationCollection.prototype.getSoleTransactions = function () {
|
|
8574
|
+
return this.filter(function (depreciation) { return depreciation.isSoleTank(); });
|
|
8599
8575
|
};
|
|
8600
|
-
/**
|
|
8601
|
-
* assets purchased in the current financial year
|
|
8602
|
-
*/
|
|
8603
8576
|
DepreciationCollection.prototype.getNew = function () {
|
|
8604
|
-
return this.filter(function (depreciation) { return
|
|
8577
|
+
return this.filter(function (depreciation) { return depreciation.isNew(); });
|
|
8605
8578
|
};
|
|
8606
8579
|
Object.defineProperty(DepreciationCollection.prototype, "amount", {
|
|
8607
8580
|
/**
|