<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="https://www.schweda.net/style_feed.css" ?>
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:atom="http://www.w3.org/2005/Atom"	
	xmlns:dc="http://purl.org/dc/elements/1.1/" > 
<channel>
    <title>schweda.net - Blog</title>
    <link>https://www.schweda.net/</link>
    <description>schweda.net - Blog - Blog-Beitraege</description>
    <language>de-at</language>
    <copyright>Copyright 2006-2026</copyright>
    <generator>schweda.net</generator>
    <managingEditor>heinz.schweda@schweda.net (Heinz Schweda)</managingEditor>
    <webMaster>heinz.schweda@schweda.net (Heinz Schweda)</webMaster>
    <category>Blog</category>
	<atom:link href="https://schweda.net/blog_rss.php?bid=208" rel="self" type="application/rss+xml" />
<item>
<title><![CDATA[Dynamics AX: Rechnungen per Code drucken]]></title>
<description><![CDATA[
<p>&Uuml;ber nachstehenden Code kann ganz einfach jederzeit eine Verkaufsrechnung nachtr&auml;glich ausgedruckt werden. Durch leichte Modifikationen des Codes gilt dies auch f&uuml;r s&auml;mtliche anderen verkaufs-&nbsp;und einkaufsseitigen Dokumente.
</p>


<p>Hier ein kurzes Beispiel unter AX 2009
</p>


<pre class="pre_blog_axcode">
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 &uuml;ber Dialog
       printIt = printJobSettings.printerSettings(&#39;SysPrintForm&#39;);
   }
   else
   {
       // Printjobsettings per Code steuern
       printJobSettings.setTarget(PrintMedium::File);
       printJobSettings.format(PrintFormat::PDF);
       printJobSettings.fileName(@&#39;c:&#092;temp&#092;myfile.pdf&#39;);
   }

   if (!printIt)
   {
       return; // Benutzerabbruch
   }

   salesFormLetter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings());

   select firstOnly custInvoiceJour
       where custInvoiceJour.salesid == &#39;100001&#39;;

   args.record(custInvoiceJour);
   args.caller(salesFormLetter);

   new MenuFunction(menuitemoutputstr(SalesInvoice), MenuItemType::Output).run(args);
}
</pre>


<p>Nachstehend ein Code-Beispiel unter AX 4.0
</p>


<pre class="pre_blog_axcode">
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 &uuml;ber Dialog
       printJobSettings = new PrintJobSettings(salesPrintSetup.PrintJobSettings);
       printIt = printJobSettings.printerSettings(&#39;SysPrintForm&#39;);
       salesPrintSetup.PrintJobSettings = printJobSettings.packPrintJobSettings();
   }
   else
   {
       // Printjobsettings per Code steuern
       printJobSettings.setTarget(PrintMedium::File);
       printJobSettings.format(PrintFormat::PDF);
       printJobSettings.fileName(@&#39;c:&#092;temp&#092;myfile.pdf&#39;);
   }

   if (!printIt)
   {
       return; // Benutzerabbruch
   }

   salesFormLetter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings());

   select firstOnly custInvoiceJour
       where custInvoiceJour.salesid == &#39;100001&#39;;

   args.record(custInvoiceJour);
   args.caller(salesFormLetter);

   new MenuFunction(menuitemoutputstr(SalesInvoice), MenuItemType::Output).run(args);
}
</pre>

<br /><a class="div_blog_category_gotodetail" href="https://www.schweda.net/blog_ax.php?bid=208" target="_self" title="Weiterlesen...">Weiterlesen...</a>]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Wed, 09 Apr 2008 16:08:00 +0200</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=208</link>
<comments>https://www.schweda.net/blog_ax.php?bid=208</comments>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=208</guid>
<author>heinz.schweda@schweda.net (Heinz Schweda)</author>
<wfw:commentRss>https://www.schweda.net/blog_ax.php?bid=208</wfw:commentRss>
</item>
<item>
<title>Kommentar von Alexander Zach</title>
<description><![CDATA[Danke für dieses Codebeispiel: Copy, Paste, und funkioniert.]]></description>
<category>Microsoft Dynamics AX (Axapta)</category>
<pubDate>Tue, 07 Apr 2009 14:38:00 +0200</pubDate>
<link>https://www.schweda.net/blog_ax.php?bid=208</link>
<guid isPermaLink="true">https://www.schweda.net/blog_ax.php?bid=208</guid>
<author>Alexander Zach</author>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Heinz Schweda</dc:creator>
<wfw:commentRss>https://www.schweda.net/blog_ax.php?bid=208</wfw:commentRss>
</item>
<item>
<title>Kommentar von tadd</title>
<description><![CDATA[thanks]]></description>
<category></category>
<pubDate>Thu, 02 Dec 2010 11:12:00 +0100</pubDate>
<link>https://www.schweda.net/blog.php?bid=208</link>
<guid isPermaLink="true">https://www.schweda.net/blog.php?bid=208</guid>
<author>tadd</author>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Heinz Schweda</dc:creator>
<wfw:commentRss>https://www.schweda.net/blog.php?bid=208</wfw:commentRss>
</item>
<item>
<title>Kommentar von Thomas</title>
<description><![CDATA[Wie umgehst du die Einstellungen in der Druckerverwaltung, z.B. beim Debitor? Z.B. kann es sein, dass Rechnung Kopie und Original auf 0 ist, aber per code soll so etwas verschicket werden.]]></description>
<category></category>
<pubDate>Thu, 28 Jul 2011 17:40:00 +0200</pubDate>
<link>https://www.schweda.net/blog.php?bid=208</link>
<guid isPermaLink="true">https://www.schweda.net/blog.php?bid=208</guid>
<author>Thomas</author>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Heinz Schweda</dc:creator>
<wfw:commentRss>https://www.schweda.net/blog.php?bid=208</wfw:commentRss>
</item>
<item>
<title>Kommentar von Heinz Schweda</title>
<description><![CDATA[Tja, eine solche Einstellungen in der Druckerverwaltung wäre für den obigen Code tatsächlich ein Problem. Der funktioniert dann nämlich nicht!

Ich habe mir den Code im Report SalesInvoice (Methoden init & fetch) kurz angesehen, und wenn ich den richtig verstanden habe, gibt es in einem solchen Fall keinerlei Möglichkeit, den Beleg zu drucken. Zumindest nicht ohne eine entsprechende Codeanpassung.]]></description>
<category></category>
<pubDate>Mon, 01 Aug 2011 18:26:00 +0200</pubDate>
<link>https://www.schweda.net/blog.php?bid=208</link>
<guid isPermaLink="true">https://www.schweda.net/blog.php?bid=208</guid>
<author>Heinz Schweda</author>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Heinz Schweda</dc:creator>
<wfw:commentRss>https://www.schweda.net/blog.php?bid=208</wfw:commentRss>
</item>
<item>
<title>Kommentar von Ludwig Stieglbrunner</title>
<description><![CDATA[Gibt es die Möglichkeit in AX 2009 Rechnungen oder Lieferscheine mittels eines Codes per Email zu versenden? Das Format sollte natürlich PDF sein und der Name der Rechnung sollter eindeutig sein.]]></description>
<category></category>
<pubDate>Mon, 30 Sep 2013 16:40:00 +0200</pubDate>
<link>https://www.schweda.net/blog.php?bid=208</link>
<guid isPermaLink="true">https://www.schweda.net/blog.php?bid=208</guid>
<author>Ludwig Stieglbrunner</author>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Heinz Schweda</dc:creator>
<wfw:commentRss>https://www.schweda.net/blog.php?bid=208</wfw:commentRss>
</item>
<item>
<title>Kommentar von Heinz Schweda</title>
<description><![CDATA[Hallo Ludwig, da gibt es sogar mehrere Möglichkeiten die alle ihre Vor- und Nachteile haben.

Die einfachste Variante ist den oben beschriebenen Job um folgende Funktionsaufrufe zu erweitern:

    printJobSettings.mailTo(\"empfaenger@domain.net\");
    printJobSettings.mailSubject(\"Betreff\");

Dann wird des jeweilige Dokument als Datei gespeichert und anschließend dem lokalen (!) Mail-Client zum Versenden übergeben.

Alternativ dazu kann man das Dokument wie im Job beschrieben als Datei speichern und anschließend mit zusätzlichem Programmcode an einen SMTP-Server übergeben. In folgendem Blog-Beitrag habe ich dies für AX 2012 schon mal beschrieben, dieser ist allerdings auch für AX 2009 gleichermassen gültig:

http://www.schweda.net/blog_ax.php?bid=454

Hoffe, das hilft dir weiter!
LG Heinz]]></description>
<category></category>
<pubDate>Sat, 05 Oct 2013 13:50:00 +0200</pubDate>
<link>https://www.schweda.net/blog.php?bid=208</link>
<guid isPermaLink="true">https://www.schweda.net/blog.php?bid=208</guid>
<author>Heinz Schweda</author>
<dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Heinz Schweda</dc:creator>
<wfw:commentRss>https://www.schweda.net/blog.php?bid=208</wfw:commentRss>
</item>
</channel>
</rss>	
