Hi,
I've written a page extension to add a custom report directly on the Sales Order.
pageextension 50210 APTRRC_SalesOrder extends "Sales Order" { actions { addafter(AttachAsPDF) { action(APTRRC_ASNLabel) { Caption = 'Certificate Of Analysis'; Promoted = true; Image = Report; PromotedCategory = Category11; ApplicationArea = All; trigger OnAction() var SOLine: Record "Sales Line"; begin SOLine.Reset(); SOLine.SetRange("Document No.", "No."); Report.Run(50001, true, true, SOLine); end; } } } }
Report
report 50001 APTRRC_CertificateofAnalysis { DefaultLayout = Word; WordLayout = '.\src\Business Central\src\reportLayout\Certificate of Analysis.docx'; Caption = 'Certificate of Analysis'; UsageCategory = Lists; AccessByPermission = report APTRRC_CertificateofAnalysis = X; ApplicationArea = All; dataset { dataitem(SOHeader; "Sales Header") { RequestFilterFields = "No."; column(Order_Date; "Order Date") { IncludeCaption = true; } column(External_Document_No_; "External Document No.") { IncludeCaption = true; } column(No_; "No.") { IncludeCaption = true; } column(Sell_to_Customer_No_; "Sell-to Customer No.") { IncludeCaption = true; } dataitem(CustomerInfo; Customer) { DataItemTableView = sorting("No."); DataItemLink = "No." = field("Sell-to Customer No."); column(Name; Name) { IncludeCaption = true; } column(Ship_to_Code; "Ship-to Code") { IncludeCaption = true; } column(E_Mail; "E-Mail") { IncludeCaption = true; } } dataitem(SalesLines; "Sales Line") { DataItemTableView = sorting("Document No."); RequestFilterFields = "Document No.", "Lot No."; DataItemLink = "Document No." = field("No."); column(ItemNo_; "No.") { IncludeCaption = true; } column(Description; Description) { IncludeCaption = true; } column(Bin_Code; "Bin Code") { IncludeCaption = true; } column(Lot_No_; "Lot No.") { IncludeCaption = true; } dataitem(QAExpiryDate; "Tracking Specification") { DataItemLink = "Source ID" = field("Document No."), "Lot No." = field("Lot No."), "Item No." = field("No."); column(Expiration_Date; "Expiration Date") { } } dataitem(QA; "QA Answer") { RequestFilterFields = "Source No. 3"; column(QA_Questionnaire_Code; "QA Questionnaire Code") { IncludeCaption = true; } column(QA_Question_Category_Code; "QA Question Category Code") { IncludeCaption = true; } column(Answer; Answer) { IncludeCaption = true; } column(Source_No_; "Source No.") { IncludeCaption = true; } column(Source_No__3; "Source No. 3") { IncludeCaption = true; } dataitem(QAC; "QA Question Category") { DataItemLink = "Code" = field("QA Question Category Code"); column(CategoryDescription; Description) { IncludeCaption = true; } } dataitem(QAHeader; "QA Header") { DataItemLink = "Source No." = field("Source No."), "Source No. 3" = field("Source No. 3"); column(HeaderQuestionnaire_Code; "QA Questionnaire Code") { } dataitem(ExpiryDate; "QA Questionnaire Header") { DataItemLink = "Code" = field("QA Questionnaire Code"); column(Ending_Date; "Ending Date") { IncludeCaption = true; } } } } } } } }
The report appears with the Document Number in the filter - I want to make it better by passing the Lot Numbers as well that are on the Sales Order Lines
Any suggestions how to do that?