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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 08.05.2012, 04:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
ax_gfm_framework_team: Step 5: Add code to distribute and journalize source document amounts
Источник: http://blogs.msdn.com/b/ax_gfm_frame...t-amounts.aspx
==============

There might be a need to create new monetary amounts but that is optional and you may find existing monetary amounts sufficient. It depends if existing monetary amounts are a good fit for your document and have appropriate names to display on accounting distributions form. Either new or existing MonetaryAmount enum values will be used in your code creating distributions.

a) Create a class extending AccountingPolicy. Using framework naming standards name this class AccPolicyMyBusinessEvent .
Decorate it with
SourceDocumentExtensionAttribute:


[SourceDocumentExtensionAttribute(enumNum(BusinessEvent_MyDocument), BusinessEvent_MyDocument::MyBusinessEvent)]



b) (Optional) Add an additional value (MyValue) to MonetaryAmount enum. This will be used later to identify your specific amount when you add code to calculate all amounts that need to be distributed for your document in calculateSourceDocumentAmountMap method on your source document line classes.



c) (Optional) In case you added your value to MonetaryAmount enum – update SourceDocumentMonetaryAmountModel class. Methods initMonetaryAmountChildMap() and optionally initMonetaryAmountParentMap() will need to be updated.



d) (Optional) In case you added your value to MonetaryAmount enum – you may need to update SourceDocumentAmountFormTreeBuildHelper.initMonetaryAmountTreePostionMap() if you have specific requirements about sequencing of monetary amounts in the accounting distribution form.



e) Create a class extending AccountingDistributionRule. Using framework naming standards name this class AccDistRuleMyDesiredAction where “MyDesiredAction” describes the business event associated with the rule (e.g. AccDistRuleSaleOfProductTax). Decorate it with SourceDocumentExtensionAttribute:

[SourceDocumentExtensionAttribute(enumNum(BusinessEvent_MyDocument), BusinessEvent_ MyDocument::MyBusinessEvent, MonetaryAmount::MyValue)]



MyValue could be either an existing value or a newly created value (see optional steps 5 b-d).
Implement abstract methods parmSide() and parmLedgerPostingType().



f) Revisit your classes extending SourceDocumentLine which have monetary amounts to distribute. On each of them override method calculateSourceDocumentAmountMap() to return map of all source document amounts which need to be distributed.



g) (Optional) Create your own account dimension list provider. To do that, you need to first add a value to MainAccountDimensionListProviderType enum identifying the provider (let’s call it MyType). Next create a class that extends MainAccountDimensionListProvider. Decorate the class with SourceDocumentExtensionAttribute:

[SourceDocumentExtensionAttribute(enumNum(MainAccountDimensionListProviderType), MainAccountDimensionListProviderType::MyType)]



h) (Optional) Create an interface to abstract out usage of your provider and get required data for SourceDocumentLineItem classes that will implement this interface. Name it after the new enum value: SourceDocumentIMyType.



i) (Optional) Revisit your source document class (MyDocumentSourceDocument) and implement the SourceDocumentIMyType interface on it.



j) (Optional) Create provider class inheriting from MainAccountDimensionListProvider. Using framework naming standards name it MyTypeMainAccountDimensionListProvider. Decorate it with SourceDocumentExtensionAttribute:

[SourceDocumentExtensionAttribute(enumNum(MainAccountDimensionListProviderType), MainAccountDimensionListProviderType::MyType)]

Implement populateMainAccountDimensionList() method to return the list containing the appropriate main account.



k) (Optional) Modify AccountingRule class adding method canUseMyTypeMainAccountDimensionListProvider() which determines under which conditions your provider should be used. It will usually be determined by source document extension class implementing correct interface, but could be other condition as well:

public boolean canUseMyTypeMainAccDimListProvider()

{

Object sourceDocument = sourceDocumentLineItem.parmSourceDocument();

return (sourceDocument is SourceDocumentIMyType);

}



l) (Optional) Modify MainAccountDerivationDistributionRule and/or MainAccountDerivationJournalizingRule to initialize the account list based on new provider. Code will be added in populateMainAccountList() method.

The distributions part should be working now and you should be able to see distributions on your document’s form clicking on distributions buttons which you added earlier.

Now you need to add necessary code for proper journalization of your document.

Usually you will just want to put the balancing amount into certain account (like Vendor Balance). If you need just that, do the following:



m) Create a class extending AccountingJournalizingRule. Using framework naming standards name this class AccJourRuleMyDesiredAction where “MyDesiredAction” describes the action you are performing which affects your distributions (e.g. AccJourRuleSaleRevenue). Decorate it with SourceDocumentExtensionAttribute:

[SourceDocumentExtensionAttribute(enumNum(BusinessEvent_MyDocument), BusinessEvent_ MyDocument::MyBusinessEvent, MonetaryAmount::MyValue)]



MyValue could be either newly created value or an existing one.
Implement abstract methods parmSide() and parmLedgerPostingType().



n) Go back to your source document class and inherit the right source document interface on it (for example SourceDocumentIParty for vendor balance) - it will tell the MainAccountDerivationJournalizingRule class (through canUse method) to use the specific DimensionListProvider during journalization (see code inside MainAccountDerivationJournalizingRule.populateMainAccountList() for more info).



Rarely, your document will have more demanding journalization requirements than just putting a balance amount into a balance account. If that is the case you may need to implement journalization rules with steps analogous to implementing distribution generation described above.



After this step the button which you added earlier on your document’s form which invokes menu item SubledgerJournalAccountEntries should display all subledger account entries for your document allowing you to test distribution and journalization rules.



To be continued...




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

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
ax_gfm_framework_team: Extending the Source Document Framework Blog bot DAX Blogs 0 28.04.2012 10:11
Опции темы Поиск в этой теме
Поиск в этой теме:

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

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

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

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