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, ...
Suggested Answer

How to get the sales tax percentage using X++ ?

(1) ShareShare
ReportReport
Posted on by 596
Hi guys,
 
Using X++, how to retrieve the tax percentage value, if I know the Tax Group and Item Tax Group ?
Thanks,
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at
    Tax::calcTaxAmount() is likely what you need.
  • Voltes Profile Picture
    596 on at
    Hi Martin,
     
    I've been trying with this class, however this class doesn't support Price include sales tax scheme (unless I'm incorrectly use it). Which now I calculate it with my own function which that is why I need to retrieved the percentage value.
     
    This is my function though:
     
    private TaxValue getTaxPercent(TaxGroup _taxGroup, TaxItemGroup _taxItemGroup)
        {
            TaxGroupData    taxGroupData ;
            TaxOnItem       taxOnItem;
            TaxData         taxData;
            select firstonly TaxCode from taxGroupData
            index hint TaxGroupIdx
                where taxGroupData.TaxGroup == _taxGroup
                join taxOnItem
                where taxOnItem.TaxItemGroup == _taxItemGroup &&
                        taxOnItem.TaxCode == taxGroupData.TaxCode;
            select firstonly TaxValue from taxData where taxData.TaxCode == taxGroupData.TaxCode
                && taxData.TaxFromDate <= systemDateGet() &&  taxData.TaxToDate >= systemDateGet()  ;
            return taxData.TaxValue;
        }
     
    By this then I calculate my Tax amount with consideration of Price include sales tax (Yes or No).
     
     
    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

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 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans