web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Printing vendor invoices directly to a printer?

(0) ShareShare
ReportReport
Posted on by 427

Hi everyone,

This one should have been simple but the dark AX truth is... it is not simple!

We have a requirement to print series of vendor invoices (VendInvoiceDocument report) directly to a printer.  The same report coming out of: Vendor - Inquiries - Journals - Invoice journals.

Unfortunately, the way this one is designed, it will always go to the screen, ignoring the vendor invoice document setting that can be used. The code relies on an undocumented Boolean member of the FormLetterReport class, useUserDefinedDestinations, to route printing to a printer instead of the screen.

In the loadPrintettings method of the FormLetterReport class, I see this code:

if(!this.parmUseUserDefinedDestinations())

{

printSettingDetail.parmPrintJobSettings().printMediumType(SRSPrintMediumType::Screen);

}

So no matter what printMediumType et Device you have assigned to the settings, it will throw the invoice on the screen!

I can hardcode the value 'true' in VendInvoiceDocumentController.initFormLetterReport() but this is not very clean...

Does anyone know a way to direct vendor invoices to a printer? It seems odd that the whole AX standard of document handling is bypassed for this document

Regards,

Eric

*This post is locked for comments

I have the same question (0)
  • Murthy2601@hotmail.com Profile Picture
    637 on at

    Hi,

    You may setup the Print Management for all the Vendors to print to the default to a local or a network printer (if multiple people are printer).

    While printing click on "Use Print Management" This will directly print to printer.

    Regards,

    Narasimha

  • Arkadia2 Profile Picture
    427 on at

    Hello Narashima,

    No, this is not working. Is it ignored by the FormLetterReport class, in the loadPrintSettings method. Try it for yourself using the vendor invoices inquiries (Vendor - Inquiries - Journals - Invoice journals.), you will always get the invoice on screen, no matter what you setup in the print management.

    Regards,

    Eric

  • Verified answer
    Arkadia2 Profile Picture
    427 on at

    Well, I found a workaround, although it requires a bit of programming. If anyone ever need to perform a similar change, here's what I did:

    table VendInvoiceJournal, method PrintJournal: add a Boolean parameter. in the method, replace the original line of code:

    purchInvoiceMenu = new MenuFunction(menuitemOutputStr(purchInvoice),MenuItemType::Output);

    by

               if(InvoiceAnnexPrint)

               {

                   purchInvoiceMenu = new MenuFunction(menuitemOutputStr(new_purchInvoice),MenuItemType::Output);

               }

               else

               {

                   purchInvoiceMenu = new MenuFunction(menuitemOutputStr(purchInvoice),MenuItemType::Output);

               }

    the new menu item points a to class derived from VendInvoiceDocumentController. In this derived class, the main method initializes an internal Boolean member to true. this member must be defined in VendInvoiceDocumentController, not in the derived class.

    In VendInvoiceDocumentController::initFormLetterReport, I then initialize the obscure formLetterReport.useUserDefinedDestinations to the value of the new Boolean member:

    formLetterReport.parmUseUserDefinedDestinations(new_ForceUseUserDefinedDestinations);

    There is nothing to change in the FormLetterReport class. When the loadPrintSettings method is executed, I have now circumvented this section of code by forcing parmUseUserDefinedDestinations to true. Note the comment, it seems like it is intended for this report to NOT go directly to a printer:

           // Since this will be reported to the screen, one copy is the only thing that makes sense

           printSettingDetail.parmNumberOfCopies(1);

           printSettingDetail.parmPrintJobSettings(_defaultSettings);

           if (!this.parmUseUserDefinedDestinations())

           {

               printSettingDetail.parmPrintJobSettings().printMediumType(SRSPrintMediumType::Screen);

           }

    My post probably isn't so clear, feel free to ask for any clarifications.

    Regards,

    Eric

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans