Hi,
I have customized a new screen. To my screen I’m getting data from soorder DAC and soline DAC. This time, I need to get sales orders without duplicating from the view to my custom screen. When new row is inserted into my line level, I need to update TotalDiscount field of header level with soorder.curydisctot value which is taken from the soorder screen header level. To accomplish avoid duplicating when adding same sales order number , I tried the below code in the row inserted event but it didn’t work.
protected void APProformaItemList_RowInserted(PXCache cache, PXRowInsertedEventArgs e)
{
var row = (APProformaItemList)e.Row;
APProforma item = APProformas.Current;
//add so discount into form
var distinctSOLines = this.APProformaItems.Select().FirstTableItems.ToList().Select(x => x.Ponbr).Distinct();
foreach(var itemlist in distinctSOLines)
{
SOOrder order= SelectFrom<SOOrder>.Where<SOOrder.orderNbr.IsEqual<SOOrder.orderNbr>>.View.Select(this, itemlist);
item.TotalDiscount = item.TotalDiscount+order.CuryDiscTot;
}
}
APProformaItemList - line level dac
APProforma - header leveldac
ApproformaItems - line level view
ponbr= foreign reference with soline dac
Have I done something wrong in this code or is there any other work around to accomplish this? can someone help me with this?
Thank you in advance.