Case: Print Customized License Plate Contents label (Cloud Print)
- Johannes Sebastian Nielsen
Owned by Johannes Sebastian Nielsen
Requirements
Mobile WMS Extension version MOB5.48
Case
Modify the column and lines on License Plate Contents.
Proposed solution
License Plate Contents has four columns.
We will add "Cubage" and a value to column 2 column label and line value.
Modify Lines
Using event OnPrintLabel_OnAfterPopulateOrderListLine
Note how to Dataset.GetValue() is used to get the existing value, before adding to it using Dataset.SetValue().
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Print", 'OnPrintLabel_OnAfterPopulateOrderListLine', '', true, true)]
local procedure OnPrintLabelOnAfterPopulateDataset(_LinePath: Text; _SourceRecRef: RecordRef; var _Dataset: Record "MOB Common Element")
var
MobLanguage: Codeunit "MOB WMS Language";
LicensePlateContent: Record "MOB License Plate Content";
MobLabelTemplate: Record "MOB Label-Template";
WhseShipmentLine: Record "Warehouse Shipment Line";
begin
if not MobLabelTemplate.Get(_Dataset.GetValue('LabelTemplate')) then
exit;
// Check template is License Plate Contents
if MobLabelTemplate."Template Handler" <> MobLabelTemplate."Template Handler"::"License Plate Contents" then
exit;
// Lookup source line
if _SourceRecRef.Number <> Database::"MOB License Plate Content" then exit;
_SourceRecRef.SetTable(LicensePlateContent);
WhseShipmentLine.Get(LicensePlateContent."Whse. Document No.", LicensePlateContent."Whse. Document Line No.");
// Only modify Item Description lines.
if _LinePath.Contains('DESCRIPTION') then begin // Valid options are: 'DESCRIPTION', 'LOTNO', 'SNNO', 'EXPDATE' or 'PACKAGE'
// Add Cubage to Column label and value
_Dataset.SetValue(_LinePath + '/Col2_Label', // Set the label,
_Dataset.GetValue(_LinePath + '/Col2_Label') + ' & Cubage'); // by adding to the existing existing label
_Dataset.SetValue(_LinePath + '/Col2', // Set the value,
_Dataset.GetValue(_LinePath + '/Col2') + ' Cubage: ' + Format(WhseShipmentLine.Cubage)); // by adding to the existing existing value
end;
end;