Thursday, 6 July 2017

Calculate Purchase order confirmation tax details (IGST/CGST/SGST) in AX 2009

Hi guys,

I was struggling  to calculate the GST taxes on purchase order confirmation. Here i am sharing some code to get Taxes details (IGST/CGST/SGST) in AX 2009.

static void GSTTotal(Args _args)
{
    vendPurchOrderJour vendPurchOrderJour;
    ITaxDocument taxDocument;
    ITaxDocumentComponentLineEnumerator componentLineEnumerator;
    ITaxDocumentComponentLine componentLineObject;
    ITaxDocumentMeasureEnumerator measureEnumerator;
    TaxAmount taxAmount,taxValue;
    TaxComponent_IN taxComponent;
    ;
    vendPurchOrderJour = vendPurchOrderJour::findRecId(5637291565); //Need to pass Confirmation journal recid
    taxDocument = TaxBusinessService::getTaxDocumentBySource(vendPurchOrderJour.TableId, vendPurchOrderJour.RecId);

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


Happy DAXing.

2 comments:

  1. Hi :) It is a big pleasure to read your blog. Thank you so much for sharing this article about Microsoft Dynamics AX posting profile inventory transactions in Modules.

    ReplyDelete

Import General journal from excel in D365 F&O

 Hi Guys, Import General journal from excel in D365 F&O Code:  using System.IO; using OfficeOpenXml; using OfficeOpenXml.ExcelPackage; u...