zoukankan      html  css  js  c++  java
  • AX 过账自由文本发票

    通过代码产生自由文本发票,并过账该文本发票。

    View Code
    static void FreeTextInvoicePost(CustAccount _custAccount, LedgerAccount _ledgerAccount)
    {
        CustInvoiceTable    custInvoiceTable;
        CustInvoiceLine     custInvoiceLine;
        CustTable           custTable;
        LedgerTable         ledgerTable;
        CustPostInvoice     custPostInvoice;
        LineNum             lineNum;
        int                 i;
        ;
    
        /// <summary>
        /// The <c>CustInvoiceTable</c> logic is implemented to create single <c>Header</c>.
        /// </summary>
        ttsbegin;
        custTable = CustTable::find(_custAccount);
        custInvoiceTable.initFromCustTable(custTable);
        custInvoiceTable.insert();
        ttscommit;
    
        /// <summary>
        /// The <c>CustInvoiceLine</c> logic is implemented to create multiple <c>Invoice Lines</c>.
        /// </summary>
        for (i = 1; i <= 100; i++)
        {
            ttsbegin;
            ledgerTable = LedgerTable::find(_ledgerAccount);
            custInvoiceLine.clear();
            custInvoiceLine.initValue();
            custInvoiceLine.LedgerAccount = ledgerTable.AccountNum;
            custInvoiceLine.initFromCustInvoiceTable(custInvoiceTable);
            custInvoiceLine.AmountCur = 10.00;
            custInvoiceLine.Description = "Free Text Invoice"+ int2str(i);
            custInvoiceLine.TaxItemGroup = "full";
            custInvoiceLine.ParentRecId = custInvoiceTable.RecId;
    
            //LINE NUM LOGIC.
            if(!lineNum)
            {
             lineNum = CustInvoiceLine::lastLineNum(custInvoiceLine.ParentRecId);
            }
    
            lineNum += 1;
            custInvoiceLine.LineNum = lineNum;
            custInvoiceLine.insert();
            ttscommit;
        }
    
        /// <summary>
        /// The <c>custPostInvoice</c> class is called for posting <c>Free-TextInvoice.</c> records.
        /// </summary>
        custPostInvoice = new CustPostInvoice(custInvoiceTable);
        custPostInvoice.run();
    }

    运行得到结果

  • 相关阅读:
    UVa 122 Trees on the level
    UVa 623 500!
    UVa 424 Integer Inquiry
    UVa 10082 WERTYU
    关于c语言的输入输出
    (转)提问的智慧for oracle
    根据输入的用户ID串,返回用户名字串:TRIM函数的使用
    转:Oracle数据库一致性读的原理(Consistent Read)
    Instr()函数的使用计算字符串中出现某个字母或单词的个数
    RETURNING的使用:
  • 原文地址:https://www.cnblogs.com/dingkui/p/2687093.html
Copyright © 2011-2022 走看看