|  | @@ -148,9 +148,34 @@ namespace PRS.Mobile
 | 
	
		
			
				|  |  |                      transaction.Target.LocationCode = _viewModel.Target.Code;
 | 
	
		
			
				|  |  |                      transaction.Target.LocationDescription = _viewModel.Target.Description;
 | 
	
		
			
				|  |  |                      transaction.Allocations = shell.Allocations;
 | 
	
		
			
				|  |  | +                    
 | 
	
		
			
				|  |  | +                    var others = _viewModel.Transactions.Where(x =>
 | 
	
		
			
				|  |  | +                        x.Source.LocationID == shell.LocationID
 | 
	
		
			
				|  |  | +                        && x.Source.StyleID == shell.StyleID
 | 
	
		
			
				|  |  | +                        && x.ProductID == shell.ProductID
 | 
	
		
			
				|  |  | +                        && x.DimensionsUnitID == shell.DimensionsUnitID
 | 
	
		
			
				|  |  | +                        && x.DimensionsHeight == shell.DimensionsHeight
 | 
	
		
			
				|  |  | +                        && x.DimensionsWidth == shell.DimensionsWidth
 | 
	
		
			
				|  |  | +                        && x.DimensionsLength == shell.DimensionsLength
 | 
	
		
			
				|  |  | +                        && x.DimensionsQuantity == shell.DimensionsQuantity
 | 
	
		
			
				|  |  | +                        && x.DimensionsWeight == shell.DimensionsWeight).ToArray();
 | 
	
		
			
				|  |  | +                    
 | 
	
		
			
				|  |  | +                    var allocations = new List<StockTransactionAllocation>();
 | 
	
		
			
				|  |  | +                    foreach (var alloc in shell.Allocations)
 | 
	
		
			
				|  |  | +                    {
 | 
	
		
			
				|  |  | +                        var newalloc = new StockTransactionAllocation();
 | 
	
		
			
				|  |  | +                        newalloc.ID = alloc.ID;
 | 
	
		
			
				|  |  | +                        newalloc.Description = alloc.Description;
 | 
	
		
			
				|  |  | +                        newalloc.Quantity = alloc.Quantity;
 | 
	
		
			
				|  |  | +                        foreach (var other in others)
 | 
	
		
			
				|  |  | +                            newalloc.Quantity -= other.Allocations.Where(x => x.ID == alloc.ID).Sum(x => x.Quantity);
 | 
	
		
			
				|  |  | +                        newalloc.Maximum = newalloc.Quantity;
 | 
	
		
			
				|  |  | +                        allocations.Add(newalloc);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    transaction.Allocations = allocations.ToArray();
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  
 | 
	
		
			
				|  |  | -                var popup = new TransferEdit(transaction);
 | 
	
		
			
				|  |  | +                var popup = new TransferEdit(transaction, _viewModel.Transactions);
 | 
	
		
			
				|  |  |                  popup.TransactionSaved += (o,e) =>
 | 
	
		
			
				|  |  |                  {
 | 
	
		
			
				|  |  |                      shell.Parent.Transactions?.Add(transaction);
 | 
	
	
		
			
				|  | @@ -269,7 +294,7 @@ namespace PRS.Mobile
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  |              if ((sender as MobileCard)?.BindingContext is StockTransaction transaction)
 | 
	
		
			
				|  |  |              {
 | 
	
		
			
				|  |  | -                var popup = new TransferEdit(transaction);
 | 
	
		
			
				|  |  | +                var popup = new TransferEdit(transaction, _viewModel.Transactions);
 | 
	
		
			
				|  |  |                  //popup.TransactionSaved += (o, e) => _viewModel.Transactions?.Add(transaction);
 | 
	
		
			
				|  |  |                  Navigation.PushAsync(popup);
 | 
	
		
			
				|  |  |              }
 |