Export Invoice as PDF from Sage 50
In this article, I am going to give an example of how to save invoices locally to your machine as pdf files. You can find a sample workflow for this on our GitHub site.
Firstly, I am going to export some invoices from Sage 50 and use the resulting file to filter my Export Report task. Then, I am going to use an XML Repeater task to loop over the invoices file. Using InvoiceNumber element from the XML I will assign my criteria to export.
- Output File - invoices.xml - This will drop the exported invoices from Sage 50 into a file named Invoices.xml
- Date Modified - This is the date the modified invoices will be exported out of Sage 50
- Export Modified, New or All - Selecting All will download all of the Invoices inside of the Sage 50 Company, Selecting Modified will export all modified Invoices from the Date Modified.
- Input File - invoices.xml - This is the output file from the previous task
- XPath - Company/Invoices/Invoice - The Path of the folder, the XML repeater will loop through
- Criteria - You will need to create one criteria variable. Set the 'Key' setting to INVOICE_NUMBER and the 'Value' setting to @(Context.Current["InvoiceNumber"]). For the 'Value' setting, make sure you tick the 'Use Razor Engine' option.
- Output File - @(Context.Current["InvoiceNumber"]).pdf - Make sure you tick the 'Use Razor Engine' option.
- Output Type - The Output type of the file in this occasion it will be - pdf
- Report File - The Sage layout file to use to generate the invoice, e.g C:\ProgramData\Sage\Accounts\2015\Company.000\Layouts\INVDIS11.layout
Please note, you can access any element from the XML so you can call your Output File anything you like.
If you have any queries on any of the above, feel free to contact our support team via email at email@example.com or via telephone on 0191 303 7279. Please note, as stated on the Auto Mapper task we do not support any changes to XSLT.