AX报表Mainaccount开仓余额数据集

时间:2016-11-09 14:39:51

标签: sql reporting-services ssrs-2008 axapta x++

我们必须为报告“LedgerAccountStatementPerCurrency”(AX 2012)开发一些功能。

其中一个功能是,为报表中的每个主要帐户显示期初余额(交易货币)。

我很久以前在SQL Server上编写了一个存储过程,它将此作为返回值。参数是mainaccountid,datefrom和dateto。

我的问题是,是否可以使用此存储过程? 报告依赖于类“LedgerAccountStatementPerCurrencyDP”,我可以实现,对于系统给报告的每个mainaccount,我调用我的存储过程给另一个字段中的余额回来了吗?

在这种情况下有什么办法?

1 个答案:

答案 0 :(得分:1)

对于此报告,您有此信息。检查LedgerAccountStatementPerCurrencyDPprocessReport方法。在while (queryRun.next())之后,您可以看到此标准代码来计算期初余额

在下一个代码中找到此标签//Here OpeningBalance

此处代码

...
...
...
queryRun = new QueryRun(query);
while (queryRun.next())
{
    generalJournalAccountEntry = queryRun.get(tableNum(GeneralJournalAccountEntry)) as GeneralJournalAccountEntry;
    generalJournalEntry = queryRun.get(tableNum(GeneralJournalEntry)) as GeneralJournalEntry;
    fiscalCalendarPeriod = queryRun.get(tableNum(FiscalCalendarPeriod)) as FiscalCalendarPeriod;
    dimAttrValueCombo = queryRun.get(tableNum(DimensionAttributeValueCombination)) as DimensionAttributeValueCombination;

    if (dimAttrValueCombo.MainAccount != prevMainAccount)
    {
        mainAccount = MainAccount::find(dimAttrValueCombo.MainAccount);
        localizedName = mainAccount.localizedName();
    }

    ledgerAccountStatementPerCurrencyTmp.clear();
    ledgerAccountStatementPerCurrencyTmp.MainAccountId = mainAccount.MainAccountId;
    ledgerAccountStatementPerCurrencyTmp.AccountName = localizedName;

    if (dimAttrValueCombo.MainAccount != prevMainAccount)
    {
        if (mainAccount && ledgerBalanceOpening)
        {
        //Here OpeningBalance
            ledgerBalanceOpening.calculateBalance(mainAccount);
            openingBalance = ledgerBalanceOpening.getAccountingCurrencyBalance();
        //Here OpeningBalance END
        }
        else
        {
            openingBalance = 0;
        }

        ledgerAccountStatementPerCurrencyTmp.OpeningBalance = openingBalance;
        ledgerAccountStatementPerCurrencyTmp.insert();

        prevMainAccount = dimAttrValueCombo.MainAccount;
    }
...
...
...