Hi Guys,
I have a specific requirement that whenever a Purchase Order is posted, (the user pushes the POST button in the RTC) a PDF of that order is saved.
I'm using the brilliant SAVEASPDF which works great, but can't for the life of me figure out the syntax! ](*,)
I'm in the Object Designer > Page > Purchase Order > Design > View > Actions > F9 on P&ost
Just after
.
.
.
CODEUNIT.RUN(CODEUNIT::"Purch.-Post (Yes/No)",Rec);
REPORT.SAVEASPDF(REPORT::"Order",'C:\temp\poimage.pdf',Rec);
As I mentioned, works fine, but obviously I end up with the entire Order report. What would the C/AL need to look like to just save the PDF of that order?
Thanks in advance!
0
Comments
take a variable and get the document no from rec before calling the Codeunit and use that variable in saveaspdf function..
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
First of all - you need to print the order before you post it, as invoicing might delete it.
Secondly - you need to set a filter on the variable passed to the report, otherwise it will print all records
Finally - if you wish to print the invoice (and not the order) you will need to find somewhere inside the posting codeunit, where the invoice is fully created and the number is known.
Peter
END ELSE BEGIN
PurchHeader.RESET;
PurchHeader.SETRANGE("Document Type",PurchHeader."Document Type"::Order);
PurchHeader.SETRANGE("No.","No.");
IF PurchHeader.FINDFIRST THEN;
CODEUNIT.RUN(CODEUNIT::"Purch.-Post (Yes/No)",Rec);
REPORT.SAVEASPDF(REPORT::Order,'C:\NAV\Purchase.pdf',PurchHeader);
END;
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav