Wednesday 7 June 2017

GST Tax Caluclation code for Ax 2009 /2012 and AX 7

Hi Friends,

You might be thinking of new code for Tax calculation for GST in INDIA. Here is the sample code snippet for printing Tax info on Reports and Forms.


ITaxableDocument taxableDocument;
ITaxDocument taxDocumentObject;
ITaxDocumentMeasurevalue totalTaxMeasureValue;
ITaxDocumentComponentLineEnumerator componentme;
ITaxDocumentComponentLine componentLine;
ITaxDocumentMeasureEnumerator measureenum;
ITaxDocumentComponentLineMetaData meta;
ITaxDocumentLineEnumerator sublines,sublines1;
ITaxDocumentLine line,line1;
Amount gstTotal ;
;


taxableDocument = TaxableDocumentObject::construct(TaxableDocumentDescriptorFactory::getTaxableDocumentDescriptor(PurchTable::find(526987556)));

taxDocumentObject = TaxBusinessService::calculateTax(taxableDocument);

if (taxDocumentObject)
{
totalTaxMeasureValue = taxDocumentObject.getTotalTax();

gstTotal = totalTaxMeasureValue.amountTransactionCurrency();

sublines = taxDocumentObject.subLines();

while(sublines.moveNext())
{
line = sublines.current();

sublines1 = line.lines();
while(sublines1.moveNext())
{

line1 = sublines1.current();

componentme =line1.componentLines();
while(componentme.moveNext())
{

componentLine= componentme.current();

meta = componentLine.metaData();
info(meta.taxComponent());
info(strfmt("%1",componentLine.getMeasure("Base Amount").value().value()));
info(strfmt("%1",componentLine.getMeasure("Rate").value().value()));



}

}
}
}





Vivek Chirumamilla