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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 26.05.2017, 06:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
stoneridgesoftware: Calculating Customer Aging Balances in X++
Источник: https://stoneridgesoftware.com/calcu...balances-in-x/
==============

I was recently asked to add an Account Summary to the footer of a report in AX 2012, to look something like this:



In my research, I came across a helpful class that allowed me to meet this requirement of calculating customer aging balances in X++ with a minimum of coding effort; the CustVendAgingStatistics class. The calcStatistic method queries StatRepInterval and StatRepIntvervalLine to get the buckets and settings for the calculation, then it writes out the values to tmpAccountSum, which is an InMemory temporary table. Depending on what aging buckets you need, you can use a debugger to figure out which tmpAccountSum records you will want.

For my purpose, I created a new method to calculate the customer’s aging balances using a 30D format (#agingFormat macro). I needed open balances (Balance03) and I opted to store both balance and description in a Map. The integer key was helpful so that I could retrieve the values later and add them to the SalesInvoiceHeaderFooterTmp record in SalesInvoiceDP.insertSalesInvoiceHeaderFooterTmp method. You could easily use a container here, depending on how you are using the aging information.

X++:
private void SSI_calcAging(CustInvoiceAccount _invoiceAccount)
{
    CustVendTable               custVendTable;
    CustVendAgingStatistics     custVendAgingStats;
    TmpAccountSum               tmpAccountSumLocal;
    int                         i;
    custVendTable  = CustTable::find(_invoiceAccount);
 
    custVendAgingStats =       CustVendAgingStatistics::construct(custVendTable,#agingFormat, DateTransactionDuedate::DueDate,True);
    custVendAgingStats.calcStatistic();
    tmpAccountSumLocal.setTmpData(custVendAgingStats.tmpAccountsum());
    i = 0;
    cachedaccountSummary = new Map(Types::Integer,Types::Real);
    cachedaccountSummaryTxt = new Map(Types::Integer,Types::String);
    while select tmpAccountSumLocal
    {
        i++;
        cachedaccountSummary.insert(i,tmpAccountSumLocal.Balance03);
        cachedaccountSummaryTxt.insert(i,tmpAccountSumLocal.Txt);
    }
Obviously, this could be used for Vendor Aging as well. I verified that the values match exactly with the Customer Aging report when it is run with the same parameters.



Источник: https://stoneridgesoftware.com/calcu...balances-in-x/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.

Последний раз редактировалось mazzy; 26.05.2017 в 11:24.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
stoneridgesoftware: Part I: Configuring the Dynamics AX 2012 R3 Entity Store Blog bot DAX Blogs 0 27.04.2017 12:11
stoneridgesoftware: Using Dates for the Vendor Aging Report and Payment Proposal in Dynamics AX 2012 Blog bot DAX Blogs 0 10.01.2017 20:11
dynamicsax-fico: Cleansing small value customer balances – addendum Blog bot DAX Blogs 0 06.03.2016 12:12
emeadaxsupport: Customer aging snapshot performance improvement approach through parallel batch execution Blog bot DAX Blogs 0 30.09.2015 18: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, время: 18:39.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.