Page 1 of 1

Creditor Cheque Payment Emailing

PostPosted: Fri Aug 12, 2016 12:43 pm
by perry
Hi,
Jiwa 7.0.157,

The task is similar to debtor statement emailing plugin, client wants to use a specific contact email address instead of the creditor's email address.

I tried "UltraToolbarsManager1.ToolClick" for "ID_RecordEmail", though, the event is called after the popup form is closed.
In the end my work around is to
Code: Select all
...
AddHandler CreditorChequePayment.ReadEnd, AddressOf ChequePaymentReadEnd
...

For Each creditor As JiwaCreditorChqPay.Creditor In chqpay.Creditors
    SetCreditorEmailAddress(creditor)
Next


Can you please advise if there is anything obviously wrong? or if there is a better way to achieve this?

Re: Creditor Cheque Payment Emailing  Topic is solved

PostPosted: Sat Nov 12, 2016 11:48 am
by Mike.Sheen
Hi Perry,

When you want to interact with dialogs, the best way is usually to intercept them from the Dialog factory - as these dialogs usually don't expose events needed to customise their behavior.

So, in the FormPlugin class something like this should suit your needs:

Code: Select all
Public Sub Setup(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.Setup
   AddHandler JiwaApplication.Manager.Instance.DialogFactory.AfterDialogStart, AddressOf AfterDialogStart
End Sub

Private Sub AfterDialogStart(ByVal JiwaDialog As JiwaApplication.IJiwaDialog)
  If TypeOf JiwaDialog Is JiwaCreditorChqPayUI.EmailRemittance Then
   Dim emailRemittanceDialog As JiwaCreditorChqPayUI.EmailRemittance = JiwaDialog
   Dim creditorChequePaymentForm As JiwaCreditorChqPayUI.CreditorChqPay = emailRemittanceDialog.Owner
   
    ' Populate the EmailAddress column of the grid with the desired addresses - this is then used as the recipient for the emails
   For row As Integer = 0 To emailRemittanceDialog.BatchJiwaGrid.ActiveSheet.RowCount - 1         
      If emailRemittanceDialog.BatchJiwaGrid.GridText("Email", row) = True Then
         emailRemittanceDialog.BatchJiwaGrid.GridText("EmailAddress", row) = "[email protected]"
      End If
   Next
  End If
End Sub


Attached is a plugin which uses the above to override the addresses - the result is the email dialog looks like this:
CreditorEFTEmailDialog.PNG
Example output

Re: Creditor Cheque Payment Emailing

PostPosted: Fri Jun 01, 2018 2:34 pm
by Ernst
In addition to Mike's plugin. This plugin, will retrieve the email address from the alternative email address on the Contact tab.

Just adjust the primary ID to get your Remittance Primary ID.....:) :D