示例#1
0
        public virtual IEnumerable Recalculate(PXAdapter adapter)
        {
            DRSchedule schedule = Base.DocumentProperties.Current;

            if (schedule.IsOverridden == true)
            {
                WebDialogResult result = Base.DocumentProperties.View.Ask(
                    Base.DocumentProperties.Current,
                    GL.Messages.Confirmation,
                    Messages.ClearOverriden,
                    MessageButtons.YesNo,
                    MessageIcon.Question);

                if (result != WebDialogResult.Yes)
                {
                    return(adapter.Get());
                }
            }

            schedule.IsOverridden   = false;
            schedule.IsRecalculated = false;
            Base.DocumentProperties.Update(schedule);

            SingleScheduleCreator.RecalculateSchedule(Base);

            return(adapter.Get());
        }
示例#2
0
        protected virtual void _(Events.FieldUpdated <DRSchedule, DRSchedule.isOverridden> e)
        {
            if (e.Row == null)
            {
                return;
            }

            if ((e.ExternalCall || e.Cache.Graph.IsImport) &&
                e.Row.IsOverridden == false && (bool)e.OldValue == true &&
                e.Row.DocType != null && e.Row.RefNbr != null)
            {
                SingleScheduleCreator.RecalculateSchedule(Base);
            }

            if ((e.ExternalCall || e.Cache.Graph.IsImport) &&
                e.Row.IsOverridden == true && (bool)e.OldValue == false &&
                e.Row.DocType != null && e.Row.RefNbr != null)
            {
                var copyRow = (DRSchedule)e.Cache.CreateCopy(e.Row);
                copyRow.IsRecalculated = false;
                e.Cache.Update(copyRow);
            }

            Base.ReallocationPool.View.RequestRefresh();
        }