web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Report needs to print from Card page - print all lines on Qty basis

(4) ShareShare
ReportReport
Posted on by 267
Hello,
I want to print report for all lines on basis of qty. To receive.
Means 2 items in 2 lines.
10 qty. To receive. For each then
Total 20 pages/sticker (10 for each)
& have to run this report from PO card page   -- but I am getting this as blank only, in layout I have used table to group on basis of Outputno and PurchHeader.No , So please suggest me what to do ? I am using action from PO card page to run this report.
 
    ApplicationArea = All;
    Caption = 'Purchase Item Labels';
    UsageCategory = ReportsAndAnalysis;
    DefaultLayout = RDLC;
    RDLCLayout = './ReportLayout/PurchaseLabels.rdl';
 
    dataset
    {
        dataitem(PurchHeader; "Purchase Header")
        {
            column(No; "No.") { }
            dataitem(PurchOrderLine; "Purchase Line")
            {
                DataItemLink = "Document No." = field("No."), "Document Type" = field("Document Type");
                DataItemTableView = sorting("Document Type", "Document No.");
                //RequestFilterFields = "Document No.";
                dataitem(copyloop; "Integer")
                {
                    DataItemTableView = SORTING(Number);
                    dataitem(PageLoop; "Integer")
                    {
                        DataItemTableView = SORTING(Number) WHERE(Number = CONST(1));
                        column(ProductCode; PurchOrderLine."No.") { }
                        column(ItemNo; PurchOrderLine."No.") { }
                        column(purchaseorderNo; PurchOrderLine."ORDER No.") { }
                        column(Description; PurchOrderLine.Description) { }
                        column(Qty; PurchOrderLine."quantity") { }
                        column(Barcode_Text; ItemNoBarCode) { }
                        column(Outputno; OutputNo) { }
                        column(CopyText; CopyText) { }
                        column(Bin_Code; PurchOrderLine."Bin Code") { }
                        column(supplierproductcode; supplierproductcode) { }
                        column(contactNumber; contactNumber) { }
                        column(contactmail; contactmail) { }
                        column(itemdescription; itemdescription) { }
                        column(contactText; contactText) { }
                    }
                    // Trigger: OnAfterGetRecord of PageLoop
                    trigger OnAfterGetRecord()
                    begin
                        if Number > 1 then begin
                            CopyText := FormatDocument.GetCOPYText;
                            OutputNo += 1;
                        end;
                    end;
 
                    trigger OnPreDataItem();
                    begin
                        if LabelstoPrint = 0 then
                            NoOfLoops := ABS(PurchOrderLine."Qty. to receive")
                        else
                            NoOfLoops := ABS(LabelstoPrint);
                        SETRANGE(Number, 1, NoOfLoops);
                        CopyText := '';
                    end;
                }
                //  Trigger: OnAfterGetRecord of CopyLoop
                trigger OnAfterGetRecord()
                var
                    BarcodeString: Text;
                    BarcodeFontProvider2d: Interface "Barcode Font Provider 2D";
                    BarcodeFontProvider: Interface "Barcode Font Provider";
                    PG: PAGE "Posted Purchase Receipt";
                    PG2: PAGE "Posted Purchase Rcpt. Subform";
                begin
                    GetItemData(PurchOrderLine."No.");
                   
                    contactText := contactmail + '     ' + contactNumber;
                    BarcodeFontProvider2d := Enum::"Barcode Font Provider 2D"::IDAutomation2D;
                    BarcodeSymbology2d := Enum::"Barcode Symbology 2d"::"QR-Code";
                    BarcodeString := "No.";
                    BarcodeString := BarcodeString.Replace('?', '');
                    BarcodeString := BarcodeString.Replace('_', '');
                    BarcodeString := BarcodeString.Replace('|', '');
                    //BarcodeFontProvider.ValidateInput(BarcodeString, BarcodeSymbology);
                    ItemNoBarCode := BarcodeFontProvider2d.EncodeFont(BarcodeString, BarcodeSymbology2d);
 
                end;
 
                trigger OnPreDataItem()
                begin
                    // CurrReport.SetTableView(PurchOrderLine);  // ✅ respect filters and marks
                    // PurchOrderLine.MarkedOnly(true);          // ✅ only print marked records
                end;
 
                trigger OnPostDataItem()
                begin
                    // PurchOrderLine.MarkedOnly(false);         // cleanup
                end;
            }
            trigger OnAfterGetRecord()
            var
            begin
 
            end;
        }
    }
    requestpage
    {
        layout
        {
            area(Content)
            {
                group(Options)
                {
                    Caption = 'Qty to Print';
                    field(LabelstoPrint; LabelstoPrint)
                    {
                        ApplicationArea = Basic, Suite;
                        Caption = 'Qty to Print';
                        ToolTip = 'Specifies the number of labels to be printed';
                    }
                }
            }
        }
        actions
        {
            area(Processing)
            {
            }
        }
    }
    var
        BarcodeSymbology: Enum "Barcode Symbology";
        BarcodeSymbology2D: Enum "Barcode Symbology 2D";
        ItemNoBarCode: Text;
        ItemNoQRCode: Text;
        PackingNote: Text;
        //new --------------
        FormatDocument: Codeunit "Format Document";
        NoOfCopies: Integer;
        NoOfLoops: Integer;
        CopyText: Text[30];
        OutputNo: Integer;
        Location: text; //doubt for the field to use
        supplierproductcode: text;
        contactmail: text;
        contactNumber: text;
        contactText: text;
        itemdescription: text;
        LabelstoPrint: Integer;
        tg: record "Purchase Line";
 
        VarQTYTORecv: integer;
 
    trigger OnInitReport()
    begin
        BarcodeSymbology := BarcodeSymbology::Code39;
        BarcodeSymbology2D := BarcodeSymbology2D::"QR-Code";
    end;
 
    Procedure GetItemData(ItemNo: code[20])
    var
        ItemRec: Record Item;
        RecRef: RecordRef;
        NoteText: Text[250];
    begin
        ItemRec.Reset();
        ItemRec.SetRange("No.", ItemNo);
        if ItemRec.FindFirst() then begin
            supplierproductcode := ItemRec."Vendor Item No.";
            itemdescription := ItemRec.Description;
        end;
    end;
 
 
    var
        ProductCode: text;
        Item_No: text;
 
        purchaseorderNo: text;
        description: text;
        qty: Decimal;
        Bin_code: text;
I have the same question (0)
  • Suggested answer
    OussamaSabbouh Profile Picture
    1,904 on at
    Report needs to print from Card page - print all lines on Qty basis
    Hello,
     
    Simplify your report to use PurchHeader → PurchLine → Integer loop.
    In OnPreDataItem of Integer, set:
     
    SetRange(Number,1,Abs(PurchLine."Qty. to Receive"));
     
    Then run the report from the PO card with:
     
    Report.RunModal(Report::"Purchase Item Labels", true, true, Rec);
     
    This prints one label per Qty. to Receive, no blanks.
     
    Regards,
    Oussama Sabbouh

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,214

#2
Sumit Singh Profile Picture

Sumit Singh 2,145

#3
YUN ZHU Profile Picture

YUN ZHU 1,887 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans