I am using the below code for the confirmation of a sales order and then picking it. For confirming
public void confirmSO()
{
salesTable = SalesTable::find(salesTable.SalesId);
salesFormletter = SalesFormletter::construct(DocumentStatus::PickingSlip);
salesFormletter.update(salesTable, systemDateGet(), SalesUpdate::All, AccountOrder::None,
false, false);
}
and for picking
public void pickSlip()
{
salesTable = salesTable::find(salesTable.SalesId);
salesFormLetter = SalesFormLetter_PickingList::newPickingList();
salesFormLetter.transDate(systemDateGet());
salesFormLetter.update(salesTable,
systemdateget(),
SalesUpdate::All,
AccountOrder::None,
NoYes::No,
NoYes::No);
}
now how to pack it? and convert its status to "Delivered" and how to generate invoice for it and change its status to "Invoiced"?
Check this code to delivered and post invoice:
//Delivered Sales Order
ttsbegin;
//update Sales Line
salesLine = SalesLine::find(_salesId, _lineNum, true);
salesLine.SalesDeliverNow = -1;
salesLine.setInventDeliverNow();
salesLine.doUpdate();
//Post the delivery
salesFormLetter = SalesFormLetter::construct(DocumentStatus::PackingSlip);
salesFormLetter.progressHide(); // Hide the progress bar.
salesFormLetter.update(salesTable, // SalesTable
SystemDateGet(), // Delivery date
SalesUpdate::DeliverNow, // Quantity to update (SpecQty)
AccountOrder::None, // AccountOrder
false, // Proforma only?
false); // Printout?
ttscommit;
//Post the Sales Order Invoice
SalesFormLetter::construct(DocumentStatus::Invoice).update(SalesTable::find(_salesId));
info("Sales order posted");