Leadtime BAQ calculation

Just looking for some pointers here. I am trying to replicate the Epicor logic behind calculating leadtime on PO suggestions. We use Leadtime on the Supplier Price list and also the Supplier Partnum (20% of parts). It’s not a calculation of max leadtime but the entry, could be a lower value, on Supplier Partnum overrides what is on Supplier Partnum.

@Matt_Belshaw A calculated field case when price list leadtime <> 0 then use it else use partnum lead time

1 Like

Thanks Greg but I may not have highlighted an item I’m experiencing. Staff are putting leadtimes on both the Supplier Price list entry e.g. 20 days and the supplier part number of 10 days. In this case the PO suggestion gets generated as 10 days. It seems to be more a IF EXISTS SupplierPartNumLeadtime then use that.

sorry I glossed over the supplier partnum. You can have as many cases as you need. The first match will be used so order is important.

Case 
when supplier partnum leadtime <> 0 then supplier part num leadtime
when supplier price list leadtime <> 0 then supplier price list leadtime
when part number leadtime <> 0 then part number leadtime
else 0
end
1 Like

Thanks Greg. I think that will set me along the right path.

Regards

Matt

1 Like

Yep, that did it. Got a bit worried if not having a PartXRefVend_LeadTime would cause an issue i.e. if it wasn’t there is it NULL rather than 0 but all seems fine. Noted on the order of when statements. This worked for me (we don’t put leadtime on part):

Case 
when SubQuery3.PartXRefVend_LeadTime <> 0 then SubQuery3.PartXRefVend_LeadTime
when SubQuery3.VendPart1_LeadTime <> 0 then SubQuery3.VendPart1_LeadTime
else 0
end

Many thanks Greg

After reviewing in full, a few tweaks. Now using:

CASE
WHEN PartPlant.VendorNum = 0 THEN 0
WHEN PartXRefVend.LeadTime >= 0 THEN PartXRefVend.LeadTime
WHEN VendPart1.LeadTime >= 0 THEN VendPart1.LeadTime
ELSE 0
END

1 Like