Saturday, March 14, 2015

Dynamics AX 2012 Multiple Invoices Printing - طباعة مجموعة من الفواتير دفعة واحدة ببرنامج AX 2012

This topic shows how to customize Microsoft Dynamics AX 2012 to allow users printing multiple invoices simply by selecting them and directly sending them to the printer, instead of printing them one by one.

هذا المقال يشرح طريقة تعديل برنامج AX 2012 ليسمح بتحديد عدد كبير من الفواتير و إرسالها مباشرة للطابعة بدلا من طباعتها واحدة تلو الأخرى.

The following Video contains all the steps for customizing the invoice journal screen of the AR module:

الفيديو التالي يشرح خطوات تعديل شاشة الفواتير لتقوم بتلك المهمة:


The code used for such customization is as follows:

الكود المستخدم هو كالتالي:

//1) Add the following function to the methods of the "Use print management" menu item of the "Invoice Journal" Inguiry Screen.....................................
Public void PrintSingleInvoice(RecId _RecId)
{
    PrintJobSettings    printJobSettings = new PrintJobSettings();
    SalesInvoiceJournalPrint salesInvoiceJournalPrint;
    Set set = new Set(Types::Record);
    SRSPrintDestinationSettings srsPrintDestinationSettings;
    // Add record
    set.add(CustInvoiceJour::findRecId(_RecId));
    // Set printer settings
    srsPrintDestinationSettings = new SRSPrintDestinationSettings();
    srsPrintDestinationSettings.printMediumType(SRSPrintMediumType::Printer);
    srsPrintDestinationSettings.numberOfCopies(1);
    srsPrintDestinationSettings.printerName(printJobSettings.deviceName());
    // Initalize
    salesInvoiceJournalPrint = SalesInvoiceJournalPrint::construct();
    salesInvoiceJournalPrint.parmPrintFormletter(NoYes::Yes);
    salesInvoiceJournalPrint.parmUsePrintManagement(false);
 salesInvoiceJournalPrint.parmPrinterSettingsFormLetter(srsPrintDestinationSettings.pack());
    // Print
    salesInvoiceJournalPrint.printJournal(set);
}


//2) modify the clicked method of the "Use print management" menu item of the "Invoice Journal" Inguiry Screen as follows:.........................................
            //21) Comment the following line..
            //new MenuFunction(menuitemOutputStr(SalesInvoice), MenuItemType::Output).run(args);
            //22) Add the following Line:
            this.PrintSingleInvoice(custInvoiceJourLocal.RecId);


How To Create LSMW Program in SAP

The below video will show detailed example of creating simple LSMW program / recording in SAP.