zoukankan      html  css  js  c++  java
  • X++ Code to Create Purchase Order and Post the Invoice

    Following Job creates the Purchase order from code and post the invoice by making use of PurchFormLetter class.
    If you don't have demo data , please test with your input values.

     1 static void Dev_CreatePO_and_Invoice(Args _args)
     2 {
     3   NumberSeq numberSeq;
     4   Purchtable Purchtable;
     5   PurchLine PurchLine;
     6   PurchFormLetter purchFormLetter;
     7   ;
     8  9 
    10   ttsbegin;
    11   numberSeq = NumberSeq::newGetNumFromCode(purchParameters::numRefPurchaseOrderId().NumberSequence,true);
    12 
    13   // Initialize Purchase order values
    14   Purchtable.initValue();
    15   Purchtable.PurchId = numberSeq.num();
    16   Purchtable.OrderAccount = '3000';
    17   Purchtable.initFromVendTable();
    18 
    19   if (!Purchtable.validateWrite())
    20   {
    21     throw Exception::Error;
    22   }
    23   Purchtable.insert();
    24 
    25   // Initialize Purchase Line items
    26   PurchLine.PurchId = Purchtable.PurchId;
    27   PurchLine.ItemId = 'B-R14';
    28   PurchLine.createLine(true, true, true, true, true, false);
    29   ttscommit;
    30 
    31   purchFormLetter = purchFormLetter::construct(DocumentStatus::Invoice);
    32   purchFormLetter.update(purchtable, // Purchase record Buffer
    33                 "Inv_"+purchTable.PurchId, // Invoice Number
    34                systemdateget()); // Transaction date
    35 
    36 
    37   if (PurchTable::find(purchTable.PurchId).DocumentStatus == DocumentStatus::Invoice)
    38   {
    39     info(strfmt("Posted invoiced journal for purchase order %1",purchTable.PurchId));
    40   }
    41 }
  • 相关阅读:
    给webstorm换个背景图
    css遮罩 mask属性
    svg图标
    BFC原理
    轮播图与图片查看器
    超大分辨率屏幕适配方案
    移动端适配-动态计算rem
    [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. 报错
    由于ie浏览器ajax缓存 导致layui table表格重载失败的解决办法
    实现线程操作的三种方法
  • 原文地址:https://www.cnblogs.com/Jinnchu/p/2658780.html
Copyright © 2011-2022 走看看