-
-
Save kjrichardson/f2e61fdfb78367cb86ff1c8dd370386b to your computer and use it in GitHub Desktop.
This Acumatica code will popup a smart panel, prompt for the PO number, and change it on the AR Invoice document.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using PX.Data; | |
using System; | |
using PX.Objects.AR; | |
using System.Collections; | |
namespace HaunWelding.Customizations | |
{ | |
public class ARInvoiceEntry_Extension : PXGraphExtension<ARInvoiceEntry> | |
{ | |
public PXFilter<HWChangePONbrDAC> HWChangePONbrView; | |
public PXAction<ARInvoice> ChangePONbr; | |
[PXUIField(DisplayName = "Change PO Nbr", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)] | |
[PXUIEnabled(typeof(Where<ARInvoice.status.IsNotEqual<ARDocStatus.closed>.And<ARInvoice.status.IsNotEqual<ARDocStatus.canceled>>>))] | |
[PXButton(Category = "Corrections", CommitChanges = true)] | |
protected virtual IEnumerable changePONbr(PXAdapter adapter) | |
{ | |
if(HWChangePONbrView.AskExt() == WebDialogResult.OK) | |
{ | |
ARInvoice invoice = Base.Document.Current; | |
if (invoice == null) | |
return adapter.Get(); | |
var Filter = HWChangePONbrView.Current; | |
if (Filter == null) | |
return adapter.Get(); | |
invoice.InvoiceNbr = Filter.NewPONbr; | |
Base.Document.Update(invoice); | |
Base.Save.Press(); | |
} | |
return adapter.Get(); | |
} | |
public class HWChangePONbrDAC : IBqlTable | |
{ | |
#region NewPONbr | |
[PXString] | |
[PXUIField(DisplayName = "New PO Nbr")] | |
public virtual String NewPONbr { get; set; } | |
public abstract class newPONbr : PX.Data.BQL.BqlString.Field<newPONbr> { } | |
#endregion | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment