I have a few scripts on column post validates, mostly watching the order quantity. I had them only running for standard orders, however this was an issue when the order starts as a quote. One script is a calculation to mark the udf quantity pulled (basically what we have in stock). I am thinking about removing the part of the script to check if it is a standard order and fire off on quotes as well. However, when the order does convert over to a standard order I think we need to loop through the lines and run the calculations again to take into account the changing inventory levels. This last part I do not know how to go about, edit this script or does this need a different script to run? I was having issues with scripts running and ending up with correct value in the udf so I had to run two scripts first one on the column post val quantity orders then the second script on a table pre write, might be a better way to condense into one.
'qty pulled calculation if using the BO function looking at available qty through Sage 'column-postval qty ordered rVal = 0 QBO = 0 QORD = 0 QPULLED = 0 sType = "" sItemType = "" nAPNo = "" nVenNo = "" rVal = oHeaderObj.GetValue("OrderType$", sType) r=oScript.DebugPrint("OrderType: " & sType) if sType = "S" then rVal = oBusObj.GetValue("ItemType$", sItemType) r=oScript.DebugPrint("ItemType: " & sItemType) if trim(sItemType) = "1" then rVal = oBusObj.GetValue("QuantityOrdered", QORD) r=oScript.DebugPrint("QuantityOrdered: " & QORD) rVal = oBusObj.GetValue("QuantityBackordered", QBO) r=oScript.DebugPrint("QuantityBackordered: " & QBO) if QBO = 0 then rVal = oBusObj.SetValue("UDF_QTY_PULLED", QORD) rVal = oBusObj.SetValue("APDivisionNo$", nAPNo) rVal = oBusObj.SetValue("VendorNo$", nVenNo) end if if QBO > 0 then QPULLED = QORD-QBO rVal = oBusObj.SetValue("UDF_QTY_PULLED", QPULLED) end if end if end if
'fix qty pulled field for qty pulled script colum post val qty bo rVal = 0 QPULLED = 0 QPNEW = 0 QORD = 0 QBO = 0 sType = "" sItemType = "" APNo = "" VenNo = "" rVal = oHeaderObj.GetValue("OrderType$", sType) r=oScript.DebugPrint("OrderType: " & sType) if sType = "S" then rVal = oBusObj.GetValue("ItemType$", sItemType) r=oScript.DebugPrint("ItemType: " & sItemType) if trim(sItemType) = "1" then rVal = oBusObj.GetValue("UDF_QTY_PULLED", QPULLED) r=oScript.DebugPrint("qtypulled: " & QPULLED) rVal = oBusObj.GetValue("QuantityBackordered", QBO) r=oScript.DebugPrint("QTYbo: " & QBO) rVal = oBusObj.GetValue("QuantityOrdered", QORD) r=oScript.DebugPrint("QTYORDERED: " & QORD) if QBO = 0 then rVal = oBusObj.SetValue("APDivisionNo$", APno) rVal = oBusObj.SetValue("VendorNo$", VenNo) if QBO > 0 then QPNEW = QORD-QBO rVal = oBusObj.SetValue("UDF_QTY_PULLED", QPNEW) end if end if end if end if