Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

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

(1) ShareShare
ReportReport
Posted on by 592
Hi guys,
 
Using X++, how to retrieve the tax percentage value, if I know the Tax Group and Item Tax Group ?
Thanks,
  • Voltes Profile Picture
    Voltes 592 on at
    How to get the sales tax percentage using X++ ?
    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,
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,868 Most Valuable Professional on at
    How to get the sales tax percentage using X++ ?
    Tax::calcTaxAmount() is likely what you need.

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…

Vahid Ghafarpour – Community Spotlight

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

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,031 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,868 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans