I have used the above code in my page extension using OnAfterGetRecord trigger because i got error when i used Clear, now it runs successfully and opened in BC, But when i used the CGST, SGST and IGST fields from the table extension to report extension, All values are showing as 0.00. Following are the codes with table extension, page extension and report extension. where i made mistake? how to get values to the report?
tableextension 50126 requiredfieldstableheaderext extends "Sales Header"
{
fields
{
field(50012; PO_Number1; Code[100])
{
Caption = 'PO Number';
DataClassification = CustomerContent;
}
}
}
tableextension 50127 requiredfieldstableext extends "Sales Line"
{
fields
{
field(50001; Activity; Code[500])
{
Caption = 'Activity';
DataClassification = CustomerContent;
}
field(50002; "Gross Amount"; Decimal)
{
Caption = 'Gross Amount';
DataClassification = CustomerContent;
}
field(50003; "CGST"; Decimal)
{
Caption = 'CGST';
DataClassification = CustomerContent;
}
field(50004; "SGST"; Decimal)
{
Caption = 'SGST';
DataClassification = CustomerContent;
}
field(50013; "IGST"; Decimal)
{
Caption = 'IGST';
DataClassification = CustomerContent;
}
field(50005; "Total"; Decimal)
{
Caption = 'Total';
DataClassification = CustomerContent;
}
field(50014; "Total with IGST"; Decimal)
{
Caption = 'Total with IGST';
DataClassification = CustomerContent;
}
field(50011; TAX; Code[100])
{
Caption = 'TAX';
DataClassification = CustomerContent;
}
field(50015; "S.No."; Integer)
{
Caption = 'S.No.';
DataClassification = CustomerContent;
}
}
}
pageextension 50126 requiredfieldspageheaderext extends "Sales Invoice"
{
layout
{
addafter("Due Date")
{
field(PO_Number; Rec.PO_Number1)
{
ApplicationArea = All;
}
}
}
}
pageextension 50127 requiredfieldspageext extends "Sales Invoice Subform"
{
layout
{
addbefore(Description)
{
field(Activity; Rec.Activity)
{
ApplicationArea = All;
}
}
addbefore("GST Assessable Value (LCY)")
{
field(TAX; Rec.TAX)
{
ApplicationArea = All;
}
}
}
var
recDetailedGstLedgEnt: Record "Detailed GST Ledger Entry";
gIgstPer: Decimal;
gCgstPer: Decimal;
gSgstPer: Decimal;
Trigger OnafterGetRecord()
Begin
recDetailedGstLedgEnt.RESET;
recDetailedGstLedgEnt.SetCurrentKey("GST Component Code");
recDetailedGstLedgEnt.SETRANGE("Document No.", Rec."Document No.");
recDetailedGstLedgEnt.SETRANGE("Document Line No.", Rec."Line No.");
recDetailedGstLedgEnt.SetRange("Entry Type", recDetailedGstLedgEnt."Entry Type"::"Initial Entry");
IF recDetailedGstLedgEnt.FINDSET THEN begin
repeat
IF recDetailedGstLedgEnt."GST Component Code" = 'IGST' THEN BEGIN
Rec.IGST += -recDetailedGstLedgEnt."GST Amount";
gIgstPer += recDetailedGstLedgEnt."GST %";
END;
IF recDetailedGstLedgEnt."GST Component Code" = 'CGST' THEN BEGIN
Rec.CGST += -recDetailedGstLedgEnt."GST Amount";
gCgstPer += recDetailedGstLedgEnt."GST %";
END;
IF recDetailedGstLedgEnt."GST Component Code" = 'SGST' THEN BEGIN
Rec.SGST += -recDetailedGstLedgEnt."GST Amount";
gSgstPer += recDetailedGstLedgEnt."GST %";
END;
Until recDetailedGstLedgEnt.Next = 0;
end;
End;
}
reportextension 50127 requirefieldsext extends "Standard Sales - Draft Invoice"
{
WordLayout = './StandardSalesDraftInvoice.docx';
dataset
{
add(Header)
{
column(PO_Number1; PO_Number1)
{
}
}
add(Line)
{
column(Activity; Activity)
{
}
column(UNIT; "Unit of Measure")
{
}
column(QTY; Quantity)
{
}
column(RATE; "Unit Price")
{
}
column(AMOUNT; "Line Amount")
{
}
column(Gross_Amount; "Gross Amount")
{
}
column(CGST; "CGST")
{
}
column(SGST; "SGST")
{
}
column(IGST; "IGST")
{
}
column(Total; "Total")
{
}
column("TotalwithIGST"; "Total with IGST")
{
}
column("TAX"; TAX)
{
}
column(No_; "No.")
{
}
column(HSN_SAC_Code_; "HSN/SAC Code")
{
}
column("SNo"; "S.No.")
{
}
}
}
}