Hi Everyone,
Finally resolved the issue but facing issue in below line.
taxDocumentLine = taxDocument.findLineBySource(origpurchline.TableId,origpurchline.RecId);
ERROR: object reference not set to an instance of an object.
Below is the code :
PurchTable origPurchTable;
PurchLine origpurchline;
ITaxDocument taxDocument;
ITaxDocumentLine taxDocumentLine;
ITaxDocumentComponentLineEnumerator componentLineEnumerator;
ITaxDocumentComponentLine componentLineObject;
TaxAmount IGST,CGST,SGST,IGSTRate,CGSTRate,SGSTRate;
TaxComponent_IN taxComponent;
;
origPurchTable = PurchTable::find(_PurchLine.PurchId);
origpurchline = PurchLine::findRecId(_PurchLine.recid);
taxDocument = TaxBusinessService::getTaxDocumentBySource(origPurchTable.TableId, origPurchTable.RecId);
taxDocumentLine = taxDocument.findLineBySource(origpurchline.TableId,origpurchline.RecId);
componentLineEnumerator = taxDocumentLine.componentLines();
while(componentLineEnumerator.moveNext())
{
componentLineObject = componentLineEnumerator.current();
if(componentLineObject.metaData().taxComponent() == "IGST")
{
//info(strFmt("Exch Rate : %1",componentLineObject.exchangeRate() / 100));
taxComponent = componentLineObject.metaData().taxComponent();
IGSTRate = componentLineObject.getMeasure("Rate").value().value() * 100;
IGST = componentLineObject.getMeasure("Tax Amount").value().value();
// info(strFmt("Component %1 ,Rate %2, Amount %3",taxComponent,taxValue,taxAmount));
}
if(componentLineObject.metaData().taxComponent() == "CGST")
{
//info(strFmt("Exch Rate : %1",componentLineObject.exchangeRate() / 100));
taxComponent = componentLineObject.metaData().taxComponent();
CGSTRate = componentLineObject.getMeasure("Rate").value().value() * 100;
CGST = componentLineObject.getMeasure("Tax Amount").value().value();
// info(strFmt("Component %1 ,Rate %2, Amount %3",taxComponent,taxValue,taxAmount));
}
if(componentLineObject.metaData().taxComponent() == "SGST")
{
//info(strFmt("Exch Rate : %1",componentLineObject.exchangeRate() / 100));
taxComponent = componentLineObject.metaData().taxComponent();
SGSTRate = componentLineObject.getMeasure("Rate").value().value() * 100;
SGST = componentLineObject.getMeasure("Tax Amount").value().value();
// info(strFmt("Component %1 ,Rate %2, Amount %3",taxComponent,taxValue,taxAmount));
}
}