Vendor Current Valid Trade agreement price on Planned order lines

Hi All,

I want to show the  current/valid Vendor’s trade agreement price based on the given Vendor, order date, and quantity of the planned order line(Master Plannning -> Planned orders). How can I achieve this  using X++ code?.

Thanks in advance...