Table 7132 Item Budget Name

App
Base Application
Namespace
Microsoft.Inventory.Analysis
Versions
17-28

Fields, 7Keys, 1

Versions171819202122232425262728

Source29

Source in 29

src/Layers/W1/BaseApp/Inventory/Analysis/ItemBudgetName.Table.al121 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.Analysis;

using Microsoft.Finance.Dimension;

table 7132 "Item Budget Name"
{
    Caption = 'Item Budget Name';
    LookupPageID = "Item Budget Names";
    DataClassification = CustomerContent;

    fields
    {
        field(1; "Analysis Area"; Enum "Analysis Area Type")
        {
            Caption = 'Analysis Area';
        }
        field(2; Name; Code[10])
        {
            Caption = 'Name';
            ToolTip = 'Specifies the name of the item budget.';
            NotBlank = true;
        }
        field(3; Description; Text[80])
        {
            Caption = 'Description';
            ToolTip = 'Specifies a description of the item budget.';
        }
        field(4; Blocked; Boolean)
        {
            Caption = 'Blocked';
            ToolTip = 'Specifies that the related record is blocked from being posted in transactions, for example a customer that is declared insolvent or an item that is placed in quarantine.';
        }
        field(5; "Budget Dimension 1 Code"; Code[20])
        {
            Caption = 'Budget Dimension 1 Code';
            ToolTip = 'Specifies a dimension code for Item Budget Dimension 1.';
            TableRelation = Dimension;

            trigger OnValidate()
            begin
                if "Budget Dimension 1 Code" <> xRec."Budget Dimension 1 Code" then begin
                    if Dim.CheckIfDimUsed("Budget Dimension 1 Code", Enum::"Dim Type Checked".FromInteger(17), Name, '', "Analysis Area".AsInteger()) then
                        Error(Text000, Dim.GetCheckDimErr());
                    Modify();
                end;
            end;
        }
        field(6; "Budget Dimension 2 Code"; Code[20])
        {
            Caption = 'Budget Dimension 2 Code';
            ToolTip = 'Specifies a dimension code for Item Budget Dimension 2.';
            TableRelation = Dimension;

            trigger OnValidate()
            begin
                if "Budget Dimension 2 Code" <> xRec."Budget Dimension 2 Code" then begin
                    if Dim.CheckIfDimUsed("Budget Dimension 2 Code", Enum::"Dim Type Checked".FromInteger(18), Name, '', "Analysis Area".AsInteger()) then
                        Error(Text000, Dim.GetCheckDimErr());
                    Modify();
                end;
            end;
        }
        field(7; "Budget Dimension 3 Code"; Code[20])
        {
            Caption = 'Budget Dimension 3 Code';
            ToolTip = 'Specifies a dimension code for Item Budget Dimension 3.';
            TableRelation = Dimension;

            trigger OnValidate()
            begin
                if "Budget Dimension 3 Code" <> xRec."Budget Dimension 3 Code" then begin
                    if Dim.CheckIfDimUsed("Budget Dimension 3 Code", Enum::"Dim Type Checked".FromInteger(19), Name, '', "Analysis Area".AsInteger()) then
                        Error(Text000, Dim.GetCheckDimErr());
                    Modify();
                end;
            end;
        }
    }

    keys
    {
        key(Key1; "Analysis Area", Name)
        {
            Clustered = true;
        }
    }

    fieldgroups
    {
    }

    trigger OnDelete()
    var
        ItemBudgetEntry: Record "Item Budget Entry";
        ItemAnalysisViewBudgetEntry: Record "Item Analysis View Budg. Entry";
    begin
        ItemBudgetEntry.SetCurrentKey("Analysis Area", "Budget Name");
        ItemBudgetEntry.SetRange("Analysis Area", "Analysis Area");
        ItemBudgetEntry.SetRange("Budget Name", Name);
        ItemBudgetEntry.DeleteAll(true);

        ItemAnalysisViewBudgetEntry.SetRange("Analysis Area", "Analysis Area");
        ItemAnalysisViewBudgetEntry.SetRange("Budget Name", Name);
        ItemAnalysisViewBudgetEntry.DeleteAll();
    end;

    var
        Dim: Record Dimension;

#pragma warning disable AA0074
#pragma warning disable AA0470
        Text000: Label '%1\You cannot use the same dimension twice in the same budget.';
#pragma warning restore AA0470
#pragma warning restore AA0074
}