Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Unanswered

Credit note settlement causes wrong conditional sales tax posting X++

(0) ShareShare
ReportReport
Posted on by 8

Hello,

I am having issues with conditional sales tax posting.

The scenario is next:

I have invoice (ISV table, not standard) which has lines with conditional sates tax code.

I post the invoice.

Then I have a function which I use to create a credit note and it gets automatically settled.

It works fine, everything gets posted and settled.

Then, when I run standard Settle and post sales tax and go to Trial balance, I see disbalance, an extra posting has been created for conditional sales tax that shouldn't be created.

When I do the same process with standard invoice and credit note it is ok. So I assumed that something is wrong with our function for auto settlement, so when I remove that code, transactions are not settled but when I manually settle, postings are ok.

My code for auto settle is:

CustTable custTable;
CustTransOpen custOpen;
CustTrans settleTrans;
CustTransOpen settleOpen;
SpecTransExecutionContext context;
SpecTransManager specTransManager;
CustVendOpenTransManager manager;
CustVendTransData custVendTransData;

if (invoiceTable.SettleVoucher) 
{
     custOpen = null;
     settleOpen = null;

   select firstonly settleTrans
    where settleTrans.AccountNum == _custTrans.AccountNum
   && settleTrans.Voucher == invoiceTable.SettleVoucher
   && settleTrans.AmountMST == -_custTrans.AmountMST;


if (settleTrans)
{
custOpen = CustTransOpen::findRefId(_custTrans.RecId);
settleOpen = CustTransOpen::findRefId(settleTrans.RecId);
custTable = CustTable::find(_custTrans.AccountNum);
manager = CustVendOpenTransManager::construct(custTable);
}


if (custOpen && settleOpen && custOpen.AmountMST == -settleOpen.AmountMST)
{


manager.updateTransMarked(custOpen,NoYes::Yes);
manager.updateTransMarked(settleOpen,NoYes::Yes);
manager.updateSpecTransWithSelectedDate();

manager.settleMarkedTrans();

}

And it works fine, the transactions are getting settled, the only issue appears when we use Settle and post sales tax, in the end.

But when I was debugging our solution and standard also, I couldn't see the difference in call stack.

Any help?

Thanks

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,979 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,848 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans