SalesLine.SETFILTER("Document Type",'%1',SalesLine."Document Type"::Order); SalesLine.SETRANGE(SalesLine."No.",WhseShipLine."Item No."); SalesLine.SETRANGE("Document No.",WhseShipLine."Source No."); IF SalesLine.FINDSET THEN SalesPrice.RESET; SalesPrice.SETRANGE(SalesPrice."Item No.",SalesLine."No."); SalesPrice.SETRANGE(SalesPrice."Sales Code",SalesLine."Customer Price Group"); SalesPrice.SETFILTER(SalesPrice."Sales Type",'%1',SalesPrice."Sales Type"::"Customer Price Group"); IF SalesPrice.FINDFIRST THEN BEGIN SalesPriceload.COPYFILTERS(SalesPrice); SalesPriceload.FINDFIRST; REPEAT IF (SalesPriceload.NEXT = 0) THEN BEGIN CLEAR(SalesPriceload); IF (SalesPrice."Ending Date" <> 0D) THEN BEGIN IF (SalesLine."Shipment Date" >SalesPrice."Starting Date") AND (SalesLine."Shipment Date" > SalesPrice."Ending Date") THEN ERROR('Sales price of Item no %1 on Order : %2 expired.',SalesPrice."Item No.",SalesLine."Document No."); END; END; UNTIL SalesPrice.NEXT=0; END;Please help me. Thanks so much.
Comments
Then you can do something like this:
Im write code And call procedure But it not work. Please help me
Thanks so much
Where does the code fail? Are you expecting it to error?
Run the debugger and check the values of each variable, for instance check if the Sales Line is correctly passed to the function. There might be something not quite right with the filtering.
After I debug then result
Item Code := blank
"Sales Code" := Customer (No filter "Customer Price Group")
Also, change the Error text, if you can't find a valid Sales Price, then the variable "Sales Price" will be empty, so the field Sales Price."Starting Date" & SalesPrice."Ending Date" will be blank. So they are not useful for your error message.
The price is (usually) binding at the time when customer places an order, not at the point in time when goods are leaving the warehouse.
Think abount following scenario - a customer ordered Item A on Day 1 and the sales price on his ordrr confirmation is X.
You don't have the item available in the system, YOUR order to the vendor is delayed, and item is received in your warehouse and ready to ship after the price expiry date. What would you do? Don't ship but contact customer telling him that they need to pay extra because YOUR delivery has been delayed?
I'd think it is illegal to force customer to pay different price than they knew when they placed the order. Therefore checking sales prices at the time of shipping does not make sense.
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03