Page 99000913 Simulated Prod. Order Lines

Base Application, Microsoft.Manufacturing.Document

src/Layers/W1/BaseApp/Manufacturing/Document/SimulatedProdOrderLines.Page.al541 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.Manufacturing.Document;using Microsoft.Finance.Dimension;using Microsoft.Inventory.Availability;using Microsoft.Inventory.Item;using Microsoft.Inventory.Location;page 99000913 "Simulated Prod. Order Lines"{    AutoSplitKey = true;    Caption = 'Lines';    DelayedInsert = true;    LinksAllowed = false;    MultipleNewLines = true;    PageType = ListPart;    SourceTable = "Prod. Order Line";    SourceTableView = where(Status = const(Simulated));    layout    {        area(content)        {            repeater(Control1)            {                IndentationColumn = DescriptionIndent;                IndentationControls = Description;                ShowCaption = false;                field("Item No."; Rec."Item No.")                {                    ApplicationArea = Manufacturing;                }                field("Variant Code"; Rec."Variant Code")                {                    ApplicationArea = Planning;                    Visible = false;                }                field("Due Date"; Rec."Due Date")                {                    ApplicationArea = Manufacturing;                }                field(Description; Rec.Description)                {                    ApplicationArea = Manufacturing;                }                field("Description 2"; Rec."Description 2")                {                    ApplicationArea = Manufacturing;                    Visible = false;                }                field("Production BOM No."; Rec."Production BOM No.")                {                    ApplicationArea = Manufacturing;                    Visible = false;                }                field("Routing No."; Rec."Routing No.")                {                    ApplicationArea = Manufacturing;                    Visible = false;                }                field("Production BOM Version Code"; Rec."Production BOM Version Code")                {                    ApplicationArea = Manufacturing;                    Visible = false;                }                field("Routing Version Code"; Rec."Routing Version Code")                {                    ApplicationArea = Manufacturing;                    Visible = false;                }                field("Location Code"; Rec."Location Code")                {                    ApplicationArea = Location;                    Visible = false;                }                field("Bin Code"; Rec."Bin Code")                {                    ApplicationArea = Warehouse;                    Visible = false;                }                field("Starting Date-Time"; Rec."Starting Date-Time")                {                    ApplicationArea = Manufacturing;                    trigger OnValidate()                    begin                        CurrPage.Update(true);                    end;                }                field("Starting Time"; StartingTime)                {                    ApplicationArea = Manufacturing;                    Caption = 'Starting Time';                    ToolTip = 'Specifies the entry''s starting time, which is retrieved from the production order routing.';                    Visible = DateAndTimeFieldVisible;                    trigger OnValidate()                    begin                        Rec.Validate("Starting Time", StartingTime);                        CurrPage.Update(true);                    end;                }                field("Starting Date"; StartingDate)                {                    ApplicationArea = Manufacturing;                    Caption = 'Starting Date';                    ToolTip = 'Specifies the entry''s starting date, which is retrieved from the production order routing.';                    Visible = DateAndTimeFieldVisible;                    trigger OnValidate()                    begin                        Rec.Validate("Starting Date", StartingDate);                        CurrPage.Update(true);                    end;                }                field("Ending Date-Time"; Rec."Ending Date-Time")                {                    ApplicationArea = Manufacturing;                    trigger OnValidate()                    begin                        CurrPage.Update(true);                    end;                }                field("Ending Time"; EndingTime)                {                    ApplicationArea = Manufacturing;                    Caption = 'Ending Time';                    ToolTip = 'Specifies the entry''s ending time, which is retrieved from the production order routing.';                    Visible = DateAndTimeFieldVisible;                    trigger OnValidate()                    begin                        Rec.Validate("Ending Time", EndingTime);                        CurrPage.Update(true);                    end;                }                field("Ending Date"; EndingDate)                {                    ApplicationArea = Manufacturing;                    Caption = 'Ending Date';                    ToolTip = 'Specifies the entry''s ending date, which is retrieved from the production order routing.';                    Visible = DateAndTimeFieldVisible;                    trigger OnValidate()                    begin                        Rec.Validate("Ending Date", EndingDate);                        CurrPage.Update(true);                    end;                }                field("Scrap %"; Rec."Scrap %")                {                    ApplicationArea = Manufacturing;                    Visible = false;                }                field(Quantity; Rec.Quantity)                {                    ApplicationArea = Manufacturing;                    trigger OnValidate()                    begin                        CurrPage.Update(true);                    end;                }                field("Reserved Quantity"; Rec."Reserved Quantity")                {                    ApplicationArea = Reservation;                    Visible = false;                    trigger OnDrillDown()                    begin                        Rec.ShowReservationEntries(true);                    end;                }                field("Unit of Measure Code"; Rec."Unit of Measure Code")                {                    ApplicationArea = Manufacturing;                    trigger OnValidate()                    begin                        CurrPage.Update(true);                    end;                }                field("Unit Cost"; Rec."Unit Cost")                {                    ApplicationArea = Manufacturing;                }                field("Cost Amount"; Rec."Cost Amount")                {                    ApplicationArea = Manufacturing;                }                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 = Dimensions;                    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 = Dimensions;                    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 = Dimensions;                    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 = Dimensions;                    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 = Dimensions;                    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 = Dimensions;                    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;                }#if not CLEAN27                field("Standard Task Code"; Rec."Standard Task Code")                {                    ApplicationArea = Manufacturing;                    Visible = false;                    ObsoleteReason = 'Discontinued functionality';                    ObsoleteState = Pending;                    ObsoleteTag = '27.0';                }#endif            }        }    }    actions    {        area(processing)        {            group("F&unctions")            {                Caption = 'F&unctions';                Image = "Action";                action("Order &Tracking")                {                    ApplicationArea = Manufacturing;                    Caption = 'Order &Tracking';                    Image = OrderTracking;                    ToolTip = 'Tracks the connection of a supply to its corresponding demand. This can help you find the original demand that created a specific production order or purchase order.';                    trigger OnAction()                    begin                        Rec.ShowOrderTracking();                    end;                }            }            group("&Line")            {                Caption = '&Line';                Image = Line;                group("Item Availability by")                {                    Caption = 'Item Availability by';                    Image = ItemAvailability;                    action("Event")                    {                        ApplicationArea = Manufacturing;                        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                            ProdOrderAvailabilityMgt.ShowItemAvailFromProdOrderLine(Rec, "Item Availability Type"::"Event");                        end;                    }                    action(Period)                    {                        ApplicationArea = Manufacturing;                        Caption = 'Period';                        Image = Period;                        ToolTip = 'View the projected quantity of the item over time according to time periods, such as day, week, or month.';                        trigger OnAction()                        begin                            ProdOrderAvailabilityMgt.ShowItemAvailFromProdOrderLine(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                            ProdOrderAvailabilityMgt.ShowItemAvailFromProdOrderLine(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                            ProdOrderAvailabilityMgt.ShowItemAvailFromProdOrderLine(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."),                            "Location Filter" = field("Location Code"),                            "Variant Filter" = field("Variant Code");                        ToolTip = 'View the current and projected quantity of the item in each lot.';                    }                    action("BOM Level")                    {                        ApplicationArea = Manufacturing;                        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                            ProdOrderAvailabilityMgt.ShowItemAvailFromProdOrderLine(Rec, "Item Availability Type"::BOM);                        end;                    }                }                action("Reservation Entries")                {                    AccessByPermission = TableData Item = R;                    ApplicationArea = Reservation;                    Caption = 'Reservation Entries';                    Image = ReservationLedger;                    ToolTip = 'View the entries for every reservation that is made, either manually or automatically.';                    trigger OnAction()                    begin                        Rec.ShowReservationEntries(true);                    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;                }                action("Ro&uting")                {                    ApplicationArea = Manufacturing;                    Caption = 'Ro&uting';                    Image = Route;                    ToolTip = 'View or edit the operations list of the parent item on the line.';                    ShortCutKey = 'Ctrl+Alt+R';                    trigger OnAction()                    begin                        Rec.ShowRouting();                    end;                }                action(Components)                {                    ApplicationArea = Manufacturing;                    Caption = 'Components';                    Image = Components;                    ToolTip = 'View or edit the production order components of the parent item on the line.';                    ShortCutKey = 'Ctrl+Alt+C';                    trigger OnAction()                    begin                        ShowComponents();                    end;                }                action("Item &Tracking Lines")                {                    ApplicationArea = ItemTracking;                    Caption = 'Item &Tracking Lines';                    Image = ItemTrackingLines;                    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();                    end;                }            }        }    }    trigger OnAfterGetRecord()    begin        DescriptionIndent := 0;        Rec.ShowShortcutDimCode(ShortcutDimCode);        DescriptionOnFormat();        Rec.GetStartingEndingDateAndTime(StartingTime, StartingDate, EndingTime, EndingDate);    end;    trigger OnDeleteRecord(): Boolean    var        ProdOrderLineReserve: Codeunit "Prod. Order Line-Reserve";    begin        Commit();        if not ProdOrderLineReserve.DeleteLineConfirm(Rec) then            exit(false);    end;    trigger OnInit()    begin        DateAndTimeFieldVisible := false;    end;    trigger OnNewRecord(BelowxRec: Boolean)    begin        Clear(ShortcutDimCode);    end;    trigger OnOpenPage()    begin        DateAndTimeFieldVisible := false;    end;    var        ProdOrderAvailabilityMgt: Codeunit "Prod. Order Availability Mgt.";        StartingTime: Time;        EndingTime: Time;        StartingDate: Date;        EndingDate: Date;    protected var        ShortcutDimCode: array[8] of Code[20];        DescriptionIndent: Integer;        DateAndTimeFieldVisible: Boolean;    local procedure ShowComponents()    var        ProdOrderComp: Record "Prod. Order Component";    begin        ProdOrderComp.SetRange(Status, Rec.Status);        ProdOrderComp.SetRange("Prod. Order No.", Rec."Prod. Order No.");        ProdOrderComp.SetRange("Prod. Order Line No.", Rec."Line No.");        PAGE.Run(PAGE::"Prod. Order Components", ProdOrderComp);    end;    procedure UpdateForm(SetSaveRecord: Boolean)    begin        CurrPage.Update(SetSaveRecord);    end;    local procedure DescriptionOnFormat()    begin        DescriptionIndent := Rec."Planning Level Code";    end;}