Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 143529

Mark same customer invoice partially with X++ more than once

$
0
0

Hi,

I manually enter the amount and then mark the customer invoice for settlement.

Here is the code:

	
	select custTransOpen where custTransOpen.AccountNum == "CUST01"
                join custTrans where custTrans.Invoice == ltrans.Invoice
                     && custTrans.RecId == custTransOpen.RefRecId
                    && custTrans.AccountNum == custTransOpen.AccountNum;

    if(custTransOpen)
    {

        manager = custvendopentransmanager::construct(ltrans);
        manager.updateTransMarked(custTransOpen,true);

        ttsBegin;
        ltrans.selectForUpdate(true);
        ltrans.SettleVoucher    = SettlementType::SelectedTransact;
        ltrans.update();
        ttsCommit;
	}

This code fails if I try to mark the same invoice again with a payment journal before the previous partially marked payment journal is posted.

For eg. if $100 invoice is 1st marked by $60 amount in line1 and then If I again try to mark it with $40 amount in line2 or in some other payment journal, It throws this error: "This invoice is already marked for settlement."

How can I change my code to successfully mark invoices partially with payment journals before posting the payment journals?


Viewing all articles
Browse latest Browse all 143529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>