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:
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
https://www.linkedin.com/in/amit-sharma-94542440/
Press Yes if info is useful.
I'll try it in RDLC report and let u know.
Hi,
Try to use the RDLC report. and check if the value is coming there.
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.
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.");
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?
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; } |
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;
}
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
https://www.linkedin.com/in/amit-sharma-94542440/
Press Yes if info is useful.
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;
André Arnaud de Cal...
291,969
Super User 2025 Season 1
Martin Dráb
230,842
Most Valuable Professional
nmaenpaa
101,156