EFT Payment email sorting  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

EFT Payment email sorting

Postby perry » Fri Oct 01, 2021 6:11 pm

Hi All,
v7.2.1.1 (SR4)

Customer wants to sort Creditor cheque/eft payment email in transaction date order (while system setting is set to Duedate).
I'm looking at the code and cant see an easy way for me to sort it (without rewriting the whole thing), anay suggestion is much appreciated.
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: EFT Payment email sorting

Postby Mike.Sheen » Fri Oct 22, 2021 1:13 pm

Are you talking about the order in this dialog?

Creditor_Cheque_EFT_Payments_Email_Dialog.png


Because each email is one per creditor - and it is associated with one or more transactions, you can't really order by transaction date, or any date order.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: EFT Payment email sorting  Topic is solved

Postby Mike.Sheen » Fri Oct 22, 2021 1:21 pm

After thinking about this some more - you probably want to change the order the transactions appear on each email...

Creditor_Remittance_Email.png


As you would already know, the order the transactions appear on the email matches that of the payment form - which is controlled by a system setting. When composing the email - we simply add the transactions in the order there are in the InvoicePaymentLines collection of each creditor (see code below)

Code: Select all
Public Sub SendRemittanceEmail(ByVal Creditor As JiwaCreditorChqPay.Creditor, ByVal OveriddenEmailAddress As String)

        Dim EmailObject As JiwaApplication.JiwaEmail.EmailMessage

        EmailObject = Manager.BusinessLogicFactory.CreateBusinessLogic(Of JiwaApplication.JiwaEmail.EmailMessage)(Nothing)
        EmailObject.CreateNew()

        EmailObject.BodyIsHTML = True
        EmailObject.EmailFrom = ResolveTokens(From, Creditor, Nothing, OveriddenEmailAddress)
        EmailObject.EmailTo = ResolveTokens(EmailTo, Creditor, Nothing, OveriddenEmailAddress)
        EmailObject.EmailCC = ResolveTokens(CC, Creditor, Nothing, OveriddenEmailAddress)
        EmailObject.EmailBCC = ResolveTokens(BCC, Creditor, Nothing, OveriddenEmailAddress)
        EmailObject.EmailSubject = ResolveTokens(Subject, Creditor, Nothing, OveriddenEmailAddress)

        EmailObject.EmailBody = ResolveTokens(SelectedEmailTemplate.Header, Creditor, Nothing, OveriddenEmailAddress)

        For Each invoice As JiwaCreditorChqPay.clsPayLineInvoice In Creditor.InvoicePaymentLines
            EmailObject.EmailBody &= ResolveTokens(SelectedEmailTemplate.Body, Creditor, invoice, OveriddenEmailAddress)
        Next

        EmailObject.EmailBody &= ResolveTokens(SelectedEmailTemplate.Footer, Creditor, Nothing, OveriddenEmailAddress)

        EmailObject.SourceID = _ChequePaymentForm.CRChequePayObject.RecID
        EmailObject.SourceType = "Creditor Cheque Payments"
        EmailObject.SourceDisplayNo = _ChequePaymentForm.CRChequePayObject.BatchNo
        EmailObject.SourceForm = "JiwaFinancials.Jiwa.JiwaCreditorChqPayUI.CreditorChqPay"

        If RequestReadReceipt Then
            EmailObject.RequestReadReceipt = True
        End If

        EmailObject.Status = JiwaApplication.JiwaEmail.EmailMessage.EmailStatuses.Sent
        EmailObject.Save()

    End Sub


You could try intercepting the tool click of the email button and at that point iterate through each creditor and use a bit of linq to sort the InvoicePaymentLines in the order you want. To prevent unexpected behaviours after the the dialog closes it might be a good idea to sort it back in the order it was, or at least re-read the batch to discard any changes the sorting made.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: EFT Payment email sorting

Postby perry » Thu Oct 28, 2021 11:27 am

Hi Mike,

Thanks, we did end up changing the system setting to achieve desired sequence.

Changing sequence of the collection item sounds like a fun idea, I probably will try it with my own time.
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 5 guests