protected virtual void XRBGLDist_UsrDiscountReasonID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { XRBGLDist row = (XRBGLDist)e.Row; if (row != null) { if (!(row.DiscPct > (decimal?)0.0)) { PXCache hCache = Base.Distributions.Cache; XRBGLDist hdr = Base.Distributions.Current; CAMPDiscountReasonCode rc = (CAMPDiscountReasonCode)PXSelectorAttribute.Select <XRBGLDistExt.usrDiscountReasonID>(hCache, hdr); if (rc != null) { row.DiscPct = rc.DefaultPct; } } } }
protected virtual void XRBGLDist_DiscPct_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e, PXFieldVerifying del) { XRBGLDist row = (XRBGLDist)e.Row; // Event handler body before the base BLC event handler collection if (row != null) { XRBGLDistExt distEx = PXCache <XRBGLDist> .GetExtension <XRBGLDistExt>(row); if (distEx != null && distEx.UsrDiscountReasonID > 0) { PXCache hCache = Base.Distributions.Cache; XRBGLDist hdr = Base.Distributions.Current; CAMPDiscountReasonCode rc = (CAMPDiscountReasonCode)PXSelectorAttribute.Select <XRBGLDistExt.usrDiscountReasonID>(hCache, hdr); if (rc != null) { if ((bool)rc.AllowChanges) { if ((bool)rc.AllowChanges && !(bool)rc.AllowOverMax) { if ((decimal)e.NewValue > rc.MaxPct) { throw new PXSetPropertyException <XRBGLDist.discPct>( "discount % greater then allowed Max % for discount reason code.", PXErrorLevel.Error); } } } else { throw new PXSetPropertyException <XRBGLDist.discPct>( "Cannot make changes to discount %", PXErrorLevel.Error); } } } } // Event handler body after the base BLC event handler collection if (del != null) { del(sender, e); } }