Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Tax Per Line for Reports

Posted on by 1,869

Dear All,

Please help me with code to get the tax per line on Sales Invoice reports. I have below code its working fine on SalesLine form to get calculated tax per line. But please help me how I need to call this method in SalesInvoiceDP class. I need to show per Line in SalesInvoice Report with below code.

  display TaxAmountCur saleslinewisetax(boolean _adjustTaxSign = true, boolean _includeUseTax = false)
{
    SalesTotals salesTotals;
    TaxAmountCur    taxAmountCur;

    salesTotals = SalesTotals::construct(this.salesTable());
    salesTotals.calc();
    salesTotals.tax().sourceSingleLine(true, true);
    taxAmountCur    =   salesTotals.tax().totalTaxAmountSingleLine(this.TableId, this.RecId, _adjustTaxSign, _includeUseTax);

    return taxAmountCur;
}


Regards,

Faqru

*This post is locked for comments

  • Suggested answer
    Faqruddin Profile Picture
    Faqruddin 1,869 on at
    RE: Tax Per Line for Reports

    Check below code. Its also calculating tax per line.

    2068.VAT.jpg

  • Rana Anees Profile Picture
    Rana Anees 1,811 on at
    RE: Tax Per Line for Reports

    Thanks Faruq. Can you display TaxAmount per line without customization. In my case it is calculating but not showing per line so I did that customization on SalesInvoice? Can you please confirm.

  • Verified answer
    Faqruddin Profile Picture
    Faqruddin 1,869 on at
    RE: Tax Per Line for Reports

    Thanks Rana. I check only SalesInvoice code and its working. Also I found standard field _custInvoiceTrans.TaxAmount calculating salestax per line.

  • Verified answer
    Rana Anees Profile Picture
    Rana Anees 1,811 on at
    RE: Tax Per Line for Reports

    Its working with me for SalesQuotation and SalesInvoice reports. This code is to show TaxCode and TaxAmount on SQ and SO invoice line level.

    SalesQuotationDP -> setSalesQuotationDetailsTmp

    // Declaration

        TmpTaxWorkTrans             tmpTax;
        SalesQuotationTable         salesQuotationTable;
        SalesQuotationTotals_Sales  salesQuotationTotals;
    
    
            salesQuotationTable  = SalesQuotationTable::find(custQuotationTrans.origQuotationId);
            salesQuotationTotals = SalesQuotationTotals_Sales::construct(salesQuotationTable);
            // Calculate Tax
            salesQuotationTotals.calc();
            // Load tmpTaxWorkTrans
            tmpTax.setTmpData(salesQuotationTotals.tax().tmpTaxWorkTrans());
    
            while select tmpTax where tmpTax.InventTransId == custQuotationTrans.InventTransId && tmpTax.Company == custQuotationTrans.dataAreaId
            {
                //info( strFmt('%1 : %2' , tmpTax.TaxCode, -tmpTax.TaxAmount));
                salesQuotationTmp.TaxCode = tmpTax.TaxCode;
                salesQuotationTmp.TaxAmount = -tmpTax.TaxAmount;
            }
    
            if(salesQuotationTmp.TaxCode == '')
            {
                salesQuotationTmp.TaxCode = '0.00';
            }


    SlaesInvoiceDP -> insertIntoSalesInvoiceTmp

        SalesTable                  salesTable;
        SalesTotals                 salesTotals;
        TaxTrans taxTrans;
    
        select taxTrans where taxTrans.InventTransId == _custInvoiceTrans.InventTransId;
        //salesInvoiceTmp.TaxValue = taxTrans.TaxValue;
    
        salesInvoiceTmp.TaxAmount = -taxTrans.TaxAmount;
        if(taxTrans.TaxCode == '')
        {
            salesInvoiceTmp.TaxCode = '0.00';
        }
        else
        {
            salesInvoiceTmp.TaxCode = taxTrans.TaxCode;
        }
  • Faqruddin Profile Picture
    Faqruddin 1,869 on at
    RE: Tax Per Line for Reports

    Hello Mr. Ludwig,

    The reports you shared its ok. But I'm looking for if customer needs tax amount per each item id at Sales Invoice level. Is there any standard field to do this. I'm having issue to call above code in Sales Invoice report per each item id.

    Regards,

    Faqru

  • Verified answer
    Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: Tax Per Line for Reports

    Hi Faqru,

    The parameter actually just calculates the tax per line instead of the invoice total.

    I do not know what you try to achieve with this report/report adjustment.

    Before making an adjustment, please check the standard tax reports that are available.

    There is for example a sales tax by customer report available in GL.

    Then you have a sales tax Transactions - Details report available in GL

    Finally, there is the transaction origin report that shows you the different ledgers and tax amounts posted

    Example:

    0310.st.png

    And if this one is not sufficient, then you have the sales tax transactions report available that lists all tax transactions individually.

    Hope this helps.

    Best regards,

    Ludwig

  • Rana Anees Profile Picture
    Rana Anees 1,811 on at
    RE: Tax Per Line for Reports

    This is our SalesInvoice report design. Wants to show Tax Code and Amount for each item line. 

    Can we get it by setup or by customization?

    VATperLine.png

    Thanks,

  • Faqruddin Profile Picture
    Faqruddin 1,869 on at
    RE: Tax Per Line for Reports

    Thanks Ludwig. This parameter is already setup. But I need tax per line for each item id for the sales invoice report.  But I don't know what field is activated by setting this parameter.

  • Rana Anees Profile Picture
    Rana Anees 1,811 on at
    RE: Tax Per Line for Reports

    Dear Ludwig Reinhard,

    Please guide this setup, we also want to show TaxAmount and TaxCode on SalesInvoice report at line level.

    Thanks

  • Suggested answer
    Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: Tax Per Line for Reports

    Hi Faqru,

    I referred to the following parameter:

    taxgl.png

    Best regards,

    Ludwig

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans