Report 214 Pick Instruction
- App
- Base Application
- Namespace
- Microsoft.Sales.Document
- Versions
- 17-28
Versions171819202122232425262728
Source29
Source in 29
src/Layers/W1/BaseApp/Sales/Document/PickInstruction.Report.al271 lines, Copyright (c) Microsoft Corporation. MIT
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.Sales.Document;
using Microsoft.Assembly.Document;
using Microsoft.Foundation.UOM;
using System.Utilities;
/// <summary>
/// Generates a printable pick instruction document for warehouse staff to fulfill sales orders.
/// </summary>
report 214 "Pick Instruction"
{
Caption = 'Pick Instruction';
DefaultRenderingLayout = RDLCLayout;
dataset
{
dataitem(CopyLoop; "Integer")
{
DataItemTableView = sorting(Number);
column(Number; Number)
{
}
column(CompanyNameText; CompNameText)
{
}
column(DateText; DateTxt)
{
}
dataitem("Sales Header"; "Sales Header")
{
DataItemTableView = sorting("Document Type", "No.") where("Document Type" = const(Order));
RequestFilterFields = "No.";
column(No_SalesHeader; "No.")
{
IncludeCaption = true;
}
column(CustomerNo_SalesHeader; "Sell-to Customer No.")
{
IncludeCaption = true;
}
column(CustomerName_SalesHeader; "Sell-to Customer Name")
{
IncludeCaption = true;
}
dataitem("Sales Line"; "Sales Line")
{
DataItemLink = "Document Type" = field("Document Type"), "Document No." = field("No.");
DataItemTableView = sorting("Document Type", "Document No.", "Line No.") where(Type = const(Item));
column(LineNo_SalesLine; "Line No.")
{
}
column(ItemNo_SalesLine; "No.")
{
IncludeCaption = true;
}
column(Description_SalesLine; Description)
{
IncludeCaption = true;
}
column(VariantCode_SalesLine; "Variant Code")
{
IncludeCaption = true;
}
column(LocationCode_SalesLine; "Location Code")
{
IncludeCaption = true;
}
column(BinCode_SalesLine; "Bin Code")
{
IncludeCaption = true;
}
column(ShipmentDate_SalesLine; Format("Shipment Date"))
{
}
column(Quantity_SalesLine; Quantity)
{
IncludeCaption = true;
}
column(UnitOfMeasure_SalesLine; "Unit of Measure")
{
IncludeCaption = true;
}
column(QuantityToShip_SalesLine; "Qty. to Ship")
{
IncludeCaption = true;
}
column(QuantityShipped_SalesLine; "Quantity Shipped")
{
IncludeCaption = true;
}
column(QtyToAsm; QtyToAsm)
{
}
dataitem("Assembly Line"; "Assembly Line")
{
DataItemTableView = sorting("Document Type", "Document No.", "Line No.");
column(No_AssemblyLine; "No.")
{
IncludeCaption = true;
}
column(Description_AssemblyLine; Description)
{
IncludeCaption = true;
}
column(VariantCode_AssemblyLine; "Variant Code")
{
IncludeCaption = true;
}
column(Quantity_AssemblyLine; Quantity)
{
IncludeCaption = true;
}
column(QuantityPer_AssemblyLine; "Quantity per")
{
IncludeCaption = true;
}
column(UnitOfMeasure_AssemblyLine; GetUOM("Unit of Measure Code"))
{
}
column(LocationCode_AssemblyLine; "Location Code")
{
IncludeCaption = true;
}
column(BinCode_AssemblyLine; "Bin Code")
{
IncludeCaption = true;
}
column(QuantityToConsume_AssemblyLine; "Quantity to Consume")
{
IncludeCaption = true;
}
trigger OnPreDataItem()
begin
if not AsmExists then
CurrReport.Break();
SetRange("Document Type", AsmHeader."Document Type");
SetRange("Document No.", AsmHeader."No.");
end;
}
trigger OnAfterGetRecord()
var
AssembleToOrderLink: Record "Assemble-to-Order Link";
begin
AssembleToOrderLink.Reset();
AssembleToOrderLink.SetCurrentKey(Type, "Document Type", "Document No.", "Document Line No.");
AssembleToOrderLink.SetRange(Type, AssembleToOrderLink.Type::Sale);
AssembleToOrderLink.SetRange("Document Type", "Document Type");
AssembleToOrderLink.SetRange("Document No.", "Document No.");
AssembleToOrderLink.SetRange("Document Line No.", "Line No.");
AsmExists := AssembleToOrderLink.FindFirst();
QtyToAsm := 0;
if AsmExists then
if AsmHeader.Get(AssembleToOrderLink."Assembly Document Type", AssembleToOrderLink."Assembly Document No.") then
QtyToAsm := AsmHeader."Quantity to Assemble"
else
AsmExists := false;
end;
}
}
trigger OnPreDataItem()
begin
SetRange(Number, 1, NoOfCopies + 1);
end;
}
}
requestpage
{
layout
{
area(content)
{
group(Options)
{
Caption = 'Options';
field("No of Copies"; NoOfCopies)
{
ApplicationArea = Planning;
Caption = 'No of Copies';
ToolTip = 'Specifies how many copies of the document to print.';
}
}
}
}
actions
{
}
}
rendering
{
layout(RDLCLayout)
{
Type = RDLC;
LayoutFile = './Sales/Document/PickInstruction.rdlc';
Summary = 'Report layout made in the legacy RDLC format. Use an RDLC editor to modify the layout.';
}
}
labels
{
OrderPickingListCaption = 'Pick Instruction';
PageCaption = 'Page';
ItemNoCaption = 'Item No.';
OrderNoCaption = 'Order No.';
CustomerNoCaption = 'Customer No.';
CustomerNameCaption = 'Customer Name';
QtyToAssembleCaption = 'Quantity to Assemble';
QtyAssembledCaption = 'Quantity Assembled';
ShipmentDateCaption = 'Shipment Date';
QtyPickedCaption = 'Quantity Picked';
UOMCaption = 'Unit of Measure';
QtyConsumedCaption = 'Quantity Consumed';
CopyCaption = 'Copy';
}
trigger OnPreReport()
begin
DateTxt := Format(Today);
CompNameText := CompanyName;
end;
var
AsmHeader: Record "Assembly Header";
NoOfCopies: Integer;
DateTxt: Text;
CompNameText: Text;
QtyToAsm: Decimal;
AsmExists: Boolean;
local procedure GetUOM(UOMCode: Code[10]): Text
var
UnitOfMeasure: Record "Unit of Measure";
IsHandled: Boolean;
Result: Text;
begin
IsHandled := false;
OnBeforeGetUOM(UOMCode, Result, IsHandled);
if IsHandled then
exit(Result);
if UnitOfMeasure.Get(UOMCode) then
exit(UnitOfMeasure.Description);
exit(UOMCode);
end;
/// <summary>
/// Initializes the report request with the number of copies to print.
/// </summary>
/// <param name="NewNoOfCopies">The number of copies to print.</param>
procedure InitializeRequest(NewNoOfCopies: Integer)
begin
NoOfCopies := NewNoOfCopies;
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeGetUOM(UOMCode: Code[10]; var Result: Text; var IsHandled: Boolean)
begin
end;
}