Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

Unable to get CGST, SGST and IGST values in the sales invoice report

(0) ShareShare
ReportReport
Posted on by 76

I have created CGST, SGST and IGST fields in "Sales Line" through table extension. I wrote code for CGST, SGST and IGST using OnPostReport trigger in report extension . If i run the extension, i'm unable to get values for CGST, SGST and IGST fields. its shows only 0.00 in my sales invoice report. where i.m doing mistake? why i'm not getting the values for the same. I have included my code here.

tableextension 50127 requiredfieldstableext extends "Sales Line"

{

   fields

   {     

       field(50003; "CGST"; Decimal)

       {

           Caption = 'CGST';

           DataClassification = CustomerContent;

       }

       field(50004; "SGST"; Decimal)

       {

           Caption = 'SGST';

           DataClassification = CustomerContent;

       }

       field(50013; "IGST"; Decimal)

       {

           Caption = 'IGST';

           DataClassification = CustomerContent;

       }       

   }    

}

reportextension 50127 requirefieldsext extends "Standard Sales - Draft Invoice"

{

   WordLayout = './StandardSalesDraftInvoice.docx';

   dataset

   {       

       add(Line)

       {           

           column(CGST; "CGST")

           {

           }

           column(SGST; "SGST")

           {

           }

           column(IGST; "IGST")

           {

           }           

       }

   }

var

        recDetailedGstLedgEnt: Record "Detailed GST Ledger Entry";

        SalesLine: Record "Sales Line";

        gIgstPer: Decimal;

        gCgstPer: Decimal;

        gSgstPer: Decimal;

 

    Trigger OnPostReport()

    Begin

        recDetailedGstLedgEnt.RESET;

        recDetailedGstLedgEnt.SetCurrentKey("GST Component Code");

        recDetailedGstLedgEnt.SETRANGE("Document No.", recDetailedGstLedgEnt."Document No.");

        //recDetailedGstLedgEnt.SETRANGE("Document Line No.", "Line No.");

 

        IF recDetailedGstLedgEnt.FINDSET THEN

            IF recDetailedGstLedgEnt."GST Component Code" = 'IGST' THEN BEGIN

                SalesLine.IGST := ABS(recDetailedGstLedgEnt."GST Amount");

                gIgstPer := recDetailedGstLedgEnt."GST %";

                /*Rec.GST := "GST Component Code" on recDetailedGstLedgEnt."GST %";*/

            END ELSE

 

                IF recDetailedGstLedgEnt."GST Component Code" = 'CGST' THEN BEGIN

                    SalesLine.CGST := ABS(recDetailedGstLedgEnt."GST Amount");

                    gCgstPer := recDetailedGstLedgEnt."GST %";

                    /*Rec.GST := "GST Component Code" on recDetailedGstLedgEnt."GST %";*/

                END ELSE

 

                    IF recDetailedGstLedgEnt."GST Component Code" = 'SGST' THEN BEGIN

                        SalesLine.SGST := ABS(recDetailedGstLedgEnt."GST Amount");

                        gSgstPer := recDetailedGstLedgEnt."GST %";

                        /*Rec.GST := "GST Component Code" on recDetailedGstLedgEnt."GST %";*/

                    END;

 

    End;

 

 

}

 My report showing as: pastedimage1661757163318v1.png

  • Suggested answer
    Amit Baru Profile Picture
    Amit Baru 3,027 on at
    RE: Unable to get CGST, SGST and IGST values in the sales invoice report

    Hi,

    Please use this link. In this link complete Sales invoice report developed.

    https://erpconsultors.com/sales-invoice-report-format-and-development/

    Regards

    Amit Sharma

    www.erpconsultors.com

    https://www.linkedin.com/in/amit-sharma-94542440/

    Press Yes if info is useful.

  • Revathi.T Profile Picture
    Revathi.T 76 on at
    RE: Unable to get CGST, SGST and IGST values in the sales invoice report

    I'll try it in RDLC report and let u know.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,085 Super User 2024 Season 1 on at
    RE: Unable to get CGST, SGST and IGST values in the sales invoice report

    Hi,

    Try to use the RDLC report. and check if the value is coming there.

  • Revathi.T Profile Picture
    Revathi.T 76 on at
    RE: Unable to get CGST, SGST and IGST values in the sales invoice report

    I corrected the same

    recDetailedGstLedgEnt.SETRANGE("Document No.", "Sales Line"."Document No.");

                       recDetailedGstLedgEnt.SETRANGE("Document Line No.", "Line No.");

    After running the program, i export word document from BC. I use CGST, SGST and IGST fields in the report from the XML pane. but Still couldn't get the value in report.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,085 Super User 2024 Season 1 on at
    RE: Unable to get CGST, SGST and IGST values in the sales invoice report

    Please correct as per below, take "Sales Line"."Document No." while filtering.

    recDetailedGstLedgEnt.SETRANGE("Document No.", "Sales Line"."Document No.");

                      recDetailedGstLedgEnt.SETRANGE("Document Line No.", "Line No.");

  • Revathi.T Profile Picture
    Revathi.T 76 on at
    RE: Unable to get CGST, SGST and IGST values in the sales invoice report

    Hi, I have updated like this.

    recDetailedGstLedgEnt.SETRANGE("Document No.", recDetailedGstLedgEnt."Document No.");

                       recDetailedGstLedgEnt.SETRANGE("Document Line No.", "Line No.");

    what shall i do now further?

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,085 Super User 2024 Season 1 on at
    RE: Unable to get CGST, SGST and IGST values in the sales invoice report

    Hi,

    Please update below code

    addlast(Line)

           {

               dataitem("Sales Line"; "Sales Line")

               {

                   trigger OnAfterGetRecord()

                   var

                       recDetailedGstLedgEnt: Record "Detailed GST Ledger Entry";

                       SalesLine: Record "Sales Line";

                       gIgstAmt: Decimal;

                       gCgstAmt: Decimal;

                       gSgstAmt: Decimal;

                       gIgstPer: Decimal;

                       gCgstPer: Decimal;

                       gSgstPer: Decimal;

                   Begin

                       recDetailedGstLedgEnt.RESET;

                       recDetailedGstLedgEnt.SetCurrentKey("GST Component Code");

                       recDetailedGstLedgEnt.SETRANGE("Document No.", "Sales Line"."Document No.");

                       //recDetailedGstLedgEnt.SETRANGE("Document Line No.", "Sales Line"."Line No.");

                       IF recDetailedGstLedgEnt.FINDSET THEN

                           IF recDetailedGstLedgEnt."GST Component Code" = 'IGST' THEN BEGIN

                               SalesLine.IGST := ABS(recDetailedGstLedgEnt."GST Amount");

                               gIgstPer := recDetailedGstLedgEnt."GST %";

                               SalesLine.Modify();

                           END ELSE

                               IF recDetailedGstLedgEnt."GST Component Code" = 'CGST' THEN BEGIN

                                   SalesLine.CGST := ABS(recDetailedGstLedgEnt."GST Amount");

                                   gCgstPer := recDetailedGstLedgEnt."GST %";

                                   SalesLine.Modify();

                               END ELSE

                                   IF recDetailedGstLedgEnt."GST Component Code" = 'SGST' THEN BEGIN

                                       SalesLine.SGST := ABS(recDetailedGstLedgEnt."GST Amount");

                                       gSgstPer := recDetailedGstLedgEnt."GST %";

                                       SalesLine.Modify();

                                   END;

                   End;

               }

  • Revathi.T Profile Picture
    Revathi.T 76 on at
    RE: Unable to get CGST, SGST and IGST values in the sales invoice report

    Hi, i have used OnAfterGetRecord trigger in the report extension. But Still i'm getting zero values only in report. I created fields in the sales line to get CGST,SGST and IGST as dataset in the XML Panel. so that i use that field in my reort to get values. But how variables can be used in the report to get value? can you please explain?

    addlast(Line)

           {

               dataitem("Sales Line"; "Sales Line")

               {

                   trigger OnAfterGetRecord()

                   var

                       recDetailedGstLedgEnt: Record "Detailed GST Ledger Entry";

                       SalesLine: Record "Sales Line";

                       gIgstAmt: Decimal;

                       gCgstAmt: Decimal;

                       gSgstAmt: Decimal;

                       gIgstPer: Decimal;

                       gCgstPer: Decimal;

                       gSgstPer: Decimal;

                   Begin

                       recDetailedGstLedgEnt.RESET;

                       recDetailedGstLedgEnt.SetCurrentKey("GST Component Code");

                       recDetailedGstLedgEnt.SETRANGE("Document No.", recDetailedGstLedgEnt."Document No.");

                       //recDetailedGstLedgEnt.SETRANGE("Document Line No.", "Line No.");

                       IF recDetailedGstLedgEnt.FINDSET THEN

                           IF recDetailedGstLedgEnt."GST Component Code" = 'IGST' THEN BEGIN

                               SalesLine.IGST := ABS(recDetailedGstLedgEnt."GST Amount");

                               gIgstPer := recDetailedGstLedgEnt."GST %";

                               SalesLine.Modify();

                           END ELSE

                               IF recDetailedGstLedgEnt."GST Component Code" = 'CGST' THEN BEGIN

                                   SalesLine.CGST := ABS(recDetailedGstLedgEnt."GST Amount");

                                   gCgstPer := recDetailedGstLedgEnt."GST %";

                                   SalesLine.Modify();

                               END ELSE

                                   IF recDetailedGstLedgEnt."GST Component Code" = 'SGST' THEN BEGIN

                                       SalesLine.SGST := ABS(recDetailedGstLedgEnt."GST Amount");

                                       gSgstPer := recDetailedGstLedgEnt."GST %";

                                       SalesLine.Modify();

                                   END;

                   End;

               }

  • Suggested answer
    Amit Baru Profile Picture
    Amit Baru 3,027 on at
    RE: Unable to get CGST, SGST and IGST values in the sales invoice report

    Hi,

    Pls write this code onAftergetrecord of Sales Line in Report for values. And I think there is no need to create fields in Sales Line for displaying values in Report. You display values in report by using varibales.

    Regards

    Amit Sharma

    www.erpconsultors.com

    https://www.linkedin.com/in/amit-sharma-94542440/

    Press Yes if info is useful. 

  • Revathi.T Profile Picture
    Revathi.T 76 on at
    RE: Unable to get CGST, SGST and IGST values in the sales invoice report

    I used salesline.modify() like this: But still i.m getting only 0.00 in my report.

    IF recDetailedGstLedgEnt.FINDSET THEN

               IF recDetailedGstLedgEnt."GST Component Code" = 'IGST' THEN BEGIN

                   SalesLine.IGST := ABS(recDetailedGstLedgEnt."GST Amount");

                   gIgstPer := recDetailedGstLedgEnt."GST %";

                   SalesLine.Modify();

                   /*Rec.GST := "GST Component Code" on recDetailedGstLedgEnt."GST %";*/

               END ELSE

                   IF recDetailedGstLedgEnt."GST Component Code" = 'CGST' THEN BEGIN

                       SalesLine.CGST := ABS(recDetailedGstLedgEnt."GST Amount");

                       gCgstPer := recDetailedGstLedgEnt."GST %";

                       SalesLine.Modify();

                       /*Rec.GST := "GST Component Code" on recDetailedGstLedgEnt."GST %";*/

                   END ELSE

                       IF recDetailedGstLedgEnt."GST Component Code" = 'SGST' THEN BEGIN

                           SalesLine.SGST := ABS(recDetailedGstLedgEnt."GST Amount");

                           gSgstPer := recDetailedGstLedgEnt."GST %";

                           SalesLine.Modify();

                           /*Rec.GST := "GST Component Code" on recDetailedGstLedgEnt."GST %";*/

                       END;

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,969 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,842 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans