zoukankan      html  css  js  c++  java
  • AX 2012 Create and post Vendor Invoice Journals

    static void  createVendorInvoiceJournal(Args _args)
    {
        LedgerJournalCheckPost  jourCheckPost;
        LedgerJournalTable      jourTable;
    
        AxLedgerJournalTable    header  = new AxLedgerJournalTable();
        AxLedgerJournalTrans    trans   = new AxLedgerJournalTrans();
    
        container               offsetDim;
    
        // The AP invoice journal name, could vary.
        LedgerJournalNameId     ledgerJournalNameId = "AP";
    
        // This is the entry against the Vendor account.
        // It will have to pre-exist for this script to work.
        // It is probably created the first time such an entry is
        // made on a journal line.
        DimensionAttributeValueCombination  davc;
    
        LedgerJournalACType         accType, offsetAccType;
    
        BankAccountTable            bankAccountTable;
    
        accType         = LedgerJournalACType::Vend;
        offsetAccType   = LedgerJournalACType::Ledger;
    
        header.parmJournalName(ledgerJournalNameId);
        header.parmJournalType(LedgerJournalType::VendInvoiceRegister);
        header.save();
    
        trans.parmAccountType(accType);
        trans.parmJournalNum(header.ledgerJournalTable().JournalNum);
    
        offsetDim   = ["52121-Disp", "52121", 2, "Site", "OK", "Department", "204"];    //First is Display value, followed by Main Account and then dimensions.
    
        trans.parmAccountType(LedgerJournalACType::Vend);
      
        // Note: This only works if the DimensionValueAttributeCombindation record
        // exists from before.
        select firstonly RecId from davc
            where davc.DisplayValue == "Vendor123"; //Vendor123 is the vendor account number.
    
        trans.parmLedgerDimension(davc.RecId);
    
        //There's a parm method for credit as well.
        trans.parmAmountCurDebit(99.15);
        trans.parmOffsetAccountType(offsetAccType);
    trans.clearField(fieldNum(ledgerJournalTrans, offsetLedgerDimension), false); trans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId(offsetDim)); trans.save(); jourTable = header.ledgerJournalTable(); if (jourTable.RecId > 0) { jourCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(jourTable, NoYes::Yes, NoYes::Yes); // Post only if there is succesful validation. if (jourCheckPost.validate()) { jourCheckPost.run(); } } }
  • 相关阅读:
    CentOS7----Linux Root忘记,进入救援模式更改密码(两种方法!)
    Linux/CentOS7install PackageError: Loaded plugins: fastestmirror
    LinuxCentOSamba7关闭SELinux重新启动失败出现:Failed to load SElinux policu freezing
    Github Page + Hexo 搭建个人博客
    Selenium的使用
    Linux下使用Selenium进行自动化测试
    Python学习-网络编程
    Python学习-多线程和多进程
    Python学习-从面向对象开始
    Linux安装Jupyter并且远程访问
  • 原文地址:https://www.cnblogs.com/fogfog/p/6121369.html
Copyright © 2011-2022 走看看