Wednesday, June 9, 2021

Print sales invoice report with current print destination settings in Dynamics 365 finance and operations

Just want to post, how to print sales invoice report with current print destination settings in x++. hope you find this helpful and will come up with another interesting blog post

class SalesInvoiceTst

{

    /// <summary>

    /// Runs the class with the specified arguments.

    /// </summary>

    /// <param name = "_args">The specified arguments.</param>

    public static void main(Args _args)

    {

        SalesFormLetter salesFormLetter;

        CustInvoiceJour custInvoiceJour;


        select firstonly custInvoiceJour

            where custInvoiceJour.SalesId == '2000-000001';


        SalesInvoiceJournalPrint journalprint = SalesInvoiceJournalPrint::construct();

        salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);

        SalesFormLetter::getPrinterSettingsFormletter(DocumentStatus::Invoice);

        journalprint.parmPrinterSettingsFormLetter(salesFormLetter.printerSettingsFormletter());

        custInvoiceJour.printJournal(journalprint);

    }

}

No comments:

Post a Comment