2016-11-09 5 views
1

レポート「LedgerAccountStatementPerCurrency」(AX 2012)の機能をいくつか開発する必要があります。AXレポートメインカウント開始残高データセット

機能の1つは、レポートの各メインアカウントに対して開始時残高(取引通貨)を表示することです。

私はこれを返す値として私に与えてくれたSQL Serverに長い時間前にStored Procedureを書きました。パラメータはmainaccountid、datefrom、datetoです。

私はこのストアドプロシージャを使用することができますか? クラス "LedgerAccountStatementPerCurrencyDP"のレポートのデシジョンは、システムがレポートに与える各メインアカウントに対して、私は自分のストアドプロシージャを呼び出して別のフィールドのバランスを戻しますか?

この場合、どのような方法がありますか?

答えて

1

このレポートでは、この情報があります。 LedgerAccountStatementPerCurrencyDPクラスprocessReportメソッドをチェックしてください。ここで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; 
    } 
... 
... 
... 
+0

[OK]を見つけて、どのように私は「OpeningBalanceTransaction」とは、例えば報告書に与えられた新しいフィールドを追加することができますか?このコードセクションでは、私は私のストアドプロシージャ(dateFrom、dateTo、mainaccountID)に必要なすべてのものを持っていますので、ここで呼び出すことができ、新しい追加フィールド "OpeningBalanceTransaction"または? – JamesnxD

+0

はい、もちろん可能です。これを実行するには、 'LedgerAccountStatementPerCurrencyTmp'テーブルに新しいフィールドを作成する必要があります。 'ProcessReport'メソッドでこの新しいフィールドのコードを追加します。次に、** Visual Studio **で新しいフィールドに表示するデータソース 'LedgerAccountStatementPerCurrencyDS'をリフレッシュし、レイアウトで新しいフィールドを追加します。 –

+1

ok私はそれを試し、私の結果を掲示し、最高のあなたの答えをマーク;) – JamesnxD

関連する問題