AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 20.10.2020, 08:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
dynamicsaxinsight: Create print management settings in X++
Источник: https://dynamicsaxinsight.wordpress....ttings-in-xpp/
==============

Purpose:

The purpose of this blog post is to demonstrate how can we create print management settings in X++

Product:

Dynamics AX 2012

Description:

The code creates a print management settings record on a customer for collection letter note document and uses first contact of type email and purpose “Collection” found on the customer record to create print destination settings.

Code:

static void MAKCustPrintMgmtSettings(Args _args) { PrintMgmtSettings printMgtSettings; PrintMgmtDocInstance printMgtDocInstance; SRSPrintDestinationSettings printDestinationSettings; PrintMgmtReportFormat PrintMgmtReportFormat; PrintMgmtDocumentType PrintMgmtDocumentType; PrintMgmtDocInstanceType PrintMgmtDocInstanceType; NoYes NoYes; SRSReportFileFormat SRSReportFileFormat; SRSPrintMediumType SRSPrintMediumType; str EmailTo; CustTable custTable; LogisticsElectronicAddress electronicAddress; LogisticsElectronicAddressRole electronicAddrRole; LogisticsLocationRole locationRole; container record; int totalRecords = 0; container printerSetting = conNull(); try { while select custTable where custTable.AccountNum == 'C000115' { select firstOnly electronicAddress where electronicAddress.Location == DirPartyLocation::findOrCreate(custTable.Party, 0).Location && electronicAddress.Type == LogisticsElectronicAddressMethodType::Email join electronicAddrRole where electronicAddrRole.ElectronicAddress == electronicAddress.RecId join locationRole where locationRole.RecId == electronicAddrRole.LocationRole && locationRole.Name == "Collection"; if (electronicAddress.RecId) { EmailTo = electronicAddress.Locator; } printDestinationSettings = new SRSPrintDestinationSettings(printerSetting); printDestinationSettings.unpack(printerSetting); printDestinationSettings.caption("@SYS131685"); printDestinationSettings.emailTo(EmailTo); printDestinationSettings.printMediumType(SRSPrintMediumType::Email); printDestinationSettings.emailSubject('Collection Letter'); printDestinationSettings.emailAttachmentFileFormat(SRSReportFileFormat::PDF); printDestinationSettings.numberOfCopies(1); printMgtDocInstance = PrintMgmtDocInstance::find(custTable.RecId, custTable.TableId, PrintMgmtNodeType::CustTable, PrintMgmtDocumentType::CustCollectionLetter, 1); ttsBegin; if (printMgtDocInstance) { printMgtDocInstance.selectForUpdate(true); } printMgtDocInstance.Name = ""; // To override give a blank value printMgtDocInstance.DocumentType = PrintMgmtDocumentType::CustCollectionLetter; printMgtDocInstance.PrintType = PrintMgmtDocInstanceType::Original; printMgtDocInstance.PriorityId = 1; printMgtDocInstance.Suppress = NoYes::No; printMgtDocInstance.ReferencedTableId = custTable.TableId; printMgtDocInstance.ReferencedRecId = custTable.RecId; printMgtDocInstance.NodeType = PrintMgmtNodeType::CustTable; if (printMgtDocInstance) { printMgtDocInstance.update(); } else { printMgtDocInstance.insert(); } select firstOnly printMgtSettings order by PriorityID where printMgtSettings.ParentId==printMgtDocInstance.RecId && printMgtSettings.PriorityID == 1; if (printMgtSettings) { printMgtSettings.selectForUpdate(true); } printMgtSettings.ParentId = printMgtDocInstance.RecId; printMgtSettings.ReportFormat = PrintMgmtReportFormat::findByType(PrintMgmtDocumentType::CustCollectionLetter, 'CustCollectionJour.Report', '').RecId; printMgtSettings.PrintJobSettings = printDestinationSettings.pack(); printMgtSettings.NumberOfCopies = 1; printMgtSettings.PriorityId = 1; if (printMgtSettings) { printMgtSettings.update(); } else { printMgtSettings.insert(); } ttsCommit; totalRecords++; if (printMgtDocInstance && printMgtSettings) { info(strFmt("Customer %1 updated successfully", custTable.AccountNum)); } else { error(strFmt("Failed to update customer %1", custTable.AccountNum)); } } } catch (Exception::Error) { throw(Exception::Error); } info(strFmt("Total records read = %1", totalRecords)); }

Источник: https://dynamicsaxinsight.wordpress....ttings-in-xpp/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
stoneridgesoftware: Print Management Settings in Dynamics AX Seem to Disappear or Reset after a Code Move Blog bot DAX Blogs 0 22.03.2018 03:39
saurav-nav: NAV 2018 - Lots of New Objects! Blog bot NAV: Blogs 0 04.12.2017 10:11
emeadaxsupport: How to print BOL from Transportation Management without using Warehouse Management Blog bot DAX Blogs 0 12.03.2015 18:11
Microsoft Dynamics CRM Team Blog: Microsoft Dynamics CRM 2011 Fiscal Settings and Goal Management Blog bot Dynamics CRM: Blogs 0 19.01.2011 01:13
wiki.dynamicsbook: Changes Made in Navision Attain 3.60 Blog bot Dynamics CRM: Blogs 0 02.09.2008 13:23
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 18:33.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.