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.
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.