Showing posts with label Packing Slip. Show all posts
Showing posts with label Packing Slip. Show all posts

Tuesday, June 27, 2017

Post/Create Sales order Packing slip x++

Hi Folks,

Today i am going to show you code how to create and post Packing slip through x++;

static void createPostSalesPackingSlip(Args _args)
{
    SalesTable salesTable;
    SalesFormLetter salesFormLetter;

    salesTable = SalesTable::find('SO-ASC001');
      //Posting Sales Order 
    salesFormLetter=SalesFormLetter::construct(DocumentStatus::PackingSlip);
    salesFormLetter.update(SalesTable::find(sid));
       salesFormLetter.update(salesTable,systemDateGet(),SalesUpdate::All,AccountOrder::Non e, NoYes::No,NoYes::Yes);
    info("Sales Order Status is Delivered");
}

run this job.

X++ code to create Purchase Order Packing slip

X++ Code to Post the Purchase Order Packing Slip.

Following Job post the Packing Slip by using PurchFormLetter class.

static void CreatePOPackingSlip(Args _args)
{

    PurchFormLetter purchFormLetter;
    PurchTable          PurchTable;
    ttsbegin;
   PurchTable = PurchTable::find('PO-Demo');
   purchFormLetter = purchFormLetter::construct(DocumentStatus::PackingSlip);
   purchFormLetter.update(purchtable, // Purchase record Buffer
                           "Inv_"+purchTable.PurchId, // Invoice Number
                             systemdateget()); // Transaction date
ttscommit;
if (PurchTable::find(purchTable.PurchId).DocumentStatus ==           DocumentStatus::PackingSlip)
{
    info(strfmt("Posted Packing Slip for purchase order %1",purchTable.PurchId));
}
}

Now run the CreatePOPackingSlip job.