首页 > 其他分享 >create PO and Post

create PO and Post

时间:2023-03-24 09:11:06浏览次数:23  
标签:PurchLine purchParmTable create PO purchParmUpdate purchFormLetter Post PurchId 

static void CreatePO(Args _args)
{
NumberSeq numberSeq;
Purchtable Purchtable;
PurchLine PurchLine;
PurchParmTable purchParmTable;
PurchFormLetter purchFormLetter;
InventDimId _inventDimId;
InventDim inventDim;
DocumentDate docDate;
PurchParmUpdate purchParmUpdate;
PurchFormletterParmData     purchFormLetterParmData;
Date myDate;
str test;
container  ledgerDimensions;
DimensionDefault dimensionDefault;



changeCompany("SomeCompany") //Inserts into specified company
{
   //numRefPurchaseOrderId()
ttsbegin;
numberSeq = NumberSeq::newGetNum(purchParameters::numRefPurchId());
_inventDimId="InventDimID";


// Initialize Purchase order values
Purchtable.initValue();
Purchtable.PurchId = numberSeq.num();


Purchtable.OrderAccount = 'OrderAccount';
Purchtable.initFromVendTable();

if (!Purchtable.validateWrite())
{
throw Exception::Error;
}
Purchtable.insert();


// Initialize Purchase Line items

PurchLine.clear();
PurchLine.initValue(purchTable.PurchaseType);
PurchLine.initFromPurchTable(Purchtable);
PurchLine.initFromInventTable(InventTable::find('SomeItem'));

PurchLine.PurchId = Purchtable.PurchId;
PurchLine.InventDimId="InventDimID";


PurchLine.PurchQty=1;
PurchLine.PurchUnit="EA2D";
ledgerDimensions = ['ItemGroup', 'SUMP'];

 dimensionDefault=AxdDimensionUtil::getDimensionAttributeValueSetId(ledgerDimensions);
 PurchLine.LedgerDimension=dimensionDefault;


    PurchLine.PriceUnit=1.0;
    PurchLine.PurchPrice=1;
   // purchLine.RemainPurchPhysical = purchLine.PurchQty;
   //  purchLine.QtyOrdered = purchLine.calcQtyOrdered();
    // purchLine.setPriceDisc(InventDim::find(purchLine.InventDimId));
   // PurchLine.LineDisc=1;
  // PurchLine.LinePercent=1;
   // PurchLine.PurchMarkup=1;
    //PurchLine.LineAmount=PurchLine.calcLineAmount();

   PurchLine.LineAmount=1;
//PurchLine.LinePercent=1;


PurchLine.createLine(true, true, false, true, true, false);


ttscommit;


 


    test="11/30/2018";
    myDate=str2Date(test,213);


          // Create PurchParamUpdate table
    purchFormLetterParmData = PurchFormletterParmData::newData(
        DocumentStatus::PurchaseOrder,
       VersioningUpdateType::Initial);


    purchFormLetterParmData.parmOnlyCreateParmUpdate(true);
    purchFormLetterParmData.createData(false);
    purchParmUpdate = purchFormLetterParmData.parmParmUpdate();
    purchParmUpdate.SpecQty=PurchUpdate::All;




    // Set PurchParmTable table

    purchParmTable.clear();
    purchParmTable.TransDate                = SystemDateGet();
    purchParmTable.DocumentDate = myDate;
    purchParmTable.Ordering                 = DocumentStatus::PurchaseOrder;
    purchParmTable.ParmJobStatus            = ParmJobStatus::Waiting;
    purchParmTable.PurchId                  = purchTable.PurchId;
    purchParmTable.PurchName                = purchTable.PurchName;
    purchParmTable.DeliveryName             = purchTable.DeliveryName;
    purchParmTable.DeliveryPostalAddress    = purchTable.DeliveryPostalAddress;
    purchParmTable.OrderAccount             = purchTable.OrderAccount;
    purchParmTable.CurrencyCode             = purchTable.CurrencyCode;
    purchParmTable.InvoiceAccount           = purchTable.InvoiceAccount;
    purchParmTable.ParmId                   = purchParmUpdate.ParmId;
    purchParmTable.Description="test";
    purchParmTable.Num=purchTable.PurchId;




     //if (purchParmTable.validateWrite())
        purchParmTable.insert();
  // else
       //throw Exception::Error;



         // Create PurchParamUpdate table
    purchFormletter = PurchFormLetter::construct(DocumentStatus::PurchaseOrder); // to post invoice change to DocumentStatus::invoice

    purchFormLetter.transDate(systemDateGet());
    purchFormLetter.proforma(false);
    purchFormLetter.specQty(PurchUpdate::All);
    purchFormLetter.purchTable(purchTable);

    purchFormLetter.parmParmTableNum(purchParmTable.ParmId);
    purchFormLetter.parmId(purchParmTable.ParmId);
    purchFormLetter.purchParmUpdate(purchParmUpdate);
    purchFormLetter.run();

     

   purchFormLetterParmData = PurchFormletterParmData::newData(
   DocumentStatus::Invoice,
   VersioningUpdateType::Initial);

    purchFormLetterParmData.parmOnlyCreateParmUpdate(true);
    purchFormLetterParmData.createData(false);
    purchParmUpdate = purchFormLetterParmData.parmParmUpdate();
    purchParmUpdate.SpecQty=PurchUpdate::All;


    purchParmTable.clear();
    purchParmTable.TransDate                = SystemDateGet();
    purchParmTable.DocumentDate = myDate;
    purchParmTable.Ordering                 = DocumentStatus::Invoice;
    purchParmTable.ParmJobStatus            = ParmJobStatus::Waiting;
    purchParmTable.PurchId                  = purchTable.PurchId;
    purchParmTable.PurchName                = purchTable.PurchName;
    purchParmTable.DeliveryName             = purchTable.DeliveryName;
    purchParmTable.DeliveryPostalAddress    = purchTable.DeliveryPostalAddress;
    purchParmTable.OrderAccount             = purchTable.OrderAccount;
    purchParmTable.CurrencyCode             = purchTable.CurrencyCode;
    purchParmTable.InvoiceAccount           = purchTable.InvoiceAccount;
    purchParmTable.ParmId                   = purchParmUpdate.ParmId;
    purchParmTable.Description="test";
    purchParmTable.Num=purchTable.PurchId;


   // purchParmTable.Description="test";


     //if (purchParmTable.validateWrite())
        purchParmTable.insert();

  

       purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);
    purchFormLetter.transDate(systemDateGet());
    purchFormLetter.proforma(false);
    purchFormLetter.specQty(PurchUpdate::All);
    purchFormLetter.purchTable(purchTable);

        purchFormLetter.parmParmTableNum(purchParmTable.ParmId);
    purchFormLetter.parmId(purchParmTable.ParmId);
    purchFormLetter.purchParmUpdate(purchFormLetterParmData.parmParmUpdate());
    // purchFormLetter.reArrangeNow(true);
    purchFormLetter.run();



    if (PurchTable::find(purchTable.PurchId).DocumentStatus == DocumentStatus::Invoice)
    {
    info(strfmt("Posted invoiced journal for purchase order %1",purchTable.PurchId));
    }



}

}

标签:PurchLine,purchParmTable,create,PO,purchParmUpdate,purchFormLetter,Post,PurchId,
From: https://www.cnblogs.com/lingdanglfw/p/17250221.html

相关文章

  • JAVAWEB-NOTE08-request&response
    目录request与response对象简介Request对象继承体系获取请求数据request通用方式获取请求参数Request请求中文乱码问题--POSTRequest请求中文乱码问题--GET请求转发Respons......
  • P3489 [POI2009]WIE-Hexer 题解
    一、题目描述:大陆上有 n 个村庄,m 条双向道路,p 种怪物,k 个铁匠,铁匠都在一个村庄里,他可会给你打造他所能打造的所有剑,特定的剑可以对付特定的怪物,每条道路上都可......
  • 数据库系列:postgresql中boolean字段与smallint字段的自动转换
    1、使用postgre账号进入到相应的模式下执行:CREATEORREPLACEFUNCTIONboolean_to_smallint(bboolean)RETURNSsmallintAS$$BEGINRETURN(b::bool......
  • Styled Components 备忘清单_开发速查表分享
    StyledComponents备忘清单IT宝库整理的StyledComponents快速参考备忘单提供了使用CSSinJS工具的各种方法入门,为开发人员分享快速参考备忘单。开发速查表大纲入......
  • Styled Components 备忘清单_开发速查表分享
    StyledComponents备忘清单IT宝库整理的StyledComponents快速参考备忘单提供了使用CSSinJS工具的各种方法入门,为开发人员分享快速参考备忘单。开发速查表大纲入......
  • box_roi_pooling 网络结构解释
    fasterrcnn中ROIPooling与SPP理解、一、结构说明1、box_roi_pooling在FaterRCNN整体框架中对应ROIpooling位置2、POIpooling后接全连接层网络TwoMLPHead1)参考代......
  • CF1791F - Range Update Point Query
    题目地址题意:给你一个数组a,进行q次操作有两种操作:1:给出一个区间[l,r],令该区间内所有数都变成他们自身每一位数字的和2:给出x,输出a[x]的值Solution显然可以发现,当数......
  • Go语言并发编程(4):sync包介绍和使用(下)-Once,Pool,Cond
    sync包下:Once,Pool,Cond一、sync.Once执行一次Once简介sync.Once是Go提供的让函数只执行一次的一种实现。如果once.Do(f)被调用多次,只有第一次调用会调用f。......
  • SPP(Spatial Pyramid Pooling:空间金字塔)
    fasterrcnn中ROIPooling与SPP理解、一、SPP作用1、目的:将不同大小的窗口输入得到同样大小的窗口输出1)解释:在卷积的操作中,对输入的尺寸是没有限制的,但是大多数网络结......
  • SAP ABAP调用SD_SALESDOCUMENT_CREATE创建销售订单定价类型为PR00或ZPR1的特殊处理
    "录入价格相关数据    SELECT SINGLE"通过销售组织 分销渠道获取到客户的定价过程 用于判断价格是用pr00 还是zpr1          t~vkorg,        ......