Table 5879 Pstd. Phys. Invt. Order Hdr

App
Base Application
Namespace
Microsoft.Inventory.Counting.History
Versions
17-28

Fields, 20Keys, 2Procedures, 2

Versions171819202122232425262728

Source29

Source in 29

src/Layers/W1/BaseApp/Inventory/Counting/History/PstdPhysInvtOrderHdr.Table.al208 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.Counting.History;

using Microsoft.Finance.Dimension;
using Microsoft.Finance.GeneralLedger.Setup;
using Microsoft.Foundation.AuditCodes;
using Microsoft.Foundation.Navigate;
using Microsoft.Foundation.NoSeries;
using Microsoft.HumanResources.Employee;
using Microsoft.Inventory.Counting.Comment;
using Microsoft.Inventory.Location;
using Microsoft.Warehouse.Structure;

table 5879 "Pstd. Phys. Invt. Order Hdr"
{
    Caption = 'Pstd. Phys. Invt. Order Hdr';
    DataCaptionFields = "No.", Description;
    DrillDownPageID = "Posted Phys. Invt. Order List";
    LookupPageID = "Posted Phys. Invt. Order List";
    DataClassification = CustomerContent;

    fields
    {
        field(1; "No."; Code[20])
        {
            Caption = 'No.';
            ToolTip = 'Specifies the No. of the table physical inventory order header.';
        }
        field(10; Description; Text[100])
        {
            Caption = 'Description';
            ToolTip = 'Specifies the Description of the table physical inventory order header.';
        }
        field(11; Status; Option)
        {
            Caption = 'Status';
            OptionCaption = 'Open,Finished';
            OptionMembers = Open,Finished;
        }
        field(20; "Order Date"; Date)
        {
            Caption = 'Order Date';
            ToolTip = 'Specifies the Order Date of the table physical inventory order header.';
        }
        field(21; "Posting Date"; Date)
        {
            Caption = 'Posting Date';
            ToolTip = 'Specifies the Posting Date of the table physical inventory order header.';
        }
        field(30; Comment; Boolean)
        {
            CalcFormula = exist("Phys. Invt. Comment Line" where("Document Type" = const("Posted Order"),
                                                                  "Order No." = field("No."),
                                                                  "Recording No." = const(0)));
            Caption = 'Comment';
            Editable = false;
            FieldClass = FlowField;
        }
        field(31; "Person Responsible"; Code[20])
        {
            Caption = 'Person Responsible';
            ToolTip = 'Specifies the Person Responsible of the table physical inventory order header.';
            TableRelation = Employee;
            ValidateTableRelation = false;
        }
        field(40; "Reason Code"; Code[10])
        {
            Caption = 'Reason Code';
            TableRelation = "Reason Code";
        }
        field(41; "Gen. Bus. Posting Group"; Code[20])
        {
            Caption = 'Gen. Bus. Posting Group';
            TableRelation = "Gen. Business Posting Group";
        }
        field(50; "Shortcut Dimension 1 Code"; Code[20])
        {
            CaptionClass = '1,2,1';
            Caption = 'Shortcut Dimension 1 Code';
            ToolTip = 'Specifies the code for Shortcut Dimension 1, which is one of two global dimension codes that you set up in the General Ledger Setup window.';
            TableRelation = "Dimension Value".Code where("Global Dimension No." = const(1));
        }
        field(51; "Shortcut Dimension 2 Code"; Code[20])
        {
            CaptionClass = '1,2,2';
            Caption = 'Shortcut Dimension 2 Code';
            ToolTip = 'Specifies the code for Shortcut Dimension 2, which is one of two global dimension codes that you set up in the General Ledger Setup window.';
            TableRelation = "Dimension Value".Code where("Global Dimension No." = const(2));
        }
        field(60; "Pre-Assigned No. Series"; Code[20])
        {
            Caption = 'Pre-Assigned No. Series';
            Editable = false;
            TableRelation = "No. Series";
        }
        field(61; "No. Series"; Code[20])
        {
            Caption = 'No. Series';
            TableRelation = "No. Series";
        }
        field(62; "Pre-Assigned No."; Code[20])
        {
            Caption = 'Pre-Assigned No.';
            ToolTip = 'Specifies the number of the physical inventory header, from which the posted physical inventory order was posted.';
        }
        field(63; "User ID"; Code[50])
        {
            Caption = 'User ID';
            DataClassification = EndUserIdentifiableInformation;
        }
        field(66; "Source Code"; Code[10])
        {
            Caption = 'Source Code';
            TableRelation = "Source Code";
        }
        field(71; "No. Finished Recordings"; Integer)
        {
            CalcFormula = count("Pstd. Phys. Invt. Record Hdr" where("Order No." = field("No."),
                                                                   Status = const(Finished)));
            Caption = 'No. Finished Recordings';
            ToolTip = 'Specifies the No. Finished Recordings.';
            Editable = false;
            FieldClass = FlowField;
        }
        field(110; "Location Code"; Code[10])
        {
            Caption = 'Location Code';
            ToolTip = 'Specifies the Location Code of the table physical inventory order header.';
            TableRelation = Location;
        }
        field(111; "Bin Code"; Code[20])
        {
            Caption = 'Bin Code';
            TableRelation = Bin.Code where("Location Code" = field("Location Code"));
        }
        field(480; "Dimension Set ID"; Integer)
        {
            Caption = 'Dimension Set ID';
            Editable = false;
            TableRelation = "Dimension Set Entry";

            trigger OnLookup()
            begin
                Rec.ShowDimensions();
            end;
        }
    }

    keys
    {
        key(Key1; "No.")
        {
            Clustered = true;
        }
        key(Key2; "Posting Date")
        {
        }
    }

    fieldgroups
    {
    }

    trigger OnDelete()
    var
        PstdPhysInvtOrderLine: Record "Pstd. Phys. Invt. Order Line";
        PhysInvtCommentLine: Record "Phys. Invt. Comment Line";
        PstdPhysInvtRecordHdr: Record "Pstd. Phys. Invt. Record Hdr";
    begin
        LockTable();

        PstdPhysInvtOrderLine.Reset();
        PstdPhysInvtOrderLine.SetRange("Document No.", "No.");
        PstdPhysInvtOrderLine.DeleteAll(true);

        PhysInvtCommentLine.Reset();
        PhysInvtCommentLine.SetRange("Document Type", PhysInvtCommentLine."Document Type"::"Posted Order");
        PhysInvtCommentLine.SetRange("Order No.", "No.");
        PhysInvtCommentLine.SetRange("Recording No.", 0);
        PhysInvtCommentLine.DeleteAll();

        PstdPhysInvtRecordHdr.Reset();
        PstdPhysInvtRecordHdr.SetRange("Order No.", "No.");
        PstdPhysInvtRecordHdr.DeleteAll(true);
    end;

    var
        DimManagement: Codeunit DimensionManagement;

    procedure Navigate()
    var
        NavigatePage: Page Navigate;
    begin
        NavigatePage.SetDoc("Posting Date", "No.");
        NavigatePage.SetRec(Rec);
        NavigatePage.Run();
    end;

    procedure ShowDimensions()
    begin
        DimManagement.ShowDimensionSet("Dimension Set ID", StrSubstNo('%1 %2', TableCaption(), "No."));
    end;
}