Hello,
I am having problems with the code below. When the PurchFormLetter.Run is executed the ‘reArrange’ method is deleting the PurchParmTable that has just been created! The object passed in is a class with ‘parms’ and a set of lines in it, this is information passed from a supplier as their invoice. Any help most appreciated.
Mike
boolean matchOrderInvoice(dbsBTPurchOrderInvoice _invoice)
{
try
{
purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);
purchFormLetter.getLast();
purchFormLetter.resetParmListCommonCS();
purchFormLetter.transDate(systemdateget());
purchFormLetter.allowEmptyTable(true);
purchFormLetter.purchTable(purchTable);
purchFormLetter.reArrangeNow(true);
purchFormLetter.jsProcessDropShipment(true);
purchFormLetter.parmCallerTable(purchTable);
purchFormLetter.createParmTable(purchParmTable,
purchTable,
purchName,
deliveryName,
deliveryAddress);
purchParmTable.TableRefId = FormLetter::getTableRef();
purchParmTable.VendInvoiceSaveStatus = VendInvoiceSaveStatus::Pending;
purchParmTable.Num = _invoice.parmInvoiceId();
purchParmTable.Hold = NoYes::Yes;
purchParmTable.insert();
purchFormLetter.parmParmTableNum(purchParmTable.Num);
purchFormLetter.sumNum(purchParmTable.Num);
purchFormLetter.specQty(PurchUpdate::ReceiveNow);
purchFormLetter.createParmUpdate(false);
for (i = 1; i <= _invoice.getLinesCount(); i++)
{
dbsBTPurchOrderInvoiceLine = _invoice.getInvoiceLine(i);
purchParmLine.ParmId = purchParmTable.ParmId;
purchParmLine.TableRefId = purchParmTable.TableRefId;
purchParmLine.ItemId = dbsBTPurchOrderInvoiceLine.parmItemId();
purchParmLine.PriceUnit = dbsBTPurchOrderInvoiceLine.parmPriceUnit();
purchParmLine.ReceiveNow = dbsBTPurchOrderInvoiceLine.parmPurchQty();
purchParmLine.RemainBefore = dbsBTPurchOrderInvoiceLine.parmPurchQty();
purchParmLine.InventNow = dbsBTPurchOrderInvoiceLine.parmPurchQty();
purchParmLine.RemainBeforeInvent = dbsBTPurchOrderInvoiceLine.parmPurchQty();
purchParmLine.PurchPrice = dbsBTPurchOrderInvoiceLine.parmPurchPrice();
purchParmLine.LineAmount = dbsBTPurchOrderInvoiceLine.parmLineAmount();
purchParmLine.insert();
}
purchFormLetter.run();
ret = purchParmTable.checkIfMatched();
}
catch
{
ret = false;
}
return ret;
}