Wednesday, January 18, 2023

get GST Amount in D365F&O using X++

 get GST Amount in D365F&O using X++.


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 
		&& component.Component == type; 

	return TaxDocumentComponentTransaction.TaxAmount; 
} 


Keep Daxing!!




No comments:

Post a Comment