Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

RE: i need to fatch tax from taxtrans table in ax 2012

$
0
0

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



Viewing all articles
Browse latest Browse all 175888


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>