static void OrderCreate(Args _args)
{
NumberSeq numberSeq;
PurchTable purchTable;
PurchLine purchLine;
purchFormLetter purchFormLetter;
ttsBegin;
numberSeq = NumberSeq::newGetNum(PurchParameters::numRefPurchId());
numberSeq.used();
purchTable.PurchId = numberSeq.num();
purchTable.initValue();
// po creation
purchTable.initFromVendTable(VendTable::find('1100'));
if (!purchTable.validateWrite())
{
throw Exception::Error;
}
purchTable.insert();
purchLine.PurchId = purchTable.PurchId;
purchLine.ItemId = 'D0006';
purchLine.createLine(true, true, true, true, true, true);
ttsCommit;
info(strFmt("Purchase order '%1,%2' has been created", purchTable.PurchId, purchTable.DeliveryDate));
// po confirmation
purchformletter = purchformletter::construct(documentstatus::purchaseorder);
purchformletter.update(purchtable, strfmt("inv_%1", purchtable.purchid));
info(strFmt("purchase order '%1' has been confirmed", purchTable.DeliveryDate));
// po Invoice
purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);
purchFormLetter.update(purchTable, strFmt("Inv_%1", purchTable.PurchId));
info(strFmt(" Purchase order '%1' has been invoiced", purchtable.InvoiceAccount));
}
{
NumberSeq numberSeq;
PurchTable purchTable;
PurchLine purchLine;
purchFormLetter purchFormLetter;
ttsBegin;
numberSeq = NumberSeq::newGetNum(PurchParameters::numRefPurchId());
numberSeq.used();
purchTable.PurchId = numberSeq.num();
purchTable.initValue();
// po creation
purchTable.initFromVendTable(VendTable::find('1100'));
if (!purchTable.validateWrite())
{
throw Exception::Error;
}
purchTable.insert();
purchLine.PurchId = purchTable.PurchId;
purchLine.ItemId = 'D0006';
purchLine.createLine(true, true, true, true, true, true);
ttsCommit;
info(strFmt("Purchase order '%1,%2' has been created", purchTable.PurchId, purchTable.DeliveryDate));
// po confirmation
purchformletter = purchformletter::construct(documentstatus::purchaseorder);
purchformletter.update(purchtable, strfmt("inv_%1", purchtable.purchid));
info(strFmt("purchase order '%1' has been confirmed", purchTable.DeliveryDate));
// po Invoice
purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);
purchFormLetter.update(purchTable, strFmt("Inv_%1", purchTable.PurchId));
info(strFmt(" Purchase order '%1' has been invoiced", purchtable.InvoiceAccount));
}
- Make sure that warehouse and site are specified for the given product in product information management->manage inventory->default order settings and site specific order settings.
- If warehouse and site are not specified for the given item.
- If not specified it will throw error as site and warehouse must be specified for the given item.
No comments:
Post a Comment