taxtank-core 0.28.111 → 0.28.112
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 +6 -10
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/transaction/transaction.collection.js +6 -1
- package/esm2015/lib/models/transaction/transaction.js +2 -2
- package/esm2015/lib/services/transaction/transaction-calculation.service.js +1 -10
- package/fesm2015/taxtank-core.js +6 -10
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/transaction/transaction.collection.d.ts +1 -0
- package/lib/services/transaction/transaction-calculation.service.d.ts +0 -5
- package/package.json +1 -1
|
@@ -5028,6 +5028,11 @@
|
|
|
5028
5028
|
enumerable: false,
|
|
5029
5029
|
configurable: true
|
|
5030
5030
|
});
|
|
5031
|
+
TransactionCollection.prototype.getUnallocated = function (allocations) {
|
|
5032
|
+
return new TransactionCollection(this.items.filter(function (transaction) {
|
|
5033
|
+
return !transaction.isAllocated(allocations);
|
|
5034
|
+
}));
|
|
5035
|
+
};
|
|
5031
5036
|
TransactionCollection.prototype.getUnallocatedAmount = function (allocations) {
|
|
5032
5037
|
return this.items.reduce(function (sum, transaction) {
|
|
5033
5038
|
return sum + transaction.getUnallocatedAmount(allocations.filterBy('transaction.id', transaction.id));
|
|
@@ -5826,7 +5831,7 @@
|
|
|
5826
5831
|
* Check if transaction is completely allocated
|
|
5827
5832
|
*/
|
|
5828
5833
|
Transaction.prototype.isAllocated = function (allocations) {
|
|
5829
|
-
return this.
|
|
5834
|
+
return this.netAmount === this.getAllocatedAmount(allocations);
|
|
5830
5835
|
};
|
|
5831
5836
|
Transaction.prototype.getAllocatedAmount = function (allocations) {
|
|
5832
5837
|
return allocations.filterBy('transaction.id', this.id).sumBy('amount');
|
|
@@ -18309,15 +18314,6 @@
|
|
|
18309
18314
|
return transaction.isAllocated(allocations);
|
|
18310
18315
|
}));
|
|
18311
18316
|
};
|
|
18312
|
-
/**
|
|
18313
|
-
* Get collection of unallocated transactions
|
|
18314
|
-
* @TODO Alex: consider to move to collection
|
|
18315
|
-
*/
|
|
18316
|
-
TransactionCalculationService.prototype.getUnallocatedTransactions = function (transactions, allocations) {
|
|
18317
|
-
return new TransactionCollection(transactions.items.filter(function (transaction) {
|
|
18318
|
-
return !transaction.isAllocated(allocations);
|
|
18319
|
-
}));
|
|
18320
|
-
};
|
|
18321
18317
|
TransactionCalculationService.prototype.getUnallocatedInvoices = function (invoices, allocations) {
|
|
18322
18318
|
return invoices.filter(function (invoice) {
|
|
18323
18319
|
var invoiceAllocatedAmount = allocations.filterBy('transaction.id', invoice.getTransactionsIds()).sumBy('amount');
|