Skip to main content

Notifications

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

Tax rate field in Sales Invoice report

(0) ShareShare
ReportReport
Posted on by 404

Hello everyone, i am trying to add the tax rate to my sales invoice report. so i need to map the value to show on my report.

pastedimage1683531826407v1.png

so here i will show u my extension in the data provider class, i have created a field Ex_TaxRate to map the field TaxValue from the taxTrans table. but for some reasons, the field is coming blank on the report

pastedimage1683532252870v2.png

  • D365FO DEV Profile Picture
    D365FO DEV 404 on at
    RE: Tax rate field in Sales Invoice report

    i used the same logic, and my became like that: 

    select taxTrans where taxTrans.InventTransId == custInvoiceTrans.InventTransId;

    if (taxTrans.TaxAmount == 0.0)
    {
    salesInvoiceTmp.Ex_TaxRate = '0.00';
    }
    else
    {
    salesInvoiceTmp.Ex_TaxRate = num2str(taxTrans.TaxAmount, 10, 2, 0, 1);
    }

    but the output was wrong, instead of showing 15%, its showing 3000

    pastedimage1683544208841v1.png

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Tax rate field in Sales Invoice report

    Right, There is TaxValue field as well, can you please try that. If doesn't work then you can try Coc on populateSalesInvoiceTmp method and use _custInvoiceTrans parameter. If taxTrans buffer is not empty, then you can use it in your while select code. salesInvoiceTmp_Ex = taxTrans.TaxValue; 

     select taxTrans where taxTrans.InventTransId == _custInvoiceTrans.InventTransId;
     
     

    community.dynamics.com/.../741651

  • Abhi Profile Picture
    Abhi 120 on at
    RE: Tax rate field in Sales Invoice report

    Hi MounirDev,

    Yes. Can you create a runnable class to find the solution?

    Thanks,

  • D365FO DEV Profile Picture
    D365FO DEV 404 on at
    RE: Tax rate field in Sales Invoice report

    i have shared above a screenshot of my eventhandler, is it possible u provide with the correct code based on my field and table?

  • D365FO DEV Profile Picture
    D365FO DEV 404 on at
    RE: Tax rate field in Sales Invoice report

    the taxamount field doesnt give the % rate

    pastedimage1683541156702v1.png

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Tax rate field in Sales Invoice report

    Hi Mounir, I asked you this question 'There is a standard field for TaxAmount in SalesInvoiceTmp, if you comment your code, isn't the standard logic working?'

    Anyways, I might be wrong but I can see the logic for this field should work and you don't need to create custom fields like TaxRate_Ex, please try TaxAmount field first.

  • Suggested answer
    Abhi Profile Picture
    Abhi 120 on at
    RE: Tax rate field in Sales Invoice report

    Hi MounirDev,

    Please take the ref.

    -----------------------------------------------------------------------------------------------------------------------------

       taxDocument = TaxBusinessService::getTaxDocumentBySource(Custinvoicejour.TableId, Custinvoicejour.RecId);

       ITaxDocumentComponentLineEnumerator componentLineEnumerator = taxDocument.componentLines();

       while(componentLineEnumerator.moveNext())

       {

           componentLineObject = componentLineEnumerator.current();

           taxComponent = componentLineObject.metaData().taxComponent();

           taxValue = componentLineObject.getMeasure("Rate").value().value() * 100;

           taxAmount = componentLineObject.getMeasure("Tax Amount").value().value();

           info(strFmt("Component %1 ,Rate %2, Amount%3",taxComponent,taxValue,taxAmount));

       }

    -----------------------------------------------------------------------------------------------------------------------------

    Please VERIFY answers to support.

    Thanks,

  • D365FO DEV Profile Picture
    D365FO DEV 404 on at
    RE: Tax rate field in Sales Invoice report

    okay, can u please provide me with the code in order to have the tax rate showing on the report.?

  • Abhi Profile Picture
    Abhi 120 on at
    RE: Tax rate field in Sales Invoice report

    Hi MounirDev,

    pastedimage1683539297751v1.png

    In above figure, custinvoiceJour is in relation with salesinvoicetmp, not with custinvoicetrans table.

    Thanks,

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Tax rate field in Sales Invoice report

    Please check this thread

    community.dynamics.com/.../741651

    In SalesInvoiceTmp, JournalRecId field is linked with custinvoicejour table, not custInvoiceTrans.

    There is a standard field for TaxAmount in SalesInvoiceTmp, if you comment your code, isn't the standard logic working?

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,111 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,934 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans