There is always requirement from many customers to Append information to the Navision Reports.
Recently one of my reader have requested me for any such functionality which can help him Append information from Word or Excel Files to Navision Reports.
While searching for solution for such requirement i came across this scope if we can do the same from outside Navision integrating the functionality with Navision.
Although i am not sure how much this post will answere to the requirement raised by my this reader but still this can be an work around to this requirement.
In my previous 2 posts i have answered this approach, Let us assemble all of them to provide solution to this requirement.
Please see my privious posts, i will not repeat already covered part in this post. Here is the link to those posts:
In this post i will be using these functions discussed in above posts.
The Same Setup will be applicable to this post too.
Since we are appending our other information to the Navision Report so we will be at First Step saving our Customer Sales Invoice to PDF.
Later some information which need to be appended to this report is in Word File the path of which is stored on Customer Card.
How to work with Converting Office file to PDF is already discussed in previous post Link shared above.
So Now we have Our Report in PDF and Additional information to be appended to Report is also in PDF. Now it will be easy for us to Merge both the File to have single PDF File.
How to Merge these files is also already discussed in my previous post. Link shared above.
Let us see how we can assemble above both functionality to get our required result.
Approach is very simple, i have created a button on Sales Invoice to Print the Report which performs above discussed process.
On Sales Invoice Page I have added one Button which calls my Function to Print & Merge the document, it takes Invoice No & Sell-to Customer No. as a parameter.
I have created a function to Save the output of Report to PDF, using standard functionality available in Navision.
The PrintSalesInvoice function called from Sales Invoice Page with Invoice No & Sell-to Customer No.
This Function calls the SaveReportAsPDF explained above.
Converts the Office file that is attached on Custommer Card, discussed in previous post Link provided above.
Calls the MergePDFFiles, discussed in previous post Link provided above.
So Now at single click of Button entire task is done for us.
To keep it simple no additional checks and other routine tasks have been included like after task is completed clean up of all temporary files and moving the Result file to desired Location etc.
Now you know the logic so you can tweak the code accordingly to get the functionality working as per your requirement.
Thats all for this post. I will come up with more information in my up coming posts.
You keep you requirements posting to me, i will try my best to answer your queries in form of my future posts, at earliest possible from my end.
Till then kee exploring & Learning.