Skip to Content
0
Former Member
Feb 01, 2016 at 01:10 PM

SP Required: Unit Price should not be lower than Price list

18 Views

Hi All,

There is a need to block the sales order if the unit price of item is lower than any value in price list.

For ex. if Item A has 3 price lists:

Item A

Price List X with unit price 100

Price List Y with unit price 150

Price List Z with unit price 200

The system should block the addition of sales order if the user enters 99.

Is this possible? What would be the logic in SP?

I was able to check from a particular price list but how to compare all?

IF @transaction_type in ('A','U') AND (@Object_type = N'17')

begin

if exists(select T.docentry from ORDR T

inner join RDR1 U on T.docentry = U.DocEntry

where T.docentry = @list_of_cols_val_tab_del and

U.PriceBefDi <> (select itm1.price

from OITM

inner join ITM1 on ITM1.itemcode = OITM.itemcode

inner join OPLN on OPLN.listnum = ITM1.pricelist

where OITM.itemcode = U.ItemCode and opln.listnum = U.U_Pricelist))

begin

SET @error = 1

SET @error_message = N'Please enter Unit Price as per selected contract'

end

end

Thanks,

Joseph