Hi,
You can check the method displayTaxAmount of table CustInvoiceLine to see how table custInvoiceTable & taxTrans are related and how tax is getting calculated. Below code provides you the required relationship.
static void AXC_CustInvoiceTable(Args _args) { CustInvoiceTable custInvoiceTable; TaxTrans taxTrans; CustInvoiceTrans custInvoiceTrans; CustInvoiceLine custInvoiceLine; while select taxTrans join LineNum, InvoiceId, InvoiceDate, RecId from custInvoiceTrans where taxTrans.SourceRecId == custInvoiceTrans.RecId && taxTrans.SourceTableId == custInvoiceTrans.TableId join custInvoiceLine where custInvoiceTrans.LineNum == custInvoiceLine.LineNum join custInvoiceTable where custInvoiceTable.RecId == custInvoiceLine.ParentRecId&& custInvoiceTrans.InvoiceId == custInvoiceTable.InvoiceId&& custInvoiceTrans.InvoiceDate == custInvoiceTable.InvoiceDate*/ { info(strFmt("InvoiceId: %1, TaxCode: %2", custInvoiceTable.InvoiceId, taxTrans.TaxCode)); } }