Page 518 Purchase Lines

Base Application, Microsoft.Purchases.Document

src/Layers/W1/BaseApp/Purchases/Document/PurchaseLines.Page.al414 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.Purchases.Document;using Microsoft.Finance.AllocationAccount;using Microsoft.Finance.AllocationAccount.Purchase;using Microsoft.Finance.Dimension;using Microsoft.Inventory.Item;using Microsoft.Utilities;page 518 "Purchase Lines"{    ApplicationArea = Basic, Suite;    Caption = 'Purchase Lines';    Editable = false;    LinksAllowed = false;    PageType = List;    AboutTitle = 'About Purchase Lines';    AboutText = 'Track and manage purchase lines associated with projects, including details on vendors, quantities, costs, and expected receipt dates to ensure project supply needs are met and monitored.';    SourceTable = "Purchase Line";    UsageCategory = Lists;    layout    {        area(content)        {            repeater(Control1)            {                ShowCaption = false;                field("Document Type"; Rec."Document Type")                {                    ApplicationArea = Basic, Suite;                }                field("Document No."; Rec."Document No.")                {                    ApplicationArea = Basic, Suite;                }                field("Buy-from Vendor No."; Rec."Buy-from Vendor No.")                {                    ApplicationArea = Basic, Suite;                }                field("Buy-from Vendor Name"; Rec."Buy-from Vendor Name")                {                    ApplicationArea = Basic, Suite;                }                field("Line No."; Rec."Line No.")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field(Type; Rec.Type)                {                    ApplicationArea = Basic, Suite;                }                field("No."; Rec."No.")                {                    ApplicationArea = Basic, Suite;                }                field("Variant Code"; Rec."Variant Code")                {                    ApplicationArea = Planning;                    Visible = false;                }                field(Description; Rec.Description)                {                    ApplicationArea = Basic, Suite;                }                field("Description 2"; Rec."Description 2")                {                    ApplicationArea = Basic, Suite;                    Importance = Additional;                    Visible = false;                }                field("Location Code"; Rec."Location Code")                {                    ApplicationArea = Location;                    Visible = true;                }                field(Quantity; Rec.Quantity)                {                    ApplicationArea = Basic, Suite;                }                field("Reserved Qty. (Base)"; Rec."Reserved Qty. (Base)")                {                    ApplicationArea = Reservation;                }                field("Unit of Measure Code"; Rec."Unit of Measure Code")                {                    ApplicationArea = Basic, Suite;                }                field("Direct Unit Cost"; Rec."Direct Unit Cost")                {                    ApplicationArea = Basic, Suite;                }                field("Indirect Cost %"; Rec."Indirect Cost %")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Unit Cost (LCY)"; Rec."Unit Cost (LCY)")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Unit Price (LCY)"; Rec."Unit Price (LCY)")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Line Amount"; Rec."Line Amount")                {                    ApplicationArea = Basic, Suite;                    BlankZero = true;                }                field("Order No."; Rec."Order No.")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Purchasing Code"; Rec."Purchasing Code")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Drop Shipment"; Rec."Drop Shipment")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Allocation Account No."; Rec."Selected Alloc. Account No.")                {                    ApplicationArea = All;                    Caption = 'Allocation Account No.';                    Visible = UseAllocationAccountNumber;                    trigger OnValidate()                    var                        PurchaseAllocAccMgt: Codeunit "Purchase Alloc. Acc. Mgt.";                    begin                        PurchaseAllocAccMgt.VerifySelectedAllocationAccountNo(Rec);                    end;                }                field("Job No."; Rec."Job No.")                {                    ApplicationArea = Jobs;                    Visible = false;                }                field("Job Task No."; Rec."Job Task No.")                {                    ApplicationArea = Jobs;                    Visible = false;                }                field("Job Line Type"; Rec."Job Line Type")                {                    ApplicationArea = Jobs;                    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 = 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;                }                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;                }                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;                }                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;                }                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;                }                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;                }                field("Expected Receipt Date"; Rec."Expected Receipt Date")                {                    ApplicationArea = Basic, Suite;                }                field("Outstanding Quantity"; Rec."Outstanding Quantity")                {                    ApplicationArea = Basic, Suite;                }                field("Outstanding Amount (LCY)"; Rec."Outstanding Amount (LCY)")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Amt. Rcd. Not Invoiced (LCY)"; Rec."Amt. Rcd. Not Invoiced (LCY)")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }            }        }    }    actions    {        area(navigation)        {            group("&Line")            {                Caption = '&Line';                Image = Line;                action("Show Document")                {                    ApplicationArea = Basic, Suite;                    Caption = 'Show Document';                    Image = View;                    ShortCutKey = 'Shift+F7';                    ToolTip = 'Open the document that the selected line exists on.';                    trigger OnAction()                    var                        PageManagement: Codeunit "Page Management";                    begin                        PurchHeader.Get(Rec."Document Type", Rec."Document No.");                        PageManagement.PageRun(PurchHeader);                        OnShowDocumentOnAfterOnAction(PurchHeader);                    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("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;                }                action("Detach Lines")                {                    ApplicationArea = Basic, Suite;                    Caption = 'Detach Lines';                    Image = CancelAllLines;                    Visible = DetachLinesVisible;                    ToolTip = 'Detach the selected non-inventory product lines from the inventory item line.';                    trigger OnAction()                    var                        PurchaseLine: Record "Purchase Line";                    begin                        CurrPage.SetSelectionFilter(PurchaseLine);                        PurchaseLine.ModifyAll("Attached to Line No.", 0);                    end;                }                action(RedistributeAccAllocations)                {                    ApplicationArea = All;                    Caption = 'Redistribute Account Allocations';                    Image = EditList;#pragma warning disable AA0219                    ToolTip = 'Use this action to redistribute the account allocations for this line.';#pragma warning restore AA0219                    trigger OnAction()                    var                        AllocAccManualOverride: Page "Redistribute Acc. Allocations";                    begin                        if ((Rec."Type" <> Rec."Type"::"Allocation Account") and (Rec."Selected Alloc. Account No." = '')) then                            Error(ActionOnlyAllowedForAllocationAccountsErr);                        AllocAccManualOverride.SetParentSystemId(Rec.SystemId);                        AllocAccManualOverride.SetParentTableId(Database::"Purchase Line");                        AllocAccManualOverride.RunModal();                    end;                }                action(ReplaceAllocationAccountWithLines)                {                    ApplicationArea = All;                    Caption = 'Generate lines from Allocation Account Line';                    Image = CreateLinesFromJob;#pragma warning disable AA0219                    ToolTip = 'Use this action to replace the Allocation Account line with the actual lines that would be generated from the line itself.';#pragma warning restore AA0219                    trigger OnAction()                    var                        PurchaseAllocAccMgt: Codeunit "Purchase Alloc. Acc. Mgt.";                    begin                        if ((Rec."Type" <> Rec."Type"::"Allocation Account") and (Rec."Selected Alloc. Account No." = '')) then                            Error(ActionOnlyAllowedForAllocationAccountsErr);                        PurchaseAllocAccMgt.CreateLinesFromAllocationAccountLine(Rec);                        Rec.Delete();                        CurrPage.Update(false);                    end;                }            }        }        area(Promoted)        {            group(Category_Process)            {                Caption = 'Process', Comment = 'Generated from the PromotedActionCategories property index 1.';                actionref("Show Document_Promoted"; "Show Document")                {                }                actionref("Item &Tracking Lines_Promoted"; "Item &Tracking Lines")                {                }                actionref("Reservation Entries_Promoted"; "Reservation Entries")                {                }                actionref("Detach Lines_Promoted"; "Detach Lines")                {                }            }        }    }    var        UseAllocationAccountNumber: Boolean;        ActionOnlyAllowedForAllocationAccountsErr: Label 'This action is only available for lines that have Allocation Account set as Type.';    trigger OnAfterGetRecord()    begin        Rec.ShowShortcutDimCode(ShortcutDimCode);    end;    trigger OnNewRecord(BelowxRec: Boolean)    begin        Clear(ShortcutDimCode);    end;    trigger OnOpenPage()    var        AllocationAccountMgt: Codeunit "Allocation Account Mgt.";    begin        UseAllocationAccountNumber := AllocationAccountMgt.UseAllocationAccountNoField();        DetachLinesVisible := Rec.GetFilter("Attached to Line No.") <> '';    end;    var        PurchHeader: Record "Purchase Header";        DetachLinesVisible: Boolean;    protected var        ShortcutDimCode: array[8] of Code[20];    [IntegrationEvent(true, false)]    local procedure OnShowDocumentOnAfterOnAction(var PurchHeader: Record "Purchase Header")    begin    end;}