Page 1 of 1

Sales Order popup

PostPosted: Fri Feb 12, 2016 3:11 pm
by Atronics
I want to have a message popup when specific debtors are selected in the sales order form. The following code gets the popup to work on saving the sales order
Private Sub SalesOrderSaveEnd(ByVal sender As Object,ByVal e As System.EventArgs)
How do I get to to work, once the debtor is selected?

Re: Sales Order popup  Topic is solved

PostPosted: Fri Feb 12, 2016 7:29 pm
by Mike.Sheen
Atronics wrote:I want to have a message popup when specific debtors are selected in the sales order form. The following code gets the popup to work on saving the sales order
Private Sub SalesOrderSaveEnd(ByVal sender As Object,ByVal e As System.EventArgs)
How do I get to to work, once the debtor is selected?


Add a handler to the CreateEnd event and examine the Debtor property of the sales order - i.e.:

Code: Select all
    Public Sub Setup(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.Setup
      Dim salesOrderForm As JiwaSalesUI.SalesOrder.BaseSalesOrderEntryForm = DirectCast(JiwaForm, JiwaSalesUI.SalesOrder.BaseSalesOrderEntryForm)
      AddHandler salesOrderForm.SalesOrder.CreateEnd, AddressOf SalesOrder_CreateEnd
    End Sub
   
   Public Sub SalesOrder_CreateEnd(sender As Object, e As System.EventArgs)
      Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = DirectCast(sender, JiwaSales.SalesOrder.SalesOrder)
      
      If salesOrder.Debtor.AccountNo = "1001" Then
         MessageBox.Show("Debtor is 1001")
      End If
   End Sub


Attached is a VB.NET plugin which does this.

Re: Sales Order popup

PostPosted: Mon Feb 15, 2016 10:17 am
by Atronics
Thanks, Mike. That does the job perfectly and gives me the framework for other similar requirements.

Re: Sales Order popup

PostPosted: Fri Feb 19, 2016 10:28 pm
by Mike.Sheen
Atronics wrote:Thanks, Mike. That does the job perfectly and gives me the framework for other similar requirements.


Great! Note that an alternative to message boxes is the desktop alert - A sample of this is here. Where appropriate, they may be a better alternative to message boxes.