Recently i came across a requirement which needs to print line wise GST Tax Amount in Purchase Order Confirmation Report After India GST Update.
Along with that i want to print Tax Amount based on the Tax Type like GST ,Custom Duty & Tax components like CGST, SGST ,IGST etc.
You may also find this tax amount value from TaxTrans table if Purchase order or sales order is processed as "Invoice" in our AX system.
Here i am sharing the code to get line wise GST Tax amount value. You may pass different line table's object instead of PurchLine table like SalesLine,PurchRFQReplyLine.
Here i am sharing the code to get line wise GST Tax amount value. You may pass different line table's object instead of PurchLine table like SalesLine,PurchRFQReplyLine.
PurchId objPurchId;
real _LineNum;
int64 _Recid;
ITaxDocumentComponentLineEnumerator componentLineEnumerator;
ITaxDocumentComponentLine componentLineObject;
PurchLine objPurchLine;
ITaxDocumentLine line;
ITaxDocumentLineEnumerator lineEnumerator;
real
_CGST,_CRate,_SGST,_SRate,_IGST,_IRate;
TaxComponent_IN taxComponent;
;
objPurchId='AP-000004';
_LineNum=1.0;
_Recid=5637231586;
objPurchLine = PurchLine::findRecId(_Recid);
line=
TaxBusinessService::getTaxDocumentLineBySource(objPurchLine.TableId,
objPurchLine.RecId);
if(line != null)
{
componentLineEnumerator
= Line.componentLines();
while(componentLineEnumerator.moveNext())
{
componentLineObject =
componentLineEnumerator.current();
taxComponent =
componentLineObject.metaData().taxComponent();
if(taxComponent =="CGST")
{
_CGST =
componentLineObject.getMeasure("Tax
Amount").value().value();
_CRate=componentLineObject.getMeasure("Rate").value().value() * 100;
}
else if(taxComponent
=="SGST")
{
_SGST = componentLineObject.getMeasure("Tax Amount").value().value();
_SRate=componentLineObject.getMeasure("Rate").value().value() * 100;
}
else if(taxComponent
=="IGST")
{
_IGST =
componentLineObject.getMeasure("Tax
Amount").value().value();
_IRate=componentLineObject.getMeasure("Rate").value().value() * 100;
}
}
}
info(strFmt("%1
%2 %3",_CGST,_SGST,_IGST));
3 comments
Write commentsHi there, I enjoy reading through your article post. Thank you for sharing.
ReplyMS Dynamics Technical Online Training
MS Dynamics AX Technical Training in Hyderabad
MS Dynamics AX Online Training
D365 AX Online Training
d365 ax technical online training
d365 ax technical training
Can we this code for Dynamics 365.
ReplyEmoticonEmoticon