web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

What method or event handler which will split Customer Transaction when key in Amount to Settle ?

(0) ShareShare
ReportReport
Posted on by 596

Hello guys,

Need some help to bring some light. In Customer Payment Journal, when we want to Settle Transactions using this button ->

pastedimage1682563491265v1.png

When the Settle Transaction form open, we're able to change the value of Amount to settle, lets say the Invoice Id is INV001 with the invoice amount is 50, I can overwrite it to 20, so that if I understand correctly, it will split Customer Transaction from 1 record INV001 50, into 2 records INV001 with amount of 20 (which will be settled) and  the other record is for the balance of 30.

This is the screen:

pastedimage1682563913785v2.png

May I know what class (or probably event handler) that trigger this "split" split logic ?

Also, I was told that I can use this class custvendopentransmanager to split it, but currently I don't know how to use or whether it is correct or not ?

thanks,

I have the same question (0)
  • Voltes Profile Picture
    596 on at

    My apologies, I am now not sure whether it is split or not, but if I try manually, the record still 1 but when open Settle transaction, we edit the Amount to settle, lets say the 1st journal line 20, close the form then mark the same invoice, again edit Amount to settle to 10, it is actually able to do so.

    My intention is actually I want to create program (X ) to have this kind of situation. So in the Payment Journal creation there will be 2 journal line, but this two journal line will have to pay the same invoice, just like the simulation above.

    However I'm not succeed in doing this and always have error with the 2nd line by saying : This transaction has been marked for settlement by Customer Payment XXX-000000431 in company xxx.

    It is like my code cannot settle the same invoice (in 2nd line) since it is marked in the 1st line.

    My code for handling the settlement when creating payment journal in X is like this : 

    void settlement(MY_Table  _mytable, LedgerJournalTrans  _paymLedgerJournalTrans) 
    {
        custvendopentransmanager manager;
        CustTransOpen  custTransOpen;
        AmountCur      totalSettlement, amountToSettle;
        select firstonly custTransOpen where custTransOpen.Invoice== _mytable.InvoicetobeMarked;
    
        amountToSettle = _mytable.PaymentAmount;
        manager = custvendopentransmanager::construct(_paymLedgerJournalTrans);
        manager.updateTransMarked(CustTransOpen,true);
        manager.updateSettleAmount(CustTransOpen, amountToSettle);
    
        // total settlement
        totalSettlement = SpecTransManager::getTotalSettleAmountForSpecReference(
                                    _paymLedgerJournalTrans.Company,
                                    _paymLedgerJournalTrans.TableId,
                                    _paymLedgerJournalTrans.RecId,
                                    _paymLedgerJournalTrans.CurrencyCode,
                                    _paymLedgerJournalTrans.Company,
                                    _paymLedgerJournalTrans.TransDate,
                                    exchangeRateHelper.prepareExchangeRateForStorage(_paymLedgerJournalTrans.crossrate()));
    
        //To update in ledgerJournal trans
        ttsBegin;
        _paymLedgerJournalTrans.selectForUpdate(true);
        _paymLedgerJournalTrans.AmountCurCredit = amountToSettle <= abs(totalSettlement) ? amountToSettle: 0;
        _paymLedgerJournalTrans.SettleVoucher = SettlementType::SelectedTransact;
        _paymLedgerJournalTrans.MarkedInvoice = _mytable.InvoicetobeMarked;
        _paymLedgerJournalTrans.doupdate();
        ttsCommit;
    
    }
    

    Basically this is a void called within my payment journal creation, so when the LedgerJournalTrans filled in, then will call this void to do the settlement.

    But as mentioned, for two rows of journal line (2 payments) wants to settle the same invoice, on the 2nd line it will hit that error. Unlike when doing manual through Settle Transaction button, all is fine.

    Anyone can help to give me some idea ?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 549 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans