Create purchase order

Source: Internet
Author: User
Frequently Used Code When creating purchase and sales orders, you need to find out which fields are mandatory. This code often needs to be copied and put here for a backup. Static   Void Createpurchdirectly (ARGs _ ARGs)
{
Purchtable;
Purchline;
Inventdim;
;
Ttsbegin;
// Purchtable
// Purchid
Purchtable. purchid = Numberseq: newgetnum (purchparameters: numrefpurchid (). Num ();
Purchtble. purchasetype = purchasetype: purch;
Purchtable. initvalue ();
// Vend account
Purchtable. initfromvendtable (vendtable: Find ( ' 3000 ' ));
Purchtable. insert ();
// Purchline
Purchline. initfrompurchtable (purchtable );
// Itemid
Purchline. Itemid =   ' B-pack1 ' ;
Purchline. initfrominventtable (inventtable: Find ( ' B-pack1 ' ));
// Qty
Purchline. purchqty =   100 ;
Purchline. qtyordered =   100 ;
Purchline. remaininventphysical =   100 ;
Purchline. remainpurchphysical =   100 ;
// Inventdim maybe shoshould add some other dimensions.
Inventdim. inventlocationid =   ' GW ' ;
Purchline. inventdimid = Inventdim: findorcreate (inventdim). inventdimid;
Purchline. insert ();
Ttscommit;



}

Static   Void Createpurchtablethroughaxpurch (ARGs _ ARGs)
{
Axpurchtable =   New Axpurchtable ();
Axpurchline =   New Axpurchline ();
Axinventdim_purchline axinventdim =   New Axinventdim_purchline ();
;
// Purchtable
// Order Account
Axpurchtable. parmorderaccount ( " 3000 " );
Axpurchtable. Save ();

// Purchline
// Purchid
Axpurchline. axpurchtable (axpurchtable );
// Itemid
Axpurchline. parmitemid ( " B-pack1 " );
// Qty
Axpurchline. parmpurchqty ( 100 );

// Inventdim maybe shocould add some other dimensions
Axinventdim. axpurchline (axpurchline );
Axinventdim. parminventlocationid ( ' MW ' );
Axpurchline. axinventdim (axinventdim );

Axpurchline. Save ();

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.