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 2012 中您不需要这样的功能。

来自FH-Inway 链接的白皮书(第 735 页):

在 Microsoft Dynamics AX 2009 中,LedgerPeriod 表和表单用于创建和维护公司的会计期间。

弃用原因:全球组织在不同地理区域作为不同的法律实体运作。但是,它们共享大量数据,例如会计科目表、货币、汇率和日历。一次定义此参考和主数据并在法人实体之间共享可降低在整个组织中维护此类数据的成本。但是,分类帐期间和相关的 AssetCalendar 表没有为这种情况提供足够的支持,并且已被更强大的共享财务日历所取代。

替换为另一个功能:该功能不再可用,并已替换为共享会计日历。

在General Ledger\Setup\Fiscal calendar中设置您的共享会计日历。

然后在Genreral Ledger\Setup\Ledger中选择该会计日历。

更新 2:

分类帐期间的关闭在分类帐日历中完成。一个期间的打开/关闭状态存储在表中LedgerFiscalCalendarPeriod。虽然它是全球性的,但它链接到Ledger每个公司都有一个的表。

因此,您无需对分类帐期间进行任何自定义。

于 2014-06-06T09:32:17.730 回答
2

您可以查看描述从 AX 2009 到 2012 更改的白皮书。至少在Microsoft Dynamics AX 2012 的新功能、更改功能和弃用功能中,您会发现多个关于会计年度更改的参考。您还可以在 TechNet 上查看白皮书中链接的关于会计日历、会计年度和期间 [AX 2012] 。

我通过浏览信息得到的是,现在所有公司都可以使用表格中的财政年度数据,因此无需将财政年度复制到其他公司。您似乎可以在分类帐中定义法人实体/公司应使用的会计年度。

于 2014-06-03T11:26:51.150 回答