0

Dynamics AX2012 R2 CU7 を実行しており、コーディングしました:,

"すでに設定されているベース会社からすべての会社に会計年度をコピーする",

Dynamics AX 2009 であったソース システムの機能です。Dynamics AX 2012 R2、CU7 の構造は非常に異なるため、X++ コーディングを使用して同じ機能を実現する方法がわかりません。

元のコード:

void clicked()
{
  ModulePeriodStat ledger, bank, cust, asset, invent, prod, proj, purch, sales, tax, vend ;
    PeriodEnd        period;
    LedgerPeriod     ledgerPeriod2;
    CompanyInfo      companyInfo;
    Dialog                  dlg;
    ;

    super();

    dlg = new Dialog("Confirm: ");
    dlg.addText("You will create these periods in all companies "+date2str(period,321,2,2,2,2,4));
    dlg.run();
    if ((dlg.closedOk()))
    {
    ttsbegin;

    while select crosscompany companyInfo
    {
    if (companyInfo.dataAreaId != 'ct11' && companyInfo.dataAreaId != 'ct13' && companyInfo.dataAreaId != 'md11' && companyInfo.dataAreaId != 'mf11')
    changecompany(companyInfo.dataAreaId)
    {
        ledgerPeriod2 = null;
    while select forUpdate ledgerPeriod     // where (ledgerPeriod.PeriodEnd == period)
    {
        ledger = ledgerPeriod.StatusLedger;
        bank = ledgerPeriod.StatusBank;
        cust = ledgerPeriod.StatusCust;
        asset = ledgerPeriod.StatusFixedAsset;
        invent = ledgerPeriod.StatusInvent;
        prod = ledgerPeriod.StatusProd;
        proj = ledgerPeriod.StatusProj;
        purch = ledgerPeriod.StatusPurch;
        sales = ledgerPeriod.StatusSalesOrder;
        tax = ledgerPeriod.StatusTax;
        vend = ledgerPeriod.StatusVend;
        period = ledgerPeriod.PeriodEnd;
        ledgerPeriod2.PeriodStart = ledgerPeriod.PeriodStart;
        ledgerPeriod2.PeriodCode = ledgerPeriod.PeriodCode;
        ledgerPeriod2.PeriodEnd = period;
        ledgerPeriod2.PeriodStatus = ledgerPeriod.PeriodStatus;
        ledgerPeriod2.Commentaries = ledgerPeriod.Commentaries;
        ledgerPeriod2.StatusLedger = ledger;
        ledgerPeriod2.StatusBank = bank;
        ledgerPeriod2.StatusCust = cust;
        ledgerperiod2.StatusFixedAsset = asset;
        ledgerPeriod2.StatusInvent = invent;
        ledgerPeriod2.StatusProd = prod;
        ledgerperiod2.StatusProj = proj;
        ledgerPeriod2.StatusPurch = purch;
        ledgerperiod2.StatusSalesOrder = sales;
        ledgerPeriod2.StatusTax = tax;
        ledgerperiod2.StatusVend = vend;
        try
        {
        ledgerperiod2.insert();
        }
        catch (Exception::DuplicateKeyException)
        {
            period = period;
            print('Problem encountered with company: '+companyinfo.dataAreaId);
        }
    }
    }
    }
    ttscommit;
    box::info('Periods Created Successfully');
    }
}
4

2 に答える 2

2

AX 2009 から 2012 への変更について説明しているホワイト ペーパーを参照してください。少なくとも、Microsoft Dynamics AX 2012 の新機能、変更された機能、および廃止された機能では、会計年度に関する変更について複数の参照が見つかります。また、ホワイト ペーパーにリンクされている TechNet の会計カレンダー、会計年度、および期間について [AX 2012]を確認することもできます。

情報をざっと見てわかったのは、会計年度のテーブルのデータがすべての会社で利用できるようになったので、会計年度を他の会社にコピーする必要がないということです。法人/会社が使用する会計年度を元帳で定義できるようです。

于 2014-06-03T11:26:51.150 に答える