/// <summary> FieldUpdated ENGineering.opprid </summary> public void _(Events.FieldUpdated <ENGineering.opprid> e) { var _graphOpportunity = PXGraph.CreateInstance <OpportunityMaint>(); var row = e.Row as ENGineering; if (e.NewValue != null) { // Auto get Engineering Field Data CROpportunity _oppor = SelectFrom <CROpportunity> .Where <CROpportunity.opportunityID.IsEqual <P.AsString> > .View.ReadOnly.SelectSingleBound(this, new object[] { row }, e.NewValue); row.OppBAccountID = _oppor.BAccountID; row.EndCust = _oppor.GetExtension <CROpportunityExt>().UsrEndCust; row.SalesPerson = _oppor.GetExtension <CROpportunityExt>().UsrSalesPerson; row.SalesRegion = _oppor?.WorkgroupID.ToString(); // Auto Get Revenule Line Data if (this.RevenueLine.Select().Count == 0) { var _oppProduct = SelectFrom <CROpportunityProducts> .InnerJoin <CROpportunity> .On <CROpportunityProducts.quoteID.IsEqual <CROpportunity.defQuoteID> > .Where <CROpportunity.opportunityID.IsEqual <P.AsString> > .View.Select(this, row.Opprid).RowCast <CROpportunityProducts>(); foreach (var _prod in _oppProduct) { var _data = this.RevenueLine.Insert((ENGRevenueLine)this.RevenueLine.Cache.CreateInstance()); _data.InventoryID = _prod.InventoryID; _data.Descr = _prod.Descr; _data.Quantity = _prod.Quantity; _data.Uom = _prod.UOM; _data.UnitPrice = _prod.UnitPrice; _data.ExtPrice = _prod.ExtPrice; } } } }