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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 01.05.2012, 18:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
ax_gfm_framework_team: Step 3: Perform initial wiring to Source Document Framework – document classes
Источник: http://blogs.msdn.com/b/ax_gfm_frame...t-classes.aspx
==============

Now you need to implement few classes representing your source document.

a) Create a class which extends SourceDocumentType.
  • Using framework naming standards name this class MyDocumentSourceDocumentType.
  • Implement all abstract methods (see examples in the following existing classes: CustInvoiceSourceDocType, VendorInvoiceSourceDocType, PurchaseOrderSourceDocumentType)
- parmModule(): used to determine whether it is valid to add entries to subledger for given module.

- parmSourceDocumentHeaderRootNodeLabel(), parmSourceDocumentLineRootNodeLabel() : used by UI to display proper label for document header or lines respectively.

- parmSubledgerJournalEntryType(): amounts (including matching amounts) are balanced by the framework across subledger journal entry types.

- parmSubledgerJournalRelievingMethod(): in case of matching it specifies relieving method for amounts of the upstream document.
  • Decorate the class with SourceDocumentExtensionAttribute(s) with appropriate parameters from the newly created enums.


[SourceDocumentExtensionAttribute(enumNum(SourceDocument_MyDocument), SourceDocument_MyDocument::MyDocument)]



b) Create a class which extends SourceDocument.
  • Using framework naming standards name this class MyDocumentSourceDocument.
  • Implement initializeImplementation() which is intended to set up internal state (for examples see VendorInvoiceSourceDoc.initializeImplementation(), PurchaseOrderSourceDocument.initializeImplementation())
  • Decorate this class with SourceDocumentExtensionAttribute(s) with appropriate parameters from the newly created enums.
[SourceDocumentExtensionAttribute(enumNum(SourceDocument_MyDocument), SourceDocument_MyDocument::MyDocument, tableNum(MyDocumentHeader))]


  • Create an enum for your business event.
- Using framework naming standards name it BusinessEvent_MyDocument.

- Values would list all business event types specific to your document. Add values: None = 0, MyBusinessEvent = 1.

- This will be used by attributes on extensions of AccountingDistributionRule, AccountingJournalizingRule and AccountingPolicy which you will create later.


  • Implement appropriate SourceDocument interfaces – as a minimum SourceDocumentIDataProvider interface providing the following methods:
- parmDistributionTemplateRecId(): should return a RecId reference of a template. If not empty, the template will be used to populate ledger dimension allocation list

- documentsBusinessEvent(): should return the BusinessEvent based on your newly created BusinessEvent_MyDocument enum

- parmAccountingDate(): should return the accounting date for the document

- parmBusinessEventDate(): the simplest implementation is already provided on the SourceDocument class

- parmDefaultDimension(): if default dimension is provided, it is used by the framework to build ledger dimension



c) Create class(es) extending SourceDocumentLineItem.
  • If your document has amounts to distribute on both header and lines you may need to create two such classes.
  • Using framework naming standards name those classes MyDocumentLineSourceDocumentLineItem, MyDocumentSourceDocumentLineItem respectively.
  • Implement the following abstract methods (for examples see the existing implementations: CustInvoiceSourceDocLineItem, CustInvoiceLineSourceDocLineItem, VendorInvoiceSourceDocLineItem, VendorInvoiceLineSourceDocLineItem, PurchOrderSourceDocumentLineItem, PurchOrderLineSourceDocumentLineItem)
- calculateLegalEntityRecId(): should return reference to CompanyInfo table record representing legal entity of the document line

- calculateSourceDocumentAmountMap(): should return object of type SourceDocumentAmountMap representing collection of amounts to distribute for the line

- documentsBusinessEvent(): should return a business event documented by given source document line. In the simplest form the code will look like the following:

return new BusinessEvent(enumNum(BusinessEvent_MyDocument), BusinessEvent_MyDocument::MyBusinessEvent);



- initializeImplementation() - intended to set up internal state

- parmTransactionCurrencyCode() – should return the currency for the line


  • Decorate each class with SourceDocumentExtensionAttribute(s) with appropriate parameters from the newly created enums.

    Attribute for line class:

    [SourceDocumentExtensionAttribute(enumNum(SourceDocumentLine_MyDocument), SourceDocumentLine_MyDocument::MyDocumentLine)]

    Attribute for totals line class:
    [SourceDocumentExtensionAttribute(enumNum(SourceDocument_MyDocument), SourceDocumentLine_MyDocument::MyDocumentTotalsLine)]

d) Keep document state persisted by the source document framework in sync with your document state. This is done by overwriting table insert() and update() methods on your document tables.



Document header – insert()


SourceDocumentProcessorFacade::submitSourceDocumentImplementation(this);

SourceDocumentProcessorFacade::submitSourceDocumentLineImplementation(this);

super();




Document header – update()

super();

SourceDocumentProcessorFacade::submitSourceDocumentLinesForHeader(this, SourceDocumentLineAccountingStatus::FullyDistributed);



Document line – insert()


SourceDocumentProcessorFacade::submitSourceDocumentLineImplementation(this);

super();



Document line – update()


super();

SourceDocumentProcessorFacade::submitSourceDocumentLineImplementation(this);




Источник: http://blogs.msdn.com/b/ax_gfm_frame...t-classes.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
ax_gfm_framework_team: Step 2: Perform initial wiring to Source Document Framework – tables and maps Blog bot DAX Blogs 0 28.04.2012 10:11
ax_gfm_framework_team: Step 1: Prerequisite - create your document Blog bot DAX Blogs 0 28.04.2012 10:11
ax_gfm_framework_team: Extending the Source Document Framework Blog bot DAX Blogs 0 28.04.2012 10:11
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11

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

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

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