Dynamics AX Blog - report - Beiträge von 2014

Momentan angezeigt werden nur Beiträge, bei denen das Schlagwort »report« eingetragen wurde. Filter entfernen
Momentan angezeigt werden nur Beiträge von »2014«.

Lieferschein per Code drucken

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);
    ...

 
 
 

Rechnung per Code drucken

Der 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());

    // Print
    salesInvoiceJournalPrint.printJournal(set);
}

 
 
 

 

 
 
 
Beiträge des aktuellen Monats
April 2014
MoDiMiDoFrSaSo
 123456
78910111213
14151617181920
21222324252627
282930 
 
© 2006-2025 Heinz Schweda | Impressum | Kontakt | English version | Mobile Version
Diese Webseite verwendet Cookies, um Benutzern einen besseren Service anzubieten. Wenn Sie weiterhin auf der Seite bleiben, stimmen Sie der Verwendung von Cookies zu.  Mehr dazu