public virtual void _(Events.FieldVerifying <AMMTran.qty> e, PXFieldVerifying baseMethod) { var row = e.Row as AMMTran; var inputValue = e.NewValue; if (!(row.GetExtension <AMMTranExt>().UsrOverIssue ?? false)) { baseMethod?.Invoke(e.Cache, e.Args); } // valid over Issue else { var amProdMatl = SelectFrom <AMProdMatl> .Where <AMProdMatl.prodOrdID.IsEqual <P.AsString> .And <AMProdMatl.inventoryID.IsEqual <P.AsInt> > > .View.Select(Base, row.ProdOrdID, row.InventoryID) .RowCast <AMProdMatl>().FirstOrDefault(); var maxOverIssue = SelectFrom <LifeSyncPreference> .View.Select(Base).RowCast <LifeSyncPreference>().FirstOrDefault().MaxOverIssue; var overIssueQty = Math.Round((amProdMatl?.TotalQtyRequired ?? 0) * (1 + (maxOverIssue ?? 0) / 100), 4); if ((decimal?)e.NewValue > overIssueQty) { e.NewValue = overIssueQty; e.Cache.SetValue <AMMTran.qty>(row, overIssueQty); throw new PXSetPropertyException <AMMTran.qty>($"Material Quantity {inputValue} to be issued is greater then maximum allowed over issue {overIssueQty}"); } } }
protected void Customer_CustomerClassID_FieldVerifying(PXCache cache, PXFieldVerifyingEventArgs e, PXFieldVerifying InvokeBaseHandler) { if (!_disableVerifying) { InvokeBaseHandler(cache, e); } }
protected virtual void ARTran_DiscPct_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e, PXFieldVerifying del) { ARTran row = (ARTran)e.Row; // Event handler body before the base BLC event handler collection if (row != null) { ARTranExt distEx = PXCache <ARTran> .GetExtension <ARTranExt>(row); if (distEx != null && distEx.UsrDiscountReasonID > 0) { PXCache hCache = Base.Transactions.Cache; ARTran hdr = Base.Transactions.Current; CAMPDiscountReasonCode rc = (CAMPDiscountReasonCode)PXSelectorAttribute.Select <ARTranExt.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 <ARTran.discPct>( "discount % greater then allowed Max % for discount reason code.", PXErrorLevel.Error); } } } else { throw new PXSetPropertyException <ARTran.discPct>( "Cannot make changes to discount %", PXErrorLevel.Error); } } } } // Event handler body after the base BLC event handler collection if (del != null) { del(sender, e); } }
protected virtual void _(Events.FieldVerifying <POOrder, POOrder.projectID> args, PXFieldVerifying baseMethod) { if (IsSubcontractScreen()) { var projectId = (int?)args?.NewValue; if (NeedToVerifyProjectId(projectId)) { VerifyProjectLockCommitments(projectId); } } else { baseMethod(args.Cache, args.Args); } }
protected virtual void Customer_TaxRegistrationID_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e, PXFieldVerifying InvokeBaseHandler) { if (InvokeBaseHandler != null) { InvokeBaseHandler(sender, e); } Customer customer = e.Row as Customer; if (customer == null) { return; } var value = e.NewValue as string; if (this.Base.BillAddress.Current?.CountryID == "MX") { Regex regex = new Regex(@"[A-Z,Ñ,&]{3,4}[0-9]{2}[0-1][0-9][0-3][0-9][A-Z,0-9]?[A-Z,0-9]?[0-9,A-Z]?"); Match match = regex.Match(value); if (match.Length < 12 || match.Length > 13 || !match.Success) { e.Cancel = true; sender.RaiseExceptionHandling <Customer.taxRegistrationID>( e.Row, e.NewValue, new PXSetPropertyException(Messages.TaxRegistrationIDInvalid, PXErrorLevel.RowError)); } if (!string.IsNullOrEmpty(value) && value != value.ToUpper()) { e.NewValue = value.ToUpper(); } } }