Page 5741 Transfer Order Subform

Base Application, Microsoft.Inventory.Transfer

src/Layers/W1/BaseApp/Inventory/Transfer/TransferOrderSubform.Page.al547 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.Inventory.Transfer;using Microsoft.Finance.Dimension;using Microsoft.Foundation.Enums;using Microsoft.Inventory.Availability;using Microsoft.Inventory.BOM;using Microsoft.Inventory.Item;using Microsoft.Inventory.Location;page 5741 "Transfer Order Subform"{    AutoSplitKey = true;    Caption = 'Lines';    DelayedInsert = true;    LinksAllowed = false;    MultipleNewLines = true;    PageType = ListPart;    SourceTable = "Transfer Line";    layout    {        area(content)        {            repeater(Control1)            {                ShowCaption = false;                field("Item No."; Rec."Item No.")                {                    ApplicationArea = Location;                    trigger OnValidate()                    begin                        UpdateForm(true);                    end;                }                field("Variant Code"; Rec."Variant Code")                {                    ApplicationArea = Planning;                    Visible = false;                }                field("Planning Flexibility"; Rec."Planning Flexibility")                {                    ApplicationArea = Planning;                    Visible = false;                }                field(Description; Rec.Description)                {                    ApplicationArea = Location;                    ToolTip = 'Specifies a description of the entry.';                }                field("Description 2"; Rec."Description 2")                {                    ApplicationArea = All;                    Visible = false;                }                field("Transfer-from Bin Code"; Rec."Transfer-from Bin Code")                {                    ApplicationArea = Warehouse;                    Visible = false;                }                field("Transfer-To Bin Code"; Rec."Transfer-To Bin Code")                {                    ApplicationArea = Warehouse;                    Visible = false;                }                field(Quantity; Rec.Quantity)                {                    ApplicationArea = Location;                    BlankZero = true;                }                field("Reserved Quantity Inbnd."; Rec."Reserved Quantity Inbnd.")                {                    ApplicationArea = Reservation;                    BlankZero = true;                }                field("Reserved Quantity Shipped"; Rec."Reserved Quantity Shipped")                {                    ApplicationArea = Reservation;                    BlankZero = true;                }                field("Reserved Quantity Outbnd."; Rec."Reserved Quantity Outbnd.")                {                    ApplicationArea = Reservation;                    BlankZero = true;                }                field("Unit of Measure Code"; Rec."Unit of Measure Code")                {                    ApplicationArea = Location;                }                field("Unit of Measure"; Rec."Unit of Measure")                {                    ApplicationArea = Location;                    Visible = false;                }                field("Qty. to Ship"; Rec."Qty. to Ship")                {                    ApplicationArea = Location;                    BlankZero = true;                }                field("Quantity Shipped"; Rec."Quantity Shipped")                {                    ApplicationArea = Location;                    BlankZero = true;                    trigger OnDrillDown()                    var                        TransShptLine: Record "Transfer Shipment Line";                    begin                        Rec.TestField("Document No.");                        Rec.TestField("Item No.");                        TransShptLine.SetCurrentKey("Transfer Order No.", "Item No.", "Shipment Date");                        TransShptLine.SetRange("Transfer Order No.", Rec."Document No.");                        TransShptLine.SetRange("Line No.", Rec."Line No.");                        PAGE.RunModal(0, TransShptLine);                    end;                }                field("Qty. to Receive"; Rec."Qty. to Receive")                {                    ApplicationArea = Location;                    BlankZero = true;                    Editable = not Rec."Direct Transfer";                }                field("Quantity Received"; Rec."Quantity Received")                {                    ApplicationArea = Location;                    BlankZero = true;                    trigger OnDrillDown()                    var                        TransRcptLine: Record "Transfer Receipt Line";                    begin                        Rec.TestField("Document No.");                        Rec.TestField("Item No.");                        TransRcptLine.SetCurrentKey("Transfer Order No.", "Item No.", "Receipt Date");                        TransRcptLine.SetRange("Transfer Order No.", Rec."Document No.");                        TransRcptLine.SetRange("Line No.", Rec."Line No.");                        PAGE.RunModal(0, TransRcptLine);                    end;                }                field("Shipment Date"; Rec."Shipment Date")                {                    ApplicationArea = Location;                }                field("Receipt Date"; Rec."Receipt Date")                {                    ApplicationArea = Location;                }                field("Shipping Agent Code"; Rec."Shipping Agent Code")                {                    ApplicationArea = Location;                    Visible = false;                }                field("Shipping Agent Service Code"; Rec."Shipping Agent Service Code")                {                    ApplicationArea = Location;                    Visible = false;                }                field("Shipping Time"; Rec."Shipping Time")                {                    ApplicationArea = Location;                    Visible = false;                }                field("Outbound Whse. Handling Time"; Rec."Outbound Whse. Handling Time")                {                    ApplicationArea = Warehouse;                    Visible = false;                }                field("Inbound Whse. Handling Time"; Rec."Inbound Whse. Handling Time")                {                    ApplicationArea = Warehouse;                    Visible = false;                }                field("Appl.-to Item Entry"; Rec."Appl.-to Item Entry")                {                    ApplicationArea = Location;                    Visible = false;                }                field("Shortcut Dimension 1 Code"; Rec."Shortcut Dimension 1 Code")                {                    ApplicationArea = Dimensions;                    Visible = false;                }                field("Shortcut Dimension 2 Code"; Rec."Shortcut Dimension 2 Code")                {                    ApplicationArea = Dimensions;                    Visible = false;                }                field("ShortcutDimCode[3]"; ShortcutDimCode[3])                {                    ApplicationArea = Location;                    CaptionClass = '1,2,3';                    TableRelation = "Dimension Value".Code where("Global Dimension No." = const(3),                                                                  "Dimension Value Type" = const(Standard),                                                                  Blocked = const(false));                    Visible = false;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(3, ShortcutDimCode[3]);                    end;                }                field("ShortcutDimCode[4]"; ShortcutDimCode[4])                {                    ApplicationArea = Location;                    CaptionClass = '1,2,4';                    TableRelation = "Dimension Value".Code where("Global Dimension No." = const(4),                                                                  "Dimension Value Type" = const(Standard),                                                                  Blocked = const(false));                    Visible = false;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(4, ShortcutDimCode[4]);                    end;                }                field("ShortcutDimCode[5]"; ShortcutDimCode[5])                {                    ApplicationArea = Location;                    CaptionClass = '1,2,5';                    TableRelation = "Dimension Value".Code where("Global Dimension No." = const(5),                                                                  "Dimension Value Type" = const(Standard),                                                                  Blocked = const(false));                    Visible = false;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(5, ShortcutDimCode[5]);                    end;                }                field("ShortcutDimCode[6]"; ShortcutDimCode[6])                {                    ApplicationArea = Location;                    CaptionClass = '1,2,6';                    TableRelation = "Dimension Value".Code where("Global Dimension No." = const(6),                                                                  "Dimension Value Type" = const(Standard),                                                                  Blocked = const(false));                    Visible = false;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(6, ShortcutDimCode[6]);                    end;                }                field("ShortcutDimCode[7]"; ShortcutDimCode[7])                {                    ApplicationArea = Location;                    CaptionClass = '1,2,7';                    TableRelation = "Dimension Value".Code where("Global Dimension No." = const(7),                                                                  "Dimension Value Type" = const(Standard),                                                                  Blocked = const(false));                    Visible = false;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(7, ShortcutDimCode[7]);                    end;                }                field("ShortcutDimCode[8]"; ShortcutDimCode[8])                {                    ApplicationArea = Location;                    CaptionClass = '1,2,8';                    TableRelation = "Dimension Value".Code where("Global Dimension No." = const(8),                                                                  "Dimension Value Type" = const(Standard),                                                                  Blocked = const(false));                    Visible = false;                    trigger OnValidate()                    begin                        Rec.ValidateShortcutDimCode(8, ShortcutDimCode[8]);                    end;                }            }        }    }    actions    {        area(processing)        {            action(SelectMultiItems)            {                AccessByPermission = TableData Item = R;                ApplicationArea = Basic, Suite;                Caption = 'Select items';                Ellipsis = true;                Image = NewItem;                ToolTip = 'Add two or more items from the full list of your inventory items.';                trigger OnAction()                begin                    Rec.SelectMultipleItems();                end;            }            group("F&unctions")            {                Caption = 'F&unctions';                Image = "Action";                action(Reserve)                {                    ApplicationArea = Reservation;                    Caption = '&Reserve';                    Image = Reserve;                    ToolTip = 'Reserve the quantity that is required on the document line that you opened this window for.';                    trigger OnAction()                    begin                        Rec.Find();                        Rec.ShowReservation();                    end;                }                action(ReserveFromInventory)                {                    ApplicationArea = Basic, Suite;                    Caption = 'Reserve from &Inventory';                    Image = LineReserve;                    ToolTip = 'Reserve items for the selected line from inventory.';                    trigger OnAction()                    begin                        ReserveSelectedLines();                    end;                }                action(ExplodeBOM_Functions)                {                    AccessByPermission = TableData "BOM Component" = R;                    ApplicationArea = Suite;                    Caption = 'E&xplode BOM';                    Image = ExplodeBOM;                    ToolTip = 'Add a line for each component on the bill of materials for the selected item. For example, this is useful for selling the parent item as a kit. CAUTION: The line for the parent item will be deleted and only its description will display. To undo this action, delete the component lines and add a line for the parent item again.';                    trigger OnAction()                    begin                        ExplodeBOM();                    end;                }            }            group("&Line")            {                Caption = '&Line';                Image = Line;                group("Item Availability by")                {                    Caption = 'Item Availability by';                    Image = ItemAvailability;                    action("Event")                    {                        ApplicationArea = Basic, Suite;                        Caption = 'Event';                        Image = "Event";                        ToolTip = 'View how the actual and the projected available balance of an item will develop over time according to supply and demand events.';                        trigger OnAction()                        begin                            TransferAvailabilityMgt.ShowItemAvailabilityFromTransLine(Rec, "Item Availability Type"::"Event");                        end;                    }                    action(Period)                    {                        ApplicationArea = Basic, Suite;                        Caption = 'Period';                        Image = Period;                        ToolTip = 'Show the projected quantity of the item over time according to time periods, such as day, week, or month.';                        trigger OnAction()                        begin                            TransferAvailabilityMgt.ShowItemAvailabilityFromTransLine(Rec, "Item Availability Type"::Period);                        end;                    }                    action(Variant)                    {                        ApplicationArea = Planning;                        Caption = 'Variant';                        Image = ItemVariant;                        ToolTip = 'View or edit the item''s variants. Instead of setting up each color of an item as a separate item, you can set up the various colors as variants of the item.';                        trigger OnAction()                        begin                            TransferAvailabilityMgt.ShowItemAvailabilityFromTransLine(Rec, "Item Availability Type"::Variant);                        end;                    }                    action(Location)                    {                        AccessByPermission = TableData Location = R;                        ApplicationArea = Location;                        Caption = 'Location';                        Image = Warehouse;                        ToolTip = 'View the actual and projected quantity of the item per location.';                        trigger OnAction()                        begin                            TransferAvailabilityMgt.ShowItemAvailabilityFromTransLine(Rec, "Item Availability Type"::Location);                        end;                    }                    action(Lot)                    {                        ApplicationArea = ItemTracking;                        Caption = 'Lot';                        Image = LotInfo;                        RunObject = Page "Item Availability by Lot No.";                        RunPageLink = "No." = field("Item No."),                            "Variant Filter" = field("Variant Code");                        ToolTip = 'View the current and projected quantity of the item in each lot.';                    }                    action("BOM Level")                    {                        ApplicationArea = Location;                        Caption = 'BOM Level';                        Image = BOMLevel;                        ToolTip = 'View availability figures for items on bills of materials that show how many units of a parent item you can make based on the availability of child items.';                        trigger OnAction()                        begin                            TransferAvailabilityMgt.ShowItemAvailabilityFromTransLine(Rec, "Item Availability Type"::BOM);                        end;                    }                }                action(Dimensions)                {                    AccessByPermission = TableData Dimension = R;                    ApplicationArea = Dimensions;                    Caption = 'Dimensions';                    Image = Dimensions;                    ShortCutKey = 'Alt+D';                    ToolTip = 'View or edit dimensions, such as area, project, or department, that you can assign to sales and purchase documents to distribute costs and analyze transaction history.';                    trigger OnAction()                    begin                        Rec.ShowDimensions();                    end;                }                group("Item &Tracking Lines")                {                    Caption = 'Item &Tracking Lines';                    Image = AllLines;                    action(Shipment)                    {                        ApplicationArea = ItemTracking;                        Caption = 'Shipment';                        Image = Shipment;                        ShortCutKey = 'Ctrl+Alt+I';                        ToolTip = 'View or edit serial, lot and package numbers that are assigned to the item on the document or journal line.';                        trigger OnAction()                        begin                            Rec.OpenItemTrackingLines("Transfer Direction"::Outbound);                        end;                    }                    action(Receipt)                    {                        ApplicationArea = ItemTracking;                        Caption = 'Receipt';                        Image = Receipt;                        ShortCutKey = 'Shift+Ctrl+R';                        ToolTip = 'View or edit serial, lot and package numbers that are assigned to the item on the document or journal line.';                        trigger OnAction()                        begin                            Rec.OpenItemTrackingLinesWithReclass("Transfer Direction"::Inbound);                        end;                    }                }            }        }    }    trigger OnAfterGetRecord()    begin        Rec.ShowShortcutDimCode(ShortcutDimCode);    end;    trigger OnDeleteRecord(): Boolean    var        TransferLineReserve: Codeunit "Transfer Line-Reserve";    begin        Commit();        if not TransferLineReserve.DeleteLineConfirm(Rec) then            exit(false);        TransferLineReserve.DeleteLine(Rec);    end;    trigger OnNewRecord(BelowxRec: Boolean)    begin        Clear(ShortcutDimCode);    end;    trigger OnOpenPage()    begin        SetDimensionsVisibility();    end;    var        TransferAvailabilityMgt: Codeunit "Transfer Availability Mgt.";    protected var        ShortcutDimCode: array[8] of Code[20];        DimVisible1: Boolean;        DimVisible2: Boolean;        DimVisible3: Boolean;        DimVisible4: Boolean;        DimVisible5: Boolean;        DimVisible6: Boolean;        DimVisible7: Boolean;        DimVisible8: Boolean;    procedure UpdateForm(SetSaveRecord: Boolean)    begin        CurrPage.Update(SetSaveRecord);    end;    procedure ExplodeBOM()    begin        Codeunit.Run(Codeunit::"Transfer-Explode BOM", Rec);    end;    local procedure ReserveSelectedLines()    var        TransLine: Record "Transfer Line";    begin        CurrPage.SetSelectionFilter(TransLine);        Rec.ReserveFromInventory(TransLine);    end;    local procedure SetDimensionsVisibility()    var        DimMgt: Codeunit DimensionManagement;    begin        DimVisible1 := false;        DimVisible2 := false;        DimVisible3 := false;        DimVisible4 := false;        DimVisible5 := false;        DimVisible6 := false;        DimVisible7 := false;        DimVisible8 := false;        DimMgt.UseShortcutDims(          DimVisible1, DimVisible2, DimVisible3, DimVisible4, DimVisible5, DimVisible6, DimVisible7, DimVisible8);        Clear(DimMgt);    end;}