I had to add new field into SO303000 screen Detail Grid.
Field name - Claim Percentage
When the above filed is updated or entered amount need to be calculated like below formula.
Amount = Amount*(Claim Percentage/100)
When add the claim percentage without discount amount, It's calculations are okey.
In my case,After I have add the quantity,unit price and discount amount , the Amount shows below like that.
Then,I added the claim percentage.
When I add the claim percentage, Discount Amount,Discount percentage and Amount all the fields are changed.Why this is happened and how I resolve this?
Below I have attached my claim p field updated event.
protected void ARTran_UsrClaimPercentage_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
var row = (ARTran)e.Row;
ARTranExt detail = PXCache<ARTran>.GetExtension<ARTranExt>(row);
if(detail.UsrClaimP == null || detail.UsrClaimP == 0){
decimal? val1 =detail.UsrClaimPercentage/100;
decimal? val = row.CuryTranAmt*val1;
row.CuryTranAmt = val;
detail.UsrCuryTAmt = val;
}else{
decimal? actualAmount = (row.CuryTranAmt*100)/detail.UsrClaimP ;
row.CuryTranAmt = (actualAmount*detail.UsrClaimPercentage)/100;
detail.UsrCuryTAmt=(actualAmount*detail.UsrClaimPercentage)/100;
}
detail.UsrClaimP = detail.UsrClaimPercentage;
// cache.SetValueExt<ARTran.curyTranAmt>(row, val);
}
Best answer by davidnavasardyan09
View original