Ejemplo n.º 1
0
            public void FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
            {
                CurrencyInfo info = e.Row as CurrencyInfo;

                if (info != null)
                {
                    try
                    {
                        info.defaultCuryRate(sender);
                    }
                    catch (PXSetPropertyException ex)
                    {
                        sender.RaiseExceptionHandling(_FieldName, e.Row, sender.GetValue(e.Row, _FieldOrdinal), ex);
                    }
                }
            }
Ejemplo n.º 2
0
            public void FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
            {
                CurrencyInfo info = e.Row as CurrencyInfo;

                if (info != null)
                {
                    //reset effective date to document date first
                    info.SetDefaultEffDate(sender);
                    try
                    {
                        info.defaultCuryRate(sender);
                    }
                    catch (PXSetPropertyException ex)
                    {
                        sender.RaiseExceptionHandling(_FieldName, e.Row, sender.GetValue(e.Row, _FieldOrdinal), ex);
                    }
                    info.CuryPrecision = null;
                }
            }
Ejemplo n.º 3
0
            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);
                }
            }