Journal reports print through X++
Many a time we come across situations where we need to print the journal reports through X++ on some triggers. We have the below simple code through which we can achieve this.
Sales Invoice journal Print:
SalesInvoiceJournalPrint salesInvoiceJournalPrint;
Set set = new Set(Types::Record);
SRSPrintDestinationSettings srsPrintDestinationSettings;
// Add record
set.add(CustInvoiceJour::findRecId(XXXXX));
set.add(CustInvoiceJour::findRecId(XXXXX));
// Set printer settings
srsPrintDestinationSettings = new SRSPrintDestinationSettings();
srsPrintDestinationSettings.printMediumType(SRSPrintMediumType::Screen);
// Initalize
salesInvoiceJournalPrint = SalesInvoiceJournalPrint::construct();
salesInvoiceJournalPrint.parmPrintFormletter(NoYes::Yes);
salesInvoiceJournalPrint.parmUsePrintManagement(false);
salesInvoiceJournalPrint.parmPrinterSettingsFormLetter(srsPrintDestinationSettings.pack());
salesInvoiceJournalPrint.printJournal(set);
The similar code can be used for other journal prints as well
Sales:
- SalesConfirmJournalPrint -
- SalesPickingListJournalPrint
- SalesPackingSlipJournalPrint
- PurchPurchOrderJournalPrint
- PurchReceiptListJournalPrint
- PurchPackingSlipJournalPrint
- PurchInvoiceJournalPrint
This was originally posted here.
*This post is locked for comments