If a Purchase Order (PO) is linked to a Purchase Requisition (PR), fetch the Name from the PR and populate it in the Description field of the Product Receipt form.
[ExtensionOf(formDataSourceStr(PurchEditLines,PurchParmTable))]
internal final class PurchParmTableFormDataSource_Extension
{
public void executeQuery()
{
next executeQuery();
PurchReqTable purchReqTable;
PurchReqLine purchReqLine;
FormStringControl Invoicedescription = this.formRun().design().controlName("PurchParmTable_Description");
PurchParmTable purchParmTable = this.cursor();
select firstOnly purchReqLine
where purchReqLine.PurchId == purchParmTable.PurchId
&& purchReqLine.INVENTDIMIDDATAAREA == purchParmTable.DataAreaId;
if (purchReqLine.RecId)
{
select firstOnly purchReqTable
where purchReqTable.RecId == purchReqLine.PurchReqTable;
if (purchReqTable.RecId)
{
purchParmTable.Description = purchReqTable.PurchReqName;
Invoicedescription.allowEdit(false);
}
}
else
{
FormStringControl descriptionCtrl = this.formRun().design().controlName('PurchParmTable_Description'); // Control name in the form
if (descriptionCtrl)
{
descriptionCtrl.mandatory(true);
}
}
}
}
No comments:
Post a Comment