web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

How to get line wise GST amount and GST percentage of confirmed PO before invoicing.

(0) ShareShare
ReportReport
Posted on by 110

Dear Experts, 

We have an urgent requirement to display linewise GST amount and GST percentage on a report. Request you all to please suggest how we can achieve the same. There are blogs and posts regarding the same but none of them is working linewise. Any links or opinions ? 

Thanks and regards, 

Piyush 

I have the same question (0)
  • Suggested answer
    Ramit Paul Profile Picture
    22,797 Most Valuable Professional on at
    RE: How to get line wise GST amount and GST percentage of confirmed PO before invoicing.

    Hi,

    What do you mean by linewise GST?

    Can you give us the expected entry in just a simple table, we want to see what is the expected result

  • piyush004 Profile Picture
    110 on at
    RE: How to get line wise GST amount and GST percentage of confirmed PO before invoicing.

    Hi Ramit Paul,

    we have a report where PurchTable and PurchLine are the base tables. For example:

    PO          LineNum  Product Name   Qty      UnitPrice      NetAmount      GST%      GSTAmount

    PO1        1                Product1         10          20               200                   10          20

    PO1        2                Product2           1          10                 10                   10          1

    PO1        3                Product3           5          30               150                   18          27

    Please try to get idea from above example where we need to get GST% and GSTamount against each line.  

  • WillWU Profile Picture
    22,361 on at
    RE: How to get line wise GST amount and GST percentage of confirmed PO before invoicing.

    Hi Piyush Pant,

    Please check the insertIntoGSTTaxAmount_IN() and initSalesInvoiceTmpWithProforma_IN() method in the SalesInvoiceDP class, you could use the similar logic/code for Purchase invoice report.

    dynamicsuser.net/.../how-to-calculate-cgst-sgst-igst-through-x

    Hope this helps.

  • piyush004 Profile Picture
    110 on at
    RE: How to get line wise GST amount and GST percentage of confirmed PO before invoicing.

    Hi Will WU,

    I have already gone through given forum link, it is not for GST calculation against individual PurchLine.

    There is another link given inside the same but that also having issues, few methods from that suggestion are not available in D365.

    Regards,

    Piyush

  • piyush004 Profile Picture
    110 on at
    RE: How to get line wise GST amount and GST percentage of confirmed PO before invoicing.

    Hi Everyone,

    Finally resolved the issue but facing issue in below line. 

     taxDocumentLine         = taxDocument.findLineBySource(origpurchline.TableId,origpurchline.RecId);

    ERROR: object reference not set to an instance of an object. 

    Below is the code :

               PurchTable                          origPurchTable;

               PurchLine                           origpurchline;

               ITaxDocument                        taxDocument;

               ITaxDocumentLine                    taxDocumentLine;

               ITaxDocumentComponentLineEnumerator componentLineEnumerator;

               ITaxDocumentComponentLine           componentLineObject;

               TaxAmount                           IGST,CGST,SGST,IGSTRate,CGSTRate,SGSTRate;

               TaxComponent_IN                     taxComponent;

               ;

               origPurchTable  = PurchTable::find(_PurchLine.PurchId);

               origpurchline = PurchLine::findRecId(_PurchLine.recid);

               taxDocument             = TaxBusinessService::getTaxDocumentBySource(origPurchTable.TableId, origPurchTable.RecId);

               taxDocumentLine         = taxDocument.findLineBySource(origpurchline.TableId,origpurchline.RecId);

               componentLineEnumerator   = taxDocumentLine.componentLines();

               while(componentLineEnumerator.moveNext())

               {

                   componentLineObject   = componentLineEnumerator.current();

                   if(componentLineObject.metaData().taxComponent() == "IGST")

                   {

                       //info(strFmt("Exch Rate : %1",componentLineObject.exchangeRate() / 100));

                       taxComponent    = componentLineObject.metaData().taxComponent();

                       IGSTRate        = componentLineObject.getMeasure("Rate").value().value() * 100;

                       IGST       = componentLineObject.getMeasure("Tax Amount").value().value();

                 //      info(strFmt("Component %1 ,Rate %2, Amount %3",taxComponent,taxValue,taxAmount));

                   }

                   if(componentLineObject.metaData().taxComponent() == "CGST")

                   {

                       //info(strFmt("Exch Rate : %1",componentLineObject.exchangeRate() / 100));

                       taxComponent    = componentLineObject.metaData().taxComponent();

                       CGSTRate        = componentLineObject.getMeasure("Rate").value().value() * 100;

                       CGST       = componentLineObject.getMeasure("Tax Amount").value().value();

                      // info(strFmt("Component %1 ,Rate %2, Amount %3",taxComponent,taxValue,taxAmount));

                   }

                   if(componentLineObject.metaData().taxComponent() == "SGST")

                   {

                       //info(strFmt("Exch Rate : %1",componentLineObject.exchangeRate() / 100));

                       taxComponent    = componentLineObject.metaData().taxComponent();

                       SGSTRate        = componentLineObject.getMeasure("Rate").value().value() * 100;

                       SGST       = componentLineObject.getMeasure("Tax Amount").value().value();

                      // info(strFmt("Component %1 ,Rate %2, Amount %3",taxComponent,taxValue,taxAmount));

                   }

               }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,047

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 885 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 592 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans