As shown in the above screenshot i have inserted a new field named Claim Percentage for the ARTran. After enter the values for the Quantity and Unit Price fields the Ext.Price should be calculated based on that two fields. Then If a value is entered to the Claim Percentage the Ext.Price should be updated as “Qty*UnitPrice*Claim Percenatge”. This is the my expected scenario.
In order to achieve this i have used a event handler in SOInvoiceEntry as shown in below.
public virtual void ARTran_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
{
ARTran row = (ARTran)e.Row;
if (row != null && row.Qty != null && row.CuryUnitPrice != null)
{
ARTranExt tranExt = PXCache<ARTran>.GetExtension<ARTranExt>(row);
if (tranExt != null && tranExt.UsrClaimPercentage != null)
{
decimal claimExtPrice = (decimal)(row.Qty * row.CuryUnitPrice * (tranExt.UsrClaimPercentage / 100));
sender.SetValue<ARTran.curyExtPrice>(row, claimExtPrice);
}
}
}
This is aligned with my requirement. However, right after entering the values for the Quantity,Unit Price and Claim Percentage fields the Ext.Price is not calculated. As shown in the above screenshot when another new blank record is inserted by double-clicking, the Ext.Price is getting updated as “Qty*UnitPrice*Claim Percenatge”.
But I'm expecting to update the Ext.Price immediately right after entering the values. So can I know how to achieve this?