Skip to content

Instantly share code, notes, and snippets.

@smarenich
Last active March 14, 2017 03:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smarenich/8f021ddc1a4ae9d613b056757d1fe547 to your computer and use it in GitHub Desktop.
Save smarenich/8f021ddc1a4ae9d613b056757d1fe547 to your computer and use it in GitHub Desktop.
public class ARReleaseProcessExt : PXGraphExtension<ARReleaseProcess>
{
private WeakReference<JournalEntry> je;
public override void Initialize()
{
base.Initialize();
PXGraph.InstanceCreated.AddHandler<JournalEntry>(delegate(JournalEntry graph)
{
je = new WeakReference<JournalEntry>(graph);
});
}
public void ARRegister_BatchNbr_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
ARRegister row = e.Row as ARRegister;
JournalEntry graph = null;
if (row != null && row.BatchNbr != null && je != null && je.TryGetTarget(out graph))
{
Batch batch = graph.BatchModule.Search<Batch.batchNbr>(row.BatchNbr, BatchModule.AR);
if (batch != null)
{
PXNoteAttribute.CopyNoteAndFiles(cache, row, graph.BatchModule.Cache, batch, true, true);
}
}
}
}
public class APReleaseProcessExt : PXGraphExtension<APReleaseProcess>
{
private WeakReference<JournalEntry> je;
public override void Initialize()
{
base.Initialize();
PXGraph.InstanceCreated.AddHandler<JournalEntry>(delegate(JournalEntry graph)
{
je = new WeakReference<JournalEntry>(graph);
});
}
public void APRegister_BatchNbr_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
APRegister row = e.Row as APRegister;
JournalEntry graph = null;
if (row != null && row.BatchNbr != null && je != null && je.TryGetTarget(out graph))
{
Batch batch = graph.BatchModule.Search<Batch.batchNbr>(row.BatchNbr, BatchModule.AP);
if (batch != null)
{
PXNoteAttribute.CopyNoteAndFiles(cache, row, graph.BatchModule.Cache, batch, true, true);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment