Dynamics AX Blog - report - Beiträge von 2008
Momentan angezeigt werden nur Beiträge von »2008«.
Dynamics AX: Rechnungen per Code druckenÜber nachstehenden Code kann ganz einfach jederzeit eine Verkaufsrechnung nachträglich ausgedruckt werden. Durch leichte Modifikationen des Codes gilt dies auch für sämtliche anderen verkaufs- und einkaufsseitigen Dokumente. Hier ein kurzes Beispiel unter AX 2009 static void PrintSalesInvoice(Args _args) { custInvoiceJour custInvoiceJour; SalesFormLetter salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice, false); PrintJobSettings printJobSettings = new PrintJobSettings(); Args args = new Args(); boolean prompt = true; boolean printIt = true; ; if (prompt) { // Auswahl des Benutzers über Dialog printIt = printJobSettings.printerSettings('SysPrintForm'); } else { // Printjobsettings per Code steuern printJobSettings.setTarget(PrintMedium::File); printJobSettings.format(PrintFormat::PDF); printJobSettings.fileName(@'c:\temp\myfile.pdf'); } if (!printIt) { return; // Benutzerabbruch } salesFormLetter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings()); select firstOnly custInvoiceJour where custInvoiceJour.salesid == '100001'; args.record(custInvoiceJour); args.caller(salesFormLetter); new MenuFunction(menuitemoutputstr(SalesInvoice), MenuItemType::Output).run(args); } Nachstehend ein Code-Beispiel unter AX 4.0 static void PrintSalesInvoice(Args _args) { custInvoiceJour custInvoiceJour; SalesFormLetter salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice, false); PrintJobSettings printJobSettings = new PrintJobSettings(); Args args = new Args(); boolean prompt = true; boolean printIt = true; salesPrintSetup salesPrintSetup; ; if (prompt) { // Auswahl des Benutzers über Dialog printJobSettings = new PrintJobSettings(salesPrintSetup.PrintJobSettings); printIt = printJobSettings.printerSettings('SysPrintForm'); salesPrintSetup.PrintJobSettings = printJobSettings.packPrintJobSettings(); } else { // Printjobsettings per Code steuern printJobSettings.setTarget(PrintMedium::File); printJobSettings.format(PrintFormat::PDF); printJobSettings.fileName(@'c:\temp\myfile.pdf'); } if (!printIt) { return; // Benutzerabbruch } salesFormLetter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings()); select firstOnly custInvoiceJour where custInvoiceJour.salesid == '100001'; args.record(custInvoiceJour); args.caller(salesFormLetter); new MenuFunction(menuitemoutputstr(SalesInvoice), MenuItemType::Output).run(args); } |
|
|
|
|
|
|
Anbei ein Beispiel wie so mancher Report per Code ausgeführt werden kann, und dem Report dabei gleichzeitig ganz bestimmte Datensätze per Query übergeben werden können.