To Get GST Amount in Dynamics 365 F&O through X++ Code
public Amount GetGSTAmount(str type)
{
TaxDocumentRowTransaction TaxDocumentRowTransaction;
TaxDocumentComponentTransaction TaxDocumentComponentTransaction;
TaxComponentTable_IN component.
TaxDocumentComponentTransaction_In taxDocumentComponentTransactionIn;
select sum (TaxAmount) from TaxDocumentComponentTransaction
exists join TaxDocumentRowTransaction
where TaxDocumentRowTransaction.RecId == TaxDocumentComponentTransaction.TaxDocumentRowTransactionRecId
&& TaxDocumentRowTransaction. Voucher == this. Voucher
&& TaxDocumentRowTransaction.InvoiceId == this.CustomerInvoiceNo
&& TaxDocumentRowTransaction.TransactionDate == this.CustomerInvoiceDate
exists join taxDocumentComponentTransactionIn
where taxDocumentComponentTransactionIn.TaxDocumentComponnetTransactionRecId == TaxDocumentComponentTransaction.RecId
exists join component where component.RecId == taxDocumentComponentTransactionIn.TaxComponent
&& component.TaxType == TaxType_IN::GST
return TaxDocumentComponentTransaction.TaxAmount;
}