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;