I'm new to this BC. I have created report extension for sales invoice report. Once i run that report extension, i can able to see only one sales line, even though i have more than two sales line in my sales invoice page.
In my page extension i used trigger OnAfterGetRecord and performed some calculations for the fields which i created in table, my calculations are working, like if i placed the fields cgst, sgst, total in sales invoice page through page extension i can able to see the calculated values for cgst, sgst and total, but i.m unable to get those values in my sales invoice report. how to get cgst, sgst, igst and total with gst values in sales invoice report through report extension?
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;
}
}
}
trigger OnAfterGetRecord()
begin
Rec."Gross Amount" := Rec."Amount Including VAT";
Rec.CGST := Rec."Amount Including VAT" * 0.09;
Rec.SGST := Rec."Amount Including VAT" * 0.09;
Rec.Total := Rec."Amount Including VAT" + Rec.CGST + Rec.SGST;
Rec.IGST := Rec."Amount Including VAT" * 0.18;
Rec."Total with IGST" := Rec."Amount Including VAT" + Rec.IGST;
end;
}
reportextension 50127 requirefieldsext extends "Standard Sales - Draft Invoice"
{
WordLayout = './StandardSalesDraftInvoice.docx';
dataset
{
add(Header)
{
column(Customer_GST_Registration_No; "Customer GST Reg. No.")
{
}
column(PO_Number1; PO_Number1)
{
}
}
addlast(Header)
{
dataitem("Company Information"; "Company Information")
{
column(GST_Registration_No_; "GST Registration No.")
{
}
column(P_A_N__No; "P.A.N. No.")
{
}
column(Home_Page; "Home Page")
{
}
column(City; City)
{
}
column(Post_Code; "Post Code")
{
}
}
}
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.")
{
}
}
}
}
This is my word document layout.
CompanyAddress1
|
|
|
CompanyAddress2
|
|
CompanyAddress3
|
|
City
|
|
Post_Code
|
|
GST_Registration_No_
|
|
P_A_N__No
|
|
|
|
|
|
|
Tax Invoice
|
|
|
|
|
BILL TO
|
|
|
CustomerAddress1
CustomerAddress2
CustomerAddress3
CustomerAddress4
Customer_GST_Registration_No
|
Invoice No.
|
DocumentNo
|
DocumentDate_Lbl
|
DocumentDate
|
DueDate_Lbl
|
DueDate
|
PaymentTermsDescription_Lbl
|
PaymentTermsDescription
|
PO Number
|
PO_Number1
|
|
|
|
|
|
|
|
No.
|
HSN/SAC
|
ACTIVITY
|
DESCRIPTION
|
UNIT
|
QTY
|
TAX
|
RATE
|
AMOUNT
|
ItemNo_Line
|
HSN_SAC_Code_
|
Description_Line
|
Activity
|
UnitOfMeasure
|
Quantity_Line
|
TAX
|
UnitPrice
|
LineAmount_Line
|
|
|
|
|
|
|
|
|
|
|
Gross Amount
|
AmountExcludingVAT_Line
|
CGST@9%
|
CGST
|
SGST@9%
|
SGST
|
Total Including GST
|
Total
|
|
|
Beneficiary Name:
|
CompanyAddress1
|
Bank Name:
|
CompanyBankName
|
Current Account No:
|
CompanyBankAccountNo
|
IFSC Code:
|
CompanyBankBranchNo
|