Page 137 Posted Purchase Rcpt. Subform

Base Application, Microsoft.Purchases.History

src/Layers/W1/BaseApp/Purchases/History/PostedPurchaseRcptSubform.Page.al451 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.History;using Microsoft.Finance.Dimension;using Microsoft.Foundation.Navigate;using Microsoft.Inventory.Item.Catalog;using Microsoft.Inventory.Ledger;using System.Environment.Configuration;page 137 "Posted Purchase Rcpt. Subform"{    AutoSplitKey = true;    Caption = 'Lines';    Editable = false;    LinksAllowed = false;    PageType = ListPart;    SourceTable = "Purch. Rcpt. Line";    layout    {        area(content)        {            repeater(Control1)            {                ShowCaption = false;                field(Type; Rec.Type)                {                    ApplicationArea = Advanced;                }                field(FilteredTypeField; Rec.FormatType())                {                    ApplicationArea = Basic, Suite;                    Caption = 'Type';                    ToolTip = 'Specifies the type of transaction that was posted with the line.';                    Visible = IsFoundation;                }                field("No."; Rec."No.")                {                    ApplicationArea = Suite;                }                field("Item Reference No."; Rec."Item Reference No.")                {                    AccessByPermission = tabledata "Item Reference" = R;                    ApplicationArea = Suite, ItemReferences;                }                field("Variant Code"; Rec."Variant Code")                {                    ApplicationArea = Planning;                    Visible = false;                }                field(Description; Rec.Description)                {                    ApplicationArea = Suite;                    ToolTip = 'Specifies a description of the item or service on the line.';                }                field("Description 2"; Rec."Description 2")                {                    ApplicationArea = Suite;                    Importance = Additional;                    Visible = false;                }                field("Return Reason Code"; Rec."Return Reason Code")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Location Code"; Rec."Location Code")                {                    ApplicationArea = Location;                }                field("Bin Code"; Rec."Bin Code")                {                    ApplicationArea = Warehouse;                    Visible = false;                }                field(Quantity; Rec.Quantity)                {                    ApplicationArea = Suite;                    BlankZero = true;                    ToolTip = 'Specifies the quantity of the item or service on the line.';                }                field("Unit of Measure Code"; Rec."Unit of Measure Code")                {                    ApplicationArea = Suite;                }                field("Unit of Measure"; Rec."Unit of Measure")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Quantity Invoiced"; Rec."Quantity Invoiced")                {                    ApplicationArea = Suite;                    BlankZero = true;                }                field("Qty. Rcd. Not Invoiced"; Rec."Qty. Rcd. Not Invoiced")                {                    ApplicationArea = Suite;                    Editable = false;                    ToolTip = 'Specifies how many units of the item on the line have been received and not yet invoiced.';                    Visible = false;                }                field("Requested Receipt Date"; Rec."Requested Receipt Date")                {                    ApplicationArea = Suite;                    Visible = false;                }                field("Promised Receipt Date"; Rec."Promised Receipt Date")                {                    ApplicationArea = OrderPromising;                    Visible = false;                }                field("Planned Receipt Date"; Rec."Planned Receipt Date")                {                    ApplicationArea = Basic, Suite;                }                field("Expected Receipt Date"; Rec."Expected Receipt Date")                {                    ApplicationArea = Basic, Suite;                }                field("Order Date"; Rec."Order Date")                {                    ApplicationArea = Suite;                }                field("Lead Time Calculation"; Rec."Lead Time Calculation")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Job No."; Rec."Job No.")                {                    ApplicationArea = Jobs;                    Visible = false;                }                field("Job Task No."; Rec."Job Task No.")                {                    ApplicationArea = Jobs;                    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 = Suite;                    Visible = false;                }                field(Correction; Rec.Correction)                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Shortcut Dimension 1 Code"; Rec."Shortcut Dimension 1 Code")                {                    ApplicationArea = Dimensions;                    Visible = DimVisible1;                }                field("Shortcut Dimension 2 Code"; Rec."Shortcut Dimension 2 Code")                {                    ApplicationArea = Dimensions;                    Visible = DimVisible2;                }                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 = DimVisible3;                }                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 = DimVisible4;                }                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 = DimVisible5;                }                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 = DimVisible6;                }                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 = DimVisible7;                }                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 = DimVisible8;                }                field("Gross Weight"; Rec."Gross Weight")                {                    Caption = 'Unit Gross Weight';                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Net Weight"; Rec."Net Weight")                {                    Caption = 'Unit Net Weight';                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Unit Volume"; Rec."Unit Volume")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }                field("Units per Parcel"; Rec."Units per Parcel")                {                    ApplicationArea = Basic, Suite;                    Visible = false;                }            }        }    }    actions    {        area(processing)        {            group("F&unctions")            {                Caption = 'F&unctions';                Image = "Action";                action(OrderTracking)                {                    ApplicationArea = Basic, Suite;                    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                        ShowTracking();                    end;                }                action("&Undo Receipt")                {                    ApplicationArea = Suite;                    Caption = '&Undo Receipt';                    Image = Undo;                    ToolTip = 'Cancel the quantity posting on the selected posted receipt line. A corrective line is inserted under the selected receipt line. If the quantity was received in a warehouse receipt, then a corrective line is inserted in the posted warehouse receipt. The Quantity Received and Qty. Rcd. Not Invoiced fields on the related purchase order are set to zero.';                    trigger OnAction()                    begin                        UndoReceiptLine();                    end;                }            }            group("&Line")            {                Caption = '&Line';                Image = Line;                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(Comments)                {                    ApplicationArea = Comments;                    Caption = 'Co&mments';                    Image = ViewComments;                    ToolTip = 'View or add comments for the record.';                    trigger OnAction()                    begin                        Rec.ShowLineComments();                    end;                }                action(ItemTrackingEntries)                {                    ApplicationArea = ItemTracking;                    Caption = 'Item &Tracking Entries';                    Image = ItemTrackingLedger;                    ToolTip = 'View serial, lot or package numbers that are assigned to items.';                    trigger OnAction()                    begin                        Rec.ShowItemTrackingLines();                    end;                }                action(ItemInvoiceLines)                {                    ApplicationArea = Basic, Suite;                    Caption = 'Item Invoice &Lines';                    Image = ItemInvoice;                    ToolTip = 'View posted purchase invoice lines for the item. ';                    trigger OnAction()                    begin                        PageShowItemPurchInvLines();                    end;                }                action(DocumentLineTracking)                {                    ApplicationArea = Basic, Suite;                    Caption = 'Document &Line Tracking';                    Image = Navigate;                    ToolTip = 'View related open, posted, or archived documents or document lines.';                    trigger OnAction()                    begin                        ShowDocumentLineTracking();                    end;                }            }        }    }    trigger OnAfterGetRecord()    begin        Rec.ShowShortcutDimCode(ShortcutDimCode);    end;    trigger OnInit()    var        ApplicationAreaMgmtFacade: Codeunit "Application Area Mgmt. Facade";    begin        IsFoundation := ApplicationAreaMgmtFacade.IsFoundationEnabled();    end;    trigger OnOpenPage()    begin        SetDimensionsVisibility();    end;    var        IsFoundation: Boolean;    protected var        ShortcutDimCode: array[8] of Code[20];        DimVisible1: Boolean;        DimVisible2: Boolean;        DimVisible3: Boolean;        DimVisible4: Boolean;        DimVisible5: Boolean;        DimVisible6: Boolean;        DimVisible7: Boolean;        DimVisible8: Boolean;    local procedure ShowTracking()    var        ItemLedgEntry: Record "Item Ledger Entry";        TempItemLedgEntry: Record "Item Ledger Entry" temporary;        TrackingForm: Page "Order Tracking";    begin        Rec.TestField(Type, Rec.Type::Item);        if Rec."Item Rcpt. Entry No." <> 0 then begin            ItemLedgEntry.Get(Rec."Item Rcpt. Entry No.");            TrackingForm.SetItemLedgEntry(ItemLedgEntry);        end else            TrackingForm.SetMultipleItemLedgEntries(TempItemLedgEntry,              DATABASE::"Purch. Rcpt. Line", 0, Rec."Document No.", '', 0, Rec."Line No.");        TrackingForm.RunModal();    end;    local procedure UndoReceiptLine()    var        PurchRcptLine: Record "Purch. Rcpt. Line";    begin        PurchRcptLine.Copy(Rec);        CurrPage.SetSelectionFilter(PurchRcptLine);        CODEUNIT.Run(CODEUNIT::"Undo Purchase Receipt Line", PurchRcptLine);    end;    local procedure PageShowItemPurchInvLines()    begin        Rec.TestField(Type, Rec.Type::Item);        Rec.ShowItemPurchInvLines();    end;    procedure ShowDocumentLineTracking()    var        DocumentLineTrackingPage: Page "Document Line Tracking";    begin        Clear(DocumentLineTrackingPage);        DocumentLineTrackingPage.SetSourceDoc(            "Document Line Source Type"::"Purchase Receipt", Rec."Document No.", Rec."Line No.", Rec."Blanket Order No.", Rec."Blanket Order Line No.", Rec."Order No.", Rec."Order Line No.");        DocumentLineTrackingPage.RunModal();    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);        OnAfterSetDimensionsVisibility();    end;    [IntegrationEvent(true, false)]    local procedure OnAfterSetDimensionsVisibility()    begin    end;}