Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
#region Event Handlers
public PXAction<PX.Objects.SO.SOOrder> CreateReceipt;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Create IN Receipt")]
protected void createReceipt()
{
INReceiptEntry graph = PXGraph.CreateInstance<INReceiptEntry>();
//Header
INRegister header = (INRegister)graph.CurrentDocument.Cache.CreateInstance();
header = graph.CurrentDocument.Insert(header);
header.TranDesc = "Test Transaction";
header.TranDate = DateTime.Now;
header = graph.CurrentDocument.Update(header);
//Transactions
for (int i = 0; i < 2; i++)
{
INTran tran = (INTran)graph.transactions.Cache.CreateInstance();
tran = graph.transactions.Insert(tran);
tran.InventoryID = 691;
tran = graph.transactions.Update(tran);
tran.Qty = i+1;
tran = graph.transactions.Update(tran);
tran.AcctID = 1200;
tran.SubID = 467;
tran.InvtAcctID = 1156;
tran.InvtSubID = 467;
}
header.Hold = false;
header = graph.CurrentDocument.Update(header);
graph.Actions.PressSave();
header = graph.CurrentDocument.Current;
graph.release.Press();
throw new PXException(header.DocType + "|" + header.RefNbr + "|" + header.BatchNbr);
}
#endregion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.