how to write coding for blocking purchase invoice booking date prior to GRN booking date
shwetha
Member Posts: 7
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.
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
Best Answer
-
Add something like this to CU90 and add key "Order No.","Posting Date" to purch receipt hdr:
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.
5
Answers
-
Add something like this to CU90 and add key "Order No.","Posting Date" to purch receipt hdr:
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.
5 -
[Topic moved from 'NAV Tips & Tricks' forum to 'NAV Three Tier' forum]
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
