In the Inventory form, I have 12 stock location for each Part. That form is updated when Parts are received from Purchase orders.
When my Technicians use a part (From the Parts Used Form), the quantity is reduced in the Inventory Form for their location, there for maintaining a stock level. I am trying to create a script, that when they select the part, enter a quantity, their location, it checks to insure they have inventory in their location.
I have listed the script built, but, it only checks the first location entry.
My theory was to Fetch the part number from the Inventory, if the location selected was "<=0", then send an "Alert" and "Cancel Submit"
qty = Inventory [Product_Number == input.Part_Number1];
loctrk1= (qty.trk1 - input.trk1);
loctrk2 = (qty.trk2 - input.trk2);
loctrk3= (qty.trk3 - input.trk3);
loctrk4 = (qty.trk4 - input.trk4);
loctrk5 = (qty.trk5 - input.trk5);
loctrk6 = (qty.trk6 - input.trk6);
loctrk7 = (qty.trk7 - input.trk7);
loctrk8= (qty.trk8 - input.trk8);
loctrk9= (qty.trk9 - input.trk9);
loctrk10 = (qty.trk10 - input.trk10);
loctrk11 = (qty.trk11 - input.trk11);
loctrk12= (qty.trk12 - input.trk12);
loctrk13 = (qty.trk13 - input.trk13);
loctrk14= (qty.trk14 - input.trk14);
loctrk15= (qty.trk15 - input.trk15);
if (loctrk1 <= 0)
{
alert "You have" + " " + qty.trk1 + " " + "in stock, Please choose another location. Thank You";
cancel submit;
}
if (loctrk2 <= 0)
{
alert "You have" + " " + qty.trk2+ " " + "in stock, Please choose another location. Thank You";
cancel submit;
}
if (loctrk3 <= 0)
{
alert "You have" + " " + qty.trk3+ " " + "in stock, Please choose another location. Thank You";
cancel submit;
}
if (loctrk4 <= 0)
{
alert "You have" + " " + qty.trk4 + " " + "in stock, Please choose another location. Thank You";
cancel submit;
}
if (loctrk5 <= 0)
{
alert "You have" + " " + qty.trk5+ " " + "in stock, Please choose another location. Thank You";
cancel submit;
}
if (loctrk6 <= 0)
{
alert "You have" + " " + qty.trk6 + " " + "in stock, Please choose another location. Thank You";
cancel submit;
}
if (loctrk7 <= 0)
{
alert "You have" + " " + qty.trk7 + " " + "in stock, Please choose another location. Thank You";
cancel submit;
}
if (loctrk8 <= 0)
{
alert "You have" + " " + qty.trk8 + " " + "in stock, Please choose another location. Thank You";
cancel submit;
}
if (loctrk9 <= 0)
{
alert "You have" + " " + qty.trk9 + " " + "in stock, Please choose another location. Thank You";
cancel submit;
}
if (loctrk10 <= 0)
{
alert "You have" + " " + qty.trk10 + " " + "in stock, Please choose another location. Thank You";
cancel submit;
}
if (loctrk11 <= 0)
{
alert "You have" + " " + qty.trk11+ " " + "in stock, Please choose another location. Thank You";
cancel submit;
}
if (loctrk12 <= 0)
{
alert "You have" + " " + qty.trk12+ " " + "in stock, Please choose another location. Thank You";
cancel submit;
}