HI,
In Nav 201, I am facing a problem in purchase bill booking. Means one of my team member has done the posting of purchase invoice in May month & GRN posted in june month. Need to block the posting dates. Hence request you to kindly support cal code validation on date.
0
Answers
Presuming you're invoicing from a PO. If you use get receipts from a purchase invoice.
Code needs to be different, on another place.
OnRun(VAR Rec : Record "Purchase Header")
IF Invoice THEN BEGIN
PurchRcptHdr.SETCURRENTKEY("Order No.","Posting Date");
PurchRcptHdr.SETRANGE("Order No.","No.");
IF PurchRcptHdr.FINDLAST THEN
IF PurchRcptHdr."Posting Date" > "Posting Date" THEN
ERROR('Receipt %1 has been posted on %2',PurchRcptHdr."no.",PurchRcptHdr."Posting Date");
END;
This makes it impossible to post your purchase invoice from a PO at a date preceeding the GRN.
Note, fixing this for per line invoicing and receiving needs more advanced C/AL coding.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!