Function
Function
Hi all!
I have this function:
void order.toDelivery(Orders order)
{
status = true;
for each recRow in order.Add_Product
{
product = Products[ID == recRow.Product_Name];
balanceQuan = product.Available_Stock - recRow.Quantity;
status = true;
if(balanceQuan <= 0)
{
status = false;
}
}
if(status)
{
for each recRow in order.Add_Product
{
product = Products[ID == recRow.Product_Name];
product.Available_Stock=product.Available_Stock - recRow.Quantity;
}
order.Order_Status="Delivered";
It works great!
But if i update the records from "Delivered" to "Pending" again.
It won't add up again, what did i do wrong?
Thanks!