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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Answered

i need to fatch tax from taxtrans table

(0) ShareShare
ReportReport
Posted on by 516

Hi, i need to get tax from taxtrans table, but my report is fatching data from customized table common is invoiceid of salesid,

i wrote code

invoiceid = dataContract.parmInvoiceID();//having invoice id of sales invoice

while select mytable where mytable.invoiceid == invoiceid

{

mytmp.name = mytable .name;

mytmp.invoiceid = mytable .invoiceid

select mytable where mytable.invoiceid == custinvoicetrans.invoicetrans join taxtrans

where taxtrans.inventtransid == custinvoicetrans.inventtransid

mytmp.taxvalue = taxtrans.taxvalue

}

but problem is in this select i am getting only one record till it find invoice id in first loop( means same inventtransid)

Please advice me how i get next inventtransid everytime 

Thanks in advance

akshay

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Rana Anees Profile Picture
    1,813 on at

    This code is to show TaxCode and TaxAmount on SQ and SO invoice line level.

    SalesQuotationDP -> setSalesQuotationDetailsTmp

        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;
        }


  • Verified answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    You can check method displayTaxAmount of table CustInvoiceTrans to know how the tax is getting calculated (or) you can use below code/job.

    
    
    static void AXC_CustInvoiceJour(Args _args)
    {
        CustInvoiceTrans custInvoiceTrans;
        CustInvoiceJour  custInvoiceJour;
        TaxAmount       taxAmount = 0;
        TaxTrans        taxTrans;
        
        while select custInvoiceJour
            join custInvoiceTrans
            where custInvoiceTrans.SalesId == custInvoiceJour.SalesId
            && custInvoiceTrans.InvoiceId == custInvoiceJour.InvoiceId
            && custInvoiceTrans.InvoiceDate == custInvoiceJour.InvoiceDate
            && custInvoiceTrans.numberSequenceGroup == custInvoiceJour.numberSequenceGroup
            && custInvoiceTrans.InvoiceId != ""
        {
            select sum(SourceRegulateAmountCur) from taxTrans
                where taxTrans.SourceRecId == custInvoiceTrans.RecId
                    && taxTrans.TransDate == custInvoiceJour.InvoiceDate
                    && taxTrans.Voucher == custInvoiceJour.LedgerVoucher;
            
            taxAmount = -taxTrans.SourceRegulateAmountCur;
            
            info(strFmt("InvoiceId: %1, LotId: %2, Tax amount: %3", custInvoiceJour.InvoiceId, custInvoiceTrans.InventTransId, taxAmount));
        }
    }

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

News and Announcements

Season of Giving Solutions is Here!

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#2
TAHER Mehdi Profile Picture

TAHER Mehdi 3

#3
Nakul Profile Picture

Nakul 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans