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

Announcements

No record found.

News and Announcements icon
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
    238,743 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 583 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 378

#3
Diego Mancassola Profile Picture

Diego Mancassola 255

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans