Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Unmark settlement of posted transaction without reversing

Posted on by 1,858

Hi,

Need tips on below scenario:

CI-90 Invoice was settled with payment journal PI-90. But PI-90 had wrong amount so had to reverse PI-90 by creating PI-91 with debit and credit field reversed.

PI- 92 with correct amount is created and posted. Now I want to remove the settlement link between CI-90 and PI-90 and link CI-90 with PI-92.

Is it possible to just change the settlement link and without reversing CI-90 and PI-90 and then creating CI-91 to link with PI-92?

As far as I looked into it there is refrecids stored in custtrans table to link the invoice and payment. But I don't know the implications of changing it manually from SQL server management studio.

*This post is locked for comments

  • MYGz Profile Picture
    MYGz 1,858 on at
    RE: Unmark settlement of posted transaction without reversing

    Hi Rustem,

    No. I got busy in another task. Will surely update once it is Solved.

  • Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: Unmark settlement of posted transaction without reversing

    Did you solve the issue?

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: Unmark settlement of posted transaction without reversing

    BTW, this job clearing all settlements and recreate CustTransOpen records:

    static void garu_clearCustTrans(Args _args)
    {
        CustTransOpen   cto;
        CustSettlement  cstl;
        CustTrans       ctr;
        AccountNum      custAccount;
        CustTrans       custTrans;
        Amount          settleAmount;
        CustTransOpen   custTransOpen;
    
        custAccount = "K44037";
    
        if(custAccount && CustTable::find(custAccount) && isSystemAdministrator())
        {
            ttsBegin;
            
            delete_from cto
                where cto.AccountNum == custAccount;
    
            delete_from cstl
                where cstl.AccountNum == custAccount;
    
            delete_from ctr
                where ctr.AccountNum == custAccount
                   && ctr.TransType  == LedgerTransType::Settlement;
    
            while select forUpdate custTrans
                where custTrans.AccountNum == custAccount
            {
                settleAmount = custTrans.AmountCur;
    
                custTrans.LastSettleAccountNum  = "";
                custTrans.LastSettleCompany     = "";
                custTrans.LastSettleDate        = dateNull();
                custTrans.LastSettleVoucher     = "";
                custTrans.SettleAmountCur       = 0;
                custTrans.SettleAmountMST       = 0;
                custTrans.SettleAmountReporting = 0;
                custTrans.Closed                = dateNull();
                custTrans.doUpdate();
    
                custTransOpen = CustTransOpen::findRefId(custTrans.RecId);
    
                if(! custTransOpen)
                {
                    info(strFmt("%1", settleAmount));
                    custTransOpen.RefRecId      = custTrans.RecId;
                    custTransOpen.AccountNum    = custTrans.AccountNum;
                    custTransOpen.AmountCur     = custTrans.AmountCur;
                    custTransOpen.AmountMST     = custTrans.AmountMST;
                    custTransOpen.TransDate     = custTrans.TransDate;
                    custTransOpen.CashDiscDate  = custTrans.TransDate;
                    custTransOpen.DueDate       = custTrans.TransDate;
                    custTransOpen.insert();
                }
            }
            ttsCommit;
    
            info(strFmt("%1", settleAmount));
            info("done");
        }
    }


  • MYGz Profile Picture
    MYGz 1,858 on at
    RE: Unmark settlement of posted transaction without reversing

    Yeah. Basically, couple of tables. Trying to gather information on what all things to consider. I'll first do it on test env and check if it works.

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: Unmark settlement of posted transaction without reversing

    Hi MYGz!

    Manually changing from SQL it's not a good idea.

    There are not only CustTrans table. There are also CustTransOpen and CustSettlement tables.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans