In vat posting setup table,there is a field.vat% .
I have created vat% flowfield in my Item table extension. and i want this flowfield value get in my excel report.
How to get this flowfield value in report? on which trigger i have to call this flowfield
Below is my excel report code using excel buffer.
report 50002 "Retails Item List"
{
Caption = 'Retails Item List';
UsageCategory = ReportsAndAnalysis;
ApplicationArea = All;
ProcessingOnly = true;
UseRequestPage = true;
dataset
{
dataitem(Item; Item)
{
dataitem("LSC Barcodes"; "LSC Barcodes")
{
RequestFilterFields = "Show for Item";
DataItemLink = "Item No." = field("No.");
DataItemTableView = sorting("Item No.", "Barcode No.");
trigger OnAfterGetRecord()
begin
ExcelBuffer.NewRow();
ExcelBuffer.AddColumn(Item."No.", false, '', false, false, false, '', ExcelBuffer."Cell Type"::Number);
ExcelBuffer.AddColumn(Item.Description, false, '', false, false, false, '', ExcelBuffer."Cell Type"::Text);
ExcelBuffer.AddColumn("LSC Barcodes"."Barcode No.", false, '', false, false, false, '', ExcelBuffer."Cell Type"::Number);
ExcelBuffer.AddColumn("LSC Barcodes"."Unit of Measure Code", false, '', false, false, false, '', ExcelBuffer."Cell Type"::Number);
ExcelBuffer.AddColumn(Item."VAT %", false, '', false, false, false, '', ExcelBuffer."Cell Type"::Number);
ExcelBuffer.AddColumn(Item."Unit Cost", false, '', false, false, false, '', ExcelBuffer."Cell Type"::Number);
ExcelBuffer.AddColumn(GetItemSellingPrice(Item."No."), false, '', false, false, false, '', ExcelBuffer."Cell Type"::Number);
ExcelBuffer.AddColumn(GetItemSellingPricewithvat(Item."No."), false, '', false, false, false, '', ExcelBuffer."Cell Type"::Number);
end;
}
trigger OnPreDataItem()
begin
ExcelBuffer.Reset();
ExcelBuffer.DeleteAll();
ExcelBuffer.NewRow();
ExcelBuffer.AddColumn(Item.FieldCaption("No."), false, '', false, false, false, '', ExcelBuffer."Cell Type"::Number);
ExcelBuffer.AddColumn(Item.FieldCaption(Description), false, '', false, false, false, '', ExcelBuffer."Cell Type"::Text);
ExcelBuffer.AddColumn("LSC Barcodes".FieldCaption("Barcode No."), false, '', false, false, false, '', ExcelBuffer."Cell Type"::Number);
ExcelBuffer.AddColumn("LSC Barcodes".FieldCaption("Unit of Measure Code"), false, '', false, false, false, '', ExcelBuffer."Cell Type"::Number);
ExcelBuffer.AddColumn(Item.FieldCaption("VAT %"), false, '', false, false, false, '', ExcelBuffer."Cell Type"::Number);
ExcelBuffer.AddColumn(Item.FieldCaption("Unit Cost"), false, '', false, false, false, '', ExcelBuffer."Cell Type"::Number);
ExcelBuffer.AddColumn('Selling price without GST', false, '', false, false, false, '', ExcelBuffer."Cell Type"::Number);
ExcelBuffer.AddColumn('Selling Price Without GST', false, '', false, false, false, '', ExcelBuffer."Cell Type"::Text);
end;
trigger OnPostDataItem()
var
Itemlbl: Label 'Retails Item List';
ExcelFileName: Label 'Retails Item List';
begin
ExcelBuffer.CreateNewBook(Itemlbl);
ExcelBuffer.WriteSheet(Itemlbl, CompanyName, UserId);
ExcelBuffer.SetColumnWidth('B', 46);
ExcelBuffer.SetColumnWidth('C', 15);
ExcelBuffer.SetColumnWidth('D', 20);
ExcelBuffer.SetColumnWidth('G', 21);
ExcelBuffer.CloseBook();
ExcelBuffer.SetFriendlyFilename(StrSubstNo(ExcelFileName, CurrentDateTime, UserId));
ExcelBuffer.OpenExcel();
end;
}
}
local procedure GetItemSellingPrice(ItemNo: Code[30]): Decimal
var
Rec_Item: Record Item;
Rec_SalesPrice: Record "Sales Price";
SalesPriceWithoutVAT: Decimal;
begin
Clear(Rec_SalesPrice);
Rec_SalesPrice.Reset();
Rec_SalesPrice.SetRange("Item No.", ItemNo);
Rec_SalesPrice.SetRange(Rec_SalesPrice."Sales Type", Rec_SalesPrice."Sales Type"::"All Customers");
Rec_SalesPrice.SetCurrentKey("Starting Date");
Rec_SalesPrice.SetAscending("Starting Date", false);
if Rec_SalesPrice.FindFirst() then begin
SalesPriceWithoutVAT := Rec_SalesPrice."Unit Price";
end
else begin
Clear(Rec_Item);
Rec_Item.Reset();
Rec_Item.SetRange("No.", ItemNo);
if Rec_Item.FindFirst() then begin
SalesPriceWithoutVAT := Rec_Item."Unit Price";
end;
end;
end;
local procedure GetItemSellingPricewithvat(ItemNo: Code[30]): Decimal
var
Rec_Item: Record Item;
Rec_SalesPrice: Record "Sales Price";
SalesPriceWithVAT: Decimal;
begin
Clear(Rec_SalesPrice);
Rec_SalesPrice.Reset();
Rec_SalesPrice.SetRange("Item No.", ItemNo);
Rec_SalesPrice.SetRange(Rec_SalesPrice."Sales Type", Rec_SalesPrice."Sales Type"::"All Customers");
Rec_SalesPrice.SetCurrentKey("Starting Date");
Rec_SalesPrice.SetAscending("Starting Date", false);
if Rec_SalesPrice.FindFirst() then begin
SalesPriceWithVAT := Rec_SalesPrice."LSC Unit Price Including VAT";
end
else begin
Clear(Rec_Item);
Rec_Item.Reset();
Rec_Item.SetRange("No.", ItemNo);
if Rec_Item.FindFirst() then begin
SalesPriceWithVAT := Rec_Item."LSC Unit Price Incl. VAT";
end;
end;
end;
var
ExcelBuffer: Record "Excel Buffer" temporary;
}
Is any way to do this.