
I have added a customer balance summary screen to the SOP Entry screen using VS C#. On this screen is displayed a summary of the customer's current activity plus there is check box indicating if the selected customer has any past due invoices. If this box is checked I want to stop the user from entering a new order for this customer. I believe I need to use the ValidateBeforeOriginal event but how do I set this up? As a test I inserted this code but it never fires.
void CustomerNumber_ValidateBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e)
{
MessageBox.Show("Hello world!");
e.Cancel = true;
}
I also tried this
SopEntryForm.SopEntry.CustomerNumber.ValidateBeforeOriginal += new EventHandler(CheckPastDue);
but this won't even build.
What is the proper way to stop a user from entering an order if they have past due invoices. I need to rollback the GP events but how do I do that?
I have this code firing however all it does is blank the customer name. It would preferred to have rollback all the GP events and have the cursor land on the Type/Type ID as if the user just landed on the SOP Entry screen. Is this possible?
SopEntryForm.SopEntry.CustomerNumber.ValidateBeforeOriginal += new System.ComponentModel.CancelEventHandler(CustomerNumber_ValidateBeforeOriginal);
void CustomerNumber_ValidateBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e)
{
MessageBox.Show("Hello world!");
SopEntryForm.SopEntry.CustomerNumber.Value = "";
e.Cancel = true;
}