//update purchase orderPurchFormLetterParmData purchFormLetterParmData;purchFormLetterParmData = PurchFormletterParmData::newData(DocumentStatus::Confirmation, VersioningUpdateType::Correction);
//update purchase orderPurchFormLetterParmData purchFormLetterParmData;purchFormLetterParmData = PurchFormletterParmData::newData(DocumentStatus::Confirmation, VersioningUpdateType::Correction);
purchFormLetterParmData = PurchFormletterParmData::newData(DocumentStatus::PurchaseOrder,
VersioningUpdateType::Initial);
purchFormLetterParmData.parmOnlyCreateParmUpdate(true);
purchFormLetterParmData.createData(false);
purchParmUpdate = purchFormLetterParmData.parmParmUpdate();
purchParmTable.clear();
purchParmTable.TransDate = DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone());
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.DocumentDate = purchTable.AccountingDate;
purchParmTable.Payment = purchTable.Payment;
purchParmTable.ParmId = purchParmUpdate.ParmId;
purchParmTable.insert();
List puchLinesList = _request.parmPurchLineList();
ListIterator literator = new ListIterator(puchLinesList);
while (literator.more())
{
MyLineRequest updateLineRequest;
updateLineRequest = literator.value();
LineNum lineNum;
ItemId itemId;
Price purchPrice;
lineNum = updateLineRequest.parmLineNum();
itemId = updateLineRequest.parmItemId();
purchPrice = updateLineRequest.parmPurchPrice();
PurchLine purchLine;
select purchLine
where purchLine.PurchId == purchTable.PurchId
&& purchLine.LineNumber == lineNum
&& purchLine.ItemId == itemId;
if (purchLine)
{
purchParmLine.clear();
purchParmLine.InitFromPurchLine(purchLine);
purchParmLine.ParmId = purchParmTable.ParmId;
purchParmLine.TableRefId = purchParmTable.TableRefId;
purchParmLine.PurchPrice = purchPrice;
purchParmLine.setQty(DocumentStatus::PurchaseOrder, false, true);
purchParmLine.setLineAmount();
purchParmLine.insert();
literator.next();
}
purchFormLetter = PurchFormLetter::construct(DocumentStatus::PurchaseOrder);
purchFormLetter.transDate(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()));
purchFormLetter.proforma(false);
purchFormLetter.specQty(PurchUpdate::All);
purchFormLetter.purchTable(purchTable);
purchFormLetter.parmParmTableNum(purchParmTable.ParmId);
purchFormLetter.parmId(purchParmTable.ParmId);
purchFormLetter.purchParmUpdate(purchFormLetterParmData.parmParmUpdate());
purchFormLetter.run();
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,532 Super User 2024 Season 2
Martin Dráb 228,501 Most Valuable Professional
nmaenpaa 101,148