public void FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { CurrencyInfo info = e.Row as CurrencyInfo; if (info != null && e.ExternalCall) { decimal rate = Math.Round((decimal)info.SampleRecipRate, 8); if (rate == 0) { rate = 1; } info.CuryRate = rate; info.RecipRate = Math.Round((decimal)(1 / rate), 8); info.CuryMultDiv = "D"; if (info.CheckRateVariance(sender)) { PXUIFieldAttribute.SetWarning(sender, e.Row, "SampleRecipRate", Messages.RateVarianceExceeded); } } }
public void FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { CurrencyInfo info = e.Row as CurrencyInfo; if (info == null || !e.ExternalCall) { return; } decimal rate = Math.Round((decimal)info.SampleCuryRate, 8); bool hasCurrencyRateDefaulted = false; if (rate == 0) { try { info.defaultCuryRate(sender); hasCurrencyRateDefaulted = true; } catch (PXSetPropertyException) { rate = 1; } } if (!hasCurrencyRateDefaulted) { info.CuryRate = rate; info.RecipRate = Math.Round(1m / rate, 8); info.CuryMultDiv = CuryMultDivType.Mult; } if (info.CheckRateVariance(sender)) { PXUIFieldAttribute.SetWarning <CurrencyInfo.sampleCuryRate>( sender, e.Row, Messages.RateVarianceExceeded); } }