Skip to content

Instantly share code, notes, and snippets.

@smarenich

smarenich/CopyNotesToGL.cs

Last active Mar 14, 2017
Embed
What would you like to do?
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
You can’t perform that action at this time.