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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 11.09.2018, 18:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
a33ik: Payment advice report through print management to vendor
Источник: http://daxonline.org/1621-payment-ad...to-vendor.html
==============

Here we will be adding payment advice report to print management of AX 2012 and will make modification to controller class so it will be printed per vendor and can be sent to vendors email address.


\Data Dictionary\Base Enums\PrintMgmtDocumentType
add new value VKBankPaymAdvice


\Data Dictionary\Base Enums\PrintMgmtNodeType
add new value VKBankPaymAdvice


\Data Dictionary\Tables\BankPaymAdviceVendTmp
Add new field VKVendAccount. New relation to VendTable.AccountNum can also be added.


\Data Dictionary\Tables\PrintMgmtReportFormat\Methods\populate
Add one line after the standard one:...addAX(PrintMgmtDocumentType::PurchaseOrderConfirmationRequest);addAX(PrintMgmtDocumentType::VKBankPaymAdvice); // Solution MOD...

\Data Dictionary\Maps\CustVendAccountMap
add new mapping to BankPaymAdviceVendTmp table:


\Classes\VKBankPaymAdviceVendController
This is a copy of \Classes\BankPaymAdviceVendController , you will need to duplicate it and apply following changes:


\Classes\VKBankPaymAdviceVendController\ClassDeclaration
Different class to extend and following variable no longer required
// basically a modified copy of BankPaymAdviceVendController extending SrsPrintMgmtControllerclass VKBankPaymAdviceVendController extends SrsPrintMgmtController... SRSPrintDestinationSettings printDestinationSetting; container printerSetting;...

\Classes\VKBankPaymAdviceVendController\initPrintMgmtReportRun
New methodprotected void initPrintMgmtReportRun(){ UsePrintMgmt paymAdvUsePrintMgmt; paymAdvUsePrintMgmt = this.parmArgs().parmEnum(); printMgmtReportRun=PrintMgmtReportRun::construct( PrintMgmtHierarchyType::Purch, PrintMgmtNodeType::VKBankPaymAdvice, PrintMgmtDocumentType::VKBankPaymAdvice ); printMgmtReportRun.parmForcePrintJobSettings(!paymAdvUsePrintMgmt); printMgmtReportRun.parmReportRunController(this);}

\Classes\VKBankPaymAdviceVendController\insertBankPaymAdviceVendTmp
Additional line
... bankPaymAdviceVendTmp.PaymAdviceDate = systemDateGet(); bankPaymAdviceVendTmp.PaymentReference = paymref; BankPaymAdviceVendTmp.VKVendAccount = VendTable.AccountNum; // Solution MOD...

\Classes\VKBankPaymAdviceVendController\preRunModifyContract
Almost entirely changed
protected void preRunModifyContract(){ Query reportQuery; reportQuery = this.parmReportContract().parmQueryContracts().lookup(this.getFirstQueryContractKey()); SrsReportHelper::addParameterValueRangeToQuery( reportQuery, tableNum(BankPaymAdviceVendTmp), fieldNum(BankPaymAdviceVendTmp,SessionId), this.currentSessionId() );}

\Classes\VKBankPaymAdviceVendController\processReport
Several changes
... currentSessionId = new xSession().sessionId(); // Solution MOD BEGIN /* The right way would be to introduce completely new SessionId field based on guid for example and generate new guid for each vendor. But it will require update of report metadata. It is not possible to merge ssrs report changes and it will be a pain for future. Therefore existing integer field will be used to devide reports. */ currentSessionId = currentSessionId*100000; // Solution MOD END... li = paramOutPaymlist.getEnumerator(); while (li.moveNext()) { // Solution MOD BEGIN // We need to make sure that SessionId is unique for each vendor and will delete previous records. // The delete statement above does not suit, in wrong possition, but still required to delete old data. currentSessionId++; delete_from bankPaymAdviceVendTmp where bankPaymAdviceVendTmp.SessionId == currentSessionId; // Solution MOD END vendOutPaymRecord = li.current();... // following code snippet located at just before the end of while block // Solution MOD BEGIN // print data per vendor this.initPrintMgmtReportRun(); printMgmtReportRun.load(BankPaymAdviceVendTmp, BankPaymAdviceVendTmp, CompanyInfo::languageId()); this.outputReports(); // Solution MOD END }}

\Classes\VKBankPaymAdviceVendController\runPrintMgmt
New method
protected void runPrintMgmt(){ vendOutPaym = this.parmArgs().caller(); vendOutPaymList = this.parmArgs().parmObject(); this.processReport(vendOutPaymList);}

\Classes\VKBankPaymAdviceVendController\main
public static void main(Args _args){ SrsPrintMgmtController controller = new VKBankPaymAdviceVendController(); controller.parmReportName(#ReportName); controller.parmArgs(_args); controller.parmShowDialog(false); controller.startOperation();}

There are changes to classes to support new print management type:


\Classes\PrintMgmtDocType\getDefaultReportFormat
... case PrintMgmtDocumentType::PurchRFQReturn: return ssrsReportStr(RFQSend, Report); // Solution MOD BEGIN case PrintMgmtDocumentType::VKBankPaymAdvice: return ssrsReportStr(BankPaymAdviceVend, Report); // Solution MOD END case PrintMgmtDocumentType::SalesOrderInvoice:...

\Classes\PrintMgmtDocType\getPartyType
... case PrintMgmtDocumentType::PurchaseOrderConfirmationRequest: case PrintMgmtDocumentType::VKBankPaymAdvice: // Solution MOD return PrintMgmtPrintDestinationPartyType::Vendor;...

\Classes\PrintMgmtDocType\getQueryTableId
... tableId = tableNum(VendRFQJour); break; // Solution MOD BEGIN case PrintMgmtDocumentType::VKBankPaymAdvice: tableId = tableNum(BankPaymAdviceVendTmp); break; // Solution MOD END case PrintMgmtDocumentType::SalesOrderInvoice,...

\Classes\PrintMgmtNode_VendTable\getDocumentTypes
... docTypes.addEnd(PrintMgmtDocumentType::PurchRFQReject); docTypes.addEnd(PrintMgmtDocumentType::PurchRFQReturn); docTypes.addEnd(PrintMgmtDocumentType::VKBankPaymAdvice); // Solution MOD }...

\Classes\PrintMgmtNode_Purch\getDocumentTypes
... docTypes.addEnd(PrintMgmtDocumentType::PurchRFQReject); docTypes.addEnd(PrintMgmtDocumentType::PurchRFQReturn); docTypes.addEnd(PrintMgmtDocumentType::VKBankPaymAdvice); // Solution MOD }...

\Classes\PrintMgmtHierarchy_Purch\getNodesImplementation
... supportedNodes.addEnd(PrintMgmtNodeType::PurchAgreement); supportedNodes.addEnd(PrintMgmtNodeType::VKBankPaymAdvice); // Solution MOD...

\Classes\PrintMgmtHierarchy_Purch\getParentImplementation
... PurchAgreementHeader purchAgreementHeader; BankPaymAdviceVendTmp bankPaymAdviceVendTmp; // Solution MOD // ... case PrintMgmtNodeType::Purch: // When no parent is present, return null result = null; break; // Solution MOD BEGIN case PrintMgmtNodeType::VKBankPaymAdvice: BankPaymAdviceVendTmp = _nodeInstance.parmReferencedTableBuffer(); if (BankPaymAdviceVendTmp.VKVendAccount) { result.parmReferencedTableBuffer(BankPaymAdviceVendTmp.selectRefRecord(fieldnum(BankPaymAdviceVendTmp, VKVendAccount))); } else { result.parmReferencedTableBuffer(null); } result.parmNodeDefinition(PrintMgmtNode::construct(PrintMgmtNodeType::VendTable)); break; // Solution MOD END } return result;}

\Classes\PrintMgmtNode\construct
... case PrintMgmtNodeType::TMS: return new TMSPrintMgmtNode_TMS(); // Solution MOD BEGIN case PrintMgmtNodeType::VKBankPaymAdvice: return new PrintMgmtNode_VKBankPaymAdvice(); // Solution MOD END }

\Classes\PrintMgmtNode_VKBankPaymAdvice
class PrintMgmtNode_VKBankPaymAdvice extends PrintMgmtNode{}protected str getDisplayCaptionImplementation(Common _tableBuffer){ return(strfmt("@SYS108944", _tableBuffer.caption()));}public List getDocumentTypes(){ List docTypes; docTypes = new List(Types::Enum); if (isConfigurationkeyEnabled(configurationkeynum(LogisticsBasic))) { docTypes.addEnd(PrintMgmtDocumentType::VKBankPaymAdvice); } return docTypes;}public int getIconImageResNum(){ #resAppl return #ImagePrintManagementTrans;}public PrintMgmtNodeType getNodeType(){ return PrintMgmtNodeType::VKBankPaymAdvice;}public RefTableId getReferencedTableId(){ return tablenum(BankPaymAdviceVendTmp);}
Dialog modification to include option to use print management.
Depending on the localization you are using the class name may be different:


\Classes\VendOutPaym_UKBACS\classDeclaration
... // Solution MOD BEGIN DialogField paymAdviceUsePrintMgmt; UsePrintMgmt paymAdvUsePrintMgmt; // Solution MOD END #DEFINE.CurrentVersion(1) #LOCALMACRO.CurrentList numRecords, numAmount, currencyList, amountList ,paymAdvUsePrintMgmt // Solution MOD #ENDMACRO

\Classes\VendOutPaym_UKBACS\dialog
... paymAdviceUsePrintMgmt = dialog.addfieldvalue(enumStr(NoYes), NoYes::Yes, "@SYS93922"); // Solution MOD return dialog;}

\Classes\VendOutPaym_UKBACS\getFromDialog
public boolean getFromDialog(){ ; paymAdvUsePrintMgmt = paymAdviceUsePrintMgmt.value(); // Solution MOD return super();}

\Classes\VendOutPaym_UKBACS\printPaymAdvice
public void printPaymAdvice(){ Args args = new Args(); args.caller(this); args.parmObject(this.getOutPaymRecords()); // Solution MOD BEGIN args.parmEnumType(enumNum(NoYes)); args.parmEnum(paymAdvUsePrintMgmt); if (paymAdvUsePrintMgmt) { new MenuFunction(menuitemOutputStr(VKBankPaymAdviceVend), MenuItemType::Output).run(args); } else { new MenuFunction(menuitemOutputStr(BankPaymAdviceVend), MenuItemType::Output).run(args); } // Solution MOD END}

You will need to duplicate \Menu Items\Output\BankPaymAdviceVend menu item and point to new controller that you have created using BankPaymAdviceVendController class as a basis.


Purchase ledger / Setup / Forms / Form setup / General / Print management:


For additional information refer to Print Management Integration Guide.


Источник: http://daxonline.org/1621-payment-ad...to-vendor.html
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
atinkerersnotebook: Using Vendor Requests to Manage On-boarding New Vendors Blog bot DAX Blogs 1 22.10.2013 02:24
dynamicsaxtraining: Vendor returns Blog bot DAX Blogs 0 11.10.2012 00:11
dynamicsaxtraining: Paying a Vendor Blog bot DAX Blogs 0 22.03.2012 22:11
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
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, время: 02:28.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.