Breaking

Sunday, September 2, 2018

How to get GST invoice number (original transaction number) from sales invoice or purchase invoice in Dynamics Ax 2012

Overview:-

Initially a Transaction ID confirming receipt of data will be conveyed to the taxpayer, (as also envisaged in case of filing of short paid / non –paid return). Final acknowledgement of receipt of return will be generated after validation of data is completed, which will also lock-in the Transaction ID.

The acknowledgement of e-return would contain the following details:
  • Return acknowledgement number (unique number generated by the GSTN), Date and Time
  • Transaction ID No., Date and Time
  • GSTIN of taxpayer
  • Relevant tax period details
  • Gross Supplies, Taxable Supplies and Tax paid / refund claimed (CGST, SGST, IGST and Additional tax separately) during the Return period
In dynamics Ax 2012 R3 you can get a GST invoice number (Transaction Number) or transaction date from the sales or purchase invoice.
For example: -

After purchase order invoice when I check for tax documents for that purchase order, then in a setup tab display “Original transaction number” and “Original transaction date” for that invoice and for other invoice it will be different.

Here is the code where you can get a GST invoice number (original transaction number) or GST transaction date (original transaction date) from dynamics Ax.
static void GSTTransactionIDForSalesInvoice(Args _args)
{
    TaxDocument                         ObjTaxDocument;
    TaxDocumentExtension_IN             ObjTaxDocumentExtension_IN;
    CustInvoiceJour                     ObjCustInvoiceJour;
    PurchLineAllVersions                ObjPurchLineAllVersions;
    ITaxDocument                        taxDocument;
    
    ;
    
    ObjCustInvoiceJour = CustInvoiceJour::find('GST-000000008');
    taxDocument = TaxBusinessService::getTaxDocumentBySource(ObjCustInvoiceJour.TableId, ObjCustInvoiceJour.RecId);
    //Tax Document start
    if(taxDocument != null)
    {
        info(strFmt("%1", taxDocument.getGUID() ));
        
        select * from ObjTaxDocument 
        join ObjTaxDocumentExtension_IN
        where ObjTaxDocumentExtension_IN.TaxDocument == ObjTaxDocument.RecId
        && ObjTaxDocument.GUID == taxDocument.getGUID();
        
        info(strFmt("TransactionId = %1, TransactionDate = %2, TransactionRefType = %3, TaxDocumentExtension = %4,TaxTransactionDate =  %5",
        ObjTaxDocumentExtension_IN.TaxTransactionId,
        ObjTaxDocumentExtension_IN.TaxTransactionDate,
        ObjTaxDocumentExtension_IN.TaxTransactionRefType,
        ObjTaxDocumentExtension_IN.RefTaxDocumentExtension,
        ObjTaxDocumentExtension_IN.RefTaxTransactionDate));
    }
    //Tax Document end
}
Note:- Here I have given example for sales order invoice GST tax document also you can get purchase order GST transaction by changes below code.
    ObjVendInvoiceJour = VendInvoiceJour::find('PurchaseInvoiceNumber');
    taxDocument = TaxBusinessService::getTaxDocumentBySource(ObjVendInvoiceJour.TableId, ObjVendInvoiceJour.RecId);

No comments:

Post a Comment

Thanks for your comment.