Hi,
I have a form "movements" and another form "Stock" with different locations.
When user enters 200 for "Item A" in form "movements" I would like to reduce the qty of "Item A" in form Stock for that item and location, and increase the qty of Item A in another location.
Stock type will be chosen on the movements form. Stock will always originate in the same location and end in same destination.
I tried the following for on submit, on success:
if (input.Stock_Type = "X")
{
//fetch stock from origin location of type x
for each StockUpdate in Stock [ID = 943839000000061039]
{
//reduce values in location by amount input to move
StockUpdate.Value = (StockUpdate.Value - input.Value);
}
//fetch stock from destination of same type X
for each StockUpdateDestination in Stock [ID = 943839000000072003]
{
//increase values in destination by amount input to move location
StockUpdateDestination.Value = ( StockUpdateDestination.Value + input.Value);
}
}
//End if
The above does not give errors but also does not perform the add and subtracts as required. I check my stock sheet after submission.
Any help would be much appreciated. I may not be using the best method to perform this operation and will happily change tack if a smoother way of doing this exists.
Regards,
Robbie