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.
@@ -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.grossAmount === this.getAllocatedAmount(allocations);
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');