zoukankan      html  css  js  c++  java
  • How to using x++ code create GL journal[AX2012]

    static void FAN_GLImport(Args _args)
    {
        AxLedgerJournalTable        header = new AxLedgerJournalTable();
        AxLedgerJournalTrans        trans = new AxLedgerJournalTrans();
        container                   ledgerDim, offsetDim;
        LedgerJournalNameId         ledgerJournalNameId = "GeneralJR";
        DimensionAttributeValueCombination  ledgerDimension;
        LedgerJournalACType         accType, offsetAccType;
        BankAccountTable            bankAccountTable;
    
        ;
        accType         = LedgerJournalACType::Ledger;
        offsetAccType   = LedgerJournalACType::Bank;
    
    
        header.parmJournalName(ledgerJournalNameId);
        header.save();
    
    
        trans.parmAccountType(accType);
        trans.parmJournalNum(header.ledgerJournalTable().JournalNum);
    
        //If account type is Ledger
        ledgerDim = ["142102-C-ADMIN","142102","C","ADMIN"];//First is Display value, followed by Main Account and then dimensions.
    
    
        //If account type is other than ledger then Switch case statement can be written to get RecId from DimensionAttributeValueCombination Table.
    
    
        trans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(ledgerDim));
        trans.parmAmountCurDebit(230);
        trans.parmOffsetAccountType(offsetAccType);
    
    
        switch(offsetAccType)
        {
            case    LedgerJournalACType::Bank   :   select firstOnly bankAccountTable
                                                        join RecId from ledgerDimension
                                                            where ledgerDimension.DisplayValue      == bankAccountTable.AccountID
                                                            &&    bankAccountTable.AccountID        == "ICICI Bank";
                                                    trans.parmOffsetLedgerDimension(ledgerDimension.RecId);
    
    
            //Same cases has to be written for others like Vendor, Customer. Except Account type ledger
            //If offset account type is ledger then trans.parmOffsetLedgerDimension() will only be supported.
        }
    
    
        //trans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId(offsetDim));
        trans.save();
    
    
    }
  • 相关阅读:
    R学习 第二篇:矩阵和数组
    R学习 第一篇:变量和向量
    PowerBI开发 第七篇:数据集和数据刷新
    PowerBI开发 第八篇:查询参数
    PowerBI开发 第六章:数据网管
    专用管理连接(DAC)和单用户模式
    PowerBI开发 第五篇:关系和交互
    PowerBI开发 第四篇:DAX 表达式基础
    PowerBI开发 第三篇:报表设计技巧
    分区表介绍
  • 原文地址:https://www.cnblogs.com/Fandyx/p/3342720.html
Copyright © 2011-2022 走看看