GST Value in Sales Quotation and Sales Confirmation

Hello Everyone,

We are not able to get Total SGST,CGST and IGST Amount posted against a Sales Quotation and Sales Confirmation in AX 2009. We are using the Tables TaxJournTrans, Taxtable and CustQuotationJour Tables to get the Total SGST, CGST and IGST Amount. Please do let me know how can we get the details with respective these tables. Code Written to fetch IGSTotal against a Sales Quotation:

display real uccSumIGST()
{

TaxJournalTrans taxJournalTrans;
TaxTable taxTable;
real sumtax=0;
;
select sum(TaxAmount) from taxjournaltrans
where taxjournaltrans.TransRecId == custQuotationJour.RecId
join taxTable where taxtable.TaxCode == taxJournalTrans.TaxCode &&
taxTable.TaxComponent_IN == ‘I-GST’;
return abs(taxjournaltrans.TaxAmount);

}

In TaxJournalTrans if TransRecId is similar to some other transactions (Eg sales Confirmation) Wrong IGST Sum is displayed. Attached Table screenshot for reference.

Please Suggest any other way out to fetch the GST Totals in Report.

Thank You.