最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

在AX 2012中创建自由文本发票(FTI)的实用程序代码 / Utility code for creating the Free text invoice (FTI) in AX 2012

网络文摘 William 227浏览 0评论
Hi Guys, This post targeting developers and help creating free text invoice from code in dynamics ax 2012
 static void SimpleFtiCreation(Args _args)  
 {  
   custInvoiceTable custInvoiceTable;  
   custInvoiceLine custInvoiceLine;  
   custTable custTable;  
   int lineNum;  
   try  
   {  
     /// <summary>  
     ///   The <c>CustInvoiceTable</c> logic is implemented to create single <c>Header</c>.  
     /// </summary>  
     ttsbegin;  
     custInvoiceTable.clear();  
     custTable = CustTable::find("Test");  
     custInvoiceTable.initFromCustTable(custTable);  
     custInvoiceTable.InvoiceDate = systemDateGet();  
     custInvoiceTable.insert();  
     custInvoiceLine.clear();  
     custInvoiceLine.initValue();  
     custInvoiceLine.initFromCustInvoiceTable(custInvoiceTable);  
     custInvoiceLine.LedgerDimension = 89897878;  
     custInvoiceLine.DefaultDimension = 67676767;  
     custInvoiceLine.Quantity = 100;  
     custInvoiceLine.UnitPrice = 2.5;  
     custInvoiceLine.AmountCur = 250;  
     custInvoiceLine.Description = strFmt("Subscription %1", "Test") ;  
     custInvoiceLine.InvoiceTxt = strFmt("Subscription %1" , "Test") ;  
     custInvoiceLine.ParentRecId = custInvoiceTable.RecId;  
     custInvoiceLine.editReasonCode(true, 'Device Sub');  
     custInvoiceLine.editReasonComment(true, 'Device Subscription');  
     //LINE NUM LOGIC.  
     if(!lineNum)  
     {  
       lineNum = CustInvoiceLine::lastLineNum_W(custInvoiceLine.ParentRecId);  
     }  
     lineNum += 1;  
     custInvoiceLine.LineNum = lineNum;  
     custInvoiceLine.insert();  
     ttscommit;  
     //just to be sure for proper distributions  
     SourceDocumentProcessor::submitSourceDocumentLinesForHeader(custInvoiceTable.SourceDocumentHeader);  
   }  
   catch(exception::Error)  
   {  
   }  
 }  
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址