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: 