Dynamics AX Blog - report - Beiträge von 2014
Momentan angezeigt werden nur Beiträge von »2014«.
Rechnung per Code druckenDer nachstehende Job demonstriert, wie man in Dynamics AX 2012 eine vorhandene Rechnung/Ausgangsrechnung per Code (nach-)drucken kann. Im Beispiel erfolgt die Ausgabe am Bildschirm. static void printSalesInvoiceThroughCode(Args _args)
{ SalesInvoiceJournalPrint salesInvoiceJournalPrint; Set set = new Set(Types::Record); SRSPrintDestinationSettings srsPrintDestinationSettings; // Add record set.add(CustInvoiceJour::findRecId(5637188088)); // Set printer settings srsPrintDestinationSettings = new SRSPrintDestinationSettings(); srsPrintDestinationSettings.fileFormat(SRSReportFileFormat::Screen); // Initalize salesInvoiceJournalPrint = SalesInvoiceJournalPrint::construct(); salesInvoiceJournalPrint.parmPrintFormletter(NoYes::Yes); salesInvoiceJournalPrint.parmUsePrintManagement(false); salesInvoiceJournalPrint.parmPrinterSettingsFormLetter(srsPrintDestinationSettings.pack()); salesInvoiceJournalPrint.printJournal(set); } |
|
|
|
|
|
|

Der nachstehende Job demonstriert, wie man in Dynamics AX 2012 einen vorhandenen (Ausgangs-)Lieferschein per Code (nach-)drucken kann. Im Beispiel erfolgt die Ausgabe am Bildschirm.
static void printSalesPackingSlipThroughCode(Args _args) { SalesPackingSlipJournalPrint salesPackingSlipJournalPrint; Set set = new Set(Types::Record); SRSPrintDestinationSettings srsPrintDestinationSettings; // Add record set.add(CustPackingSlipJour::findRecId(5637161120)); // Set printer settings srsPrintDestinationSettings = new SRSPrintDestinationSettings(); srsPrintDestinationSettings.fileFormat(SRSReportFileFormat::Screen); // Initalize salesPackingSlipJournalPrint = SalesPackingSlipJournalPrint::construct(); salesPackingSlipJournalPrint.parmPrintFormletter(NoYes::Yes); salesPackingSlipJournalPrint.parmUsePrintManagement(false); salesPackingSlipJournalPrint.parmPrinterSettingsFormLetter(srsPrintDestinationSettings.pack()); // Print salesPackingSlipJournalPrint.printJournal(set); }Ändert man die Parameter der SRSPrintDestinationSettings kann man den Bericht natürlich auch an einen Drucker senden, eine Datei erstellen oder den Bericht per Mail versenden.
static void printSalesPackingSlipThroughCode(Args _args) { SalesPackingSlipJournalPrint salesPackingSlipJournalPrint; Set set = new Set(Types::Record); SRSPrintDestinationSettings srsPrintDestinationSettings; // Add record set.add(CustPackingSlipJour::findRecId(5637161120)); // Set printer settings srsPrintDestinationSettings = new SRSPrintDestinationSettings(); srsPrintDestinationSettings.fileFormat(SRSReportFileFormat::PDF); srsPrintDestinationSettings.fileName(@'c:\temp\packingslip.pdf'); srsPrintDestinationSettings.printMediumType(SRSPrintMediumType::File); srsPrintDestinationSettings.numberOfCopies(1); srsPrintDestinationSettings.overwriteFile(true); // Initalize salesPackingSlipJournalPrint = SalesPackingSlipJournalPrint::construct(); salesPackingSlipJournalPrint.parmPrintFormletter(NoYes::Yes); salesPackingSlipJournalPrint.parmUsePrintManagement(false); salesPackingSlipJournalPrint.parmPrinterSettingsFormLetter(srsPrintDestinationSettings.pack()); // Print salesPackingSlipJournalPrint.printJournal(set); }Weiters kann man auf diese Art & Weise auch mehrere Lieferscheine auf einmal drucken, dazu muss man lediglich die entsprechenden CustPackingSlipJour-Datensätze dem Set "set" hinzufügen:
... // Add record set.add(CustPackingSlipJour::findRecId(5637155842)); set.add(CustPackingSlipJour::findRecId(5637145354)); ...Wer den Lieferschein zusätzlich noch im Druckarchiv speichern möchte, kann dies durch folgende Zeile erreichen:
... srsPrintDestinationSettings.parmPrintToArchive(true); ...