Page 120 G/L Budget Entries
- App
- Base Application
- Namespace
- Microsoft.Finance.GeneralLedger.Budget
- Versions
- 17-28
- Source table
- 96
Versions171819202122232425262728
Source29
Source in 29
src/Layers/W1/BaseApp/Finance/GeneralLedger/Budget/GLBudgetEntries.Page.al362 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.Finance.GeneralLedger.Budget;
using Microsoft.Finance.Analysis;
using Microsoft.Finance.Consolidation;
using Microsoft.Finance.Dimension;
using Microsoft.Finance.GeneralLedger.Account;
using Microsoft.Finance.GeneralLedger.Setup;
using System.Utilities;
/// <summary>
/// List page for viewing and editing individual G/L budget entries with full dimensional analysis capabilities.
/// Primary data entry interface for budget amounts with validation, dimension support, and drill-down functionality.
/// </summary>
/// <remarks>
/// Key features: Budget entry CRUD operations, dimensional filtering, amount validation, and analysis navigation.
/// Integration: Links to G/L Account analysis, dimension management, and budget reporting workflows.
/// Performance: Optimized for large datasets with filtered views and indexed access patterns.
/// </remarks>
page 120 "G/L Budget Entries"
{
AdditionalSearchTerms = 'general ledger budget entries';
ApplicationArea = Suite;
Caption = 'G/L Budget Entries';
DataCaptionFields = "G/L Account No.", "Budget Name";
DelayedInsert = true;
PageType = List;
AboutTitle = 'About G/L Budget Entries';
AboutText = 'Enter and manage budgeted amounts for specific general ledger accounts, periods, and dimensions within a selected G/L budget to support financial planning and analysis.';
SourceTable = "G/L Budget Entry";
UsageCategory = History;
layout
{
area(content)
{
repeater(Control1)
{
ShowCaption = false;
field("Budget Name"; Rec."Budget Name")
{
ApplicationArea = Suite;
Editable = false;
}
field(Date; Rec.Date)
{
ApplicationArea = Suite;
}
field("G/L Account No."; Rec."G/L Account No.")
{
ApplicationArea = Suite;
}
field(Description; Rec.Description)
{
ApplicationArea = Suite;
}
field("Global Dimension 1 Code"; Rec."Global Dimension 1 Code")
{
ApplicationArea = Dimensions;
Enabled = GlobalDimension1CodeEnable;
Visible = GlobalDimension1CodeVisible;
}
field("Global Dimension 2 Code"; Rec."Global Dimension 2 Code")
{
ApplicationArea = Dimensions;
Enabled = GlobalDimension2CodeEnable;
Visible = GlobalDimension2CodeVisible;
}
field("Budget Dimension 1 Code"; Rec."Budget Dimension 1 Code")
{
ApplicationArea = Dimensions;
Enabled = BudgetDimension1CodeEnable;
Visible = BudgetDimension1CodeVisible;
}
field("Budget Dimension 2 Code"; Rec."Budget Dimension 2 Code")
{
ApplicationArea = Dimensions;
Enabled = BudgetDimension2CodeEnable;
Visible = BudgetDimension2CodeVisible;
}
field("Budget Dimension 3 Code"; Rec."Budget Dimension 3 Code")
{
ApplicationArea = Dimensions;
Enabled = BudgetDimension3CodeEnable;
Visible = BudgetDimension3CodeVisible;
}
field("Budget Dimension 4 Code"; Rec."Budget Dimension 4 Code")
{
ApplicationArea = Dimensions;
Enabled = BudgetDimension4CodeEnable;
Visible = BudgetDimension4CodeVisible;
}
field("Business Unit Code"; Rec."Business Unit Code")
{
ApplicationArea = Suite;
Visible = false;
}
field(Amount; Rec.Amount)
{
ApplicationArea = Suite;
}
field("Entry No."; Rec."Entry No.")
{
ApplicationArea = Suite;
Editable = false;
}
field("Dimension Set ID"; Rec."Dimension Set ID")
{
ApplicationArea = Dimensions;
Visible = false;
}
}
}
area(factboxes)
{
systempart(Control1900383207; Links)
{
ApplicationArea = RecordLinks;
Visible = false;
}
systempart(Control1905767507; Notes)
{
ApplicationArea = Notes;
Visible = false;
}
}
}
actions
{
area(navigation)
{
group("Ent&ry")
{
Caption = 'Ent&ry';
Image = Entry;
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();
CurrPage.SaveRecord();
end;
}
action(SetDimensionFilter)
{
ApplicationArea = Dimensions;
Caption = 'Set Dimension Filter';
Ellipsis = true;
Image = "Filter";
ToolTip = 'Limit the entries according to the dimension filters that you specify. NOTE: If you use a high number of dimension combinations, this function may not work and can result in a message that the SQL server only supports a maximum of 2100 parameters.';
trigger OnAction()
begin
Rec.SetFilter("Dimension Set ID", DimensionSetIDFilter.LookupFilter());
end;
}
}
}
area(Promoted)
{
group(Category_Process)
{
Caption = 'Process';
actionref(Dimensions_Promoted; Dimensions)
{
}
actionref(SetDimensionFilter_Promoted; SetDimensionFilter)
{
}
}
}
}
trigger OnDeleteRecord(): Boolean
var
GLBudgetEntry: Record "G/L Budget Entry";
begin
if Rec."Entry No." < LowestModifiedEntryNo then begin
CurrPage.SetSelectionFilter(GLBudgetEntry);
GLBudgetEntry.SetCurrentKey("Entry No.");
GLBudgetEntry.Ascending(true);
GLBudgetEntry.FindFirst();
LowestModifiedEntryNo := GLBudgetEntry."Entry No.";
UpdateAnalysisView.SetLastBudgetEntryNo(LowestModifiedEntryNo - 1);
end;
exit(true);
end;
trigger OnInit()
begin
BudgetDimension4CodeEnable := true;
BudgetDimension3CodeEnable := true;
BudgetDimension2CodeEnable := true;
BudgetDimension1CodeEnable := true;
GlobalDimension2CodeEnable := true;
GlobalDimension1CodeEnable := true;
BudgetDimension4CodeVisible := true;
BudgetDimension3CodeVisible := true;
BudgetDimension2CodeVisible := true;
BudgetDimension1CodeVisible := true;
GlobalDimension2CodeVisible := true;
GlobalDimension1CodeVisible := true;
LowestModifiedEntryNo := 2147483647;
end;
trigger OnModifyRecord(): Boolean
begin
if Rec."Entry No." < LowestModifiedEntryNo then begin
LowestModifiedEntryNo := Rec."Entry No.";
UpdateAnalysisView.SetLastBudgetEntryNo(LowestModifiedEntryNo - 1);
end;
exit(true);
end;
trigger OnNewRecord(BelowxRec: Boolean)
begin
if Rec.GetFilter("Budget Name") <> '' then
Rec."Budget Name" := Rec.GetRangeMin("Budget Name");
if GLBudgetName.Name <> Rec."Budget Name" then
GLBudgetName.Get(Rec."Budget Name");
if Rec.GetFilter("G/L Account No.") <> '' then
Rec."G/L Account No." := GetFirstGLAcc(Rec.GetFilter("G/L Account No."));
Rec.Date := GetFirstDate(Rec.GetFilter(Date));
Rec."User ID" := CopyStr(UserId(), 1, MaxStrLen(Rec."User ID"));
if Rec.GetFilter("Global Dimension 1 Code") <> '' then
Rec."Global Dimension 1 Code" :=
GetFirstDimValue(GLSetup."Global Dimension 1 Code", Rec.GetFilter("Global Dimension 1 Code"));
if Rec.GetFilter("Global Dimension 2 Code") <> '' then
Rec."Global Dimension 2 Code" :=
GetFirstDimValue(GLSetup."Global Dimension 2 Code", Rec.GetFilter("Global Dimension 2 Code"));
if Rec.GetFilter("Budget Dimension 1 Code") <> '' then
Rec."Budget Dimension 1 Code" :=
GetFirstDimValue(GLBudgetName."Budget Dimension 1 Code", Rec.GetFilter("Budget Dimension 1 Code"));
if Rec.GetFilter("Budget Dimension 2 Code") <> '' then
Rec."Budget Dimension 2 Code" :=
GetFirstDimValue(GLBudgetName."Budget Dimension 2 Code", Rec.GetFilter("Budget Dimension 2 Code"));
if Rec.GetFilter("Budget Dimension 3 Code") <> '' then
Rec."Budget Dimension 3 Code" :=
GetFirstDimValue(GLBudgetName."Budget Dimension 3 Code", Rec.GetFilter("Budget Dimension 3 Code"));
if Rec.GetFilter("Budget Dimension 4 Code") <> '' then
Rec."Budget Dimension 4 Code" :=
GetFirstDimValue(GLBudgetName."Budget Dimension 4 Code", Rec.GetFilter("Budget Dimension 4 Code"));
if Rec.GetFilter("Business Unit Code") <> '' then
Rec."Business Unit Code" := GetFirstBusUnit(Rec.GetFilter("Business Unit Code"));
end;
trigger OnOpenPage()
var
GLBudgetName: Record "G/L Budget Name";
begin
if Rec.GetFilter("Budget Name") = '' then
GLBudgetName.Init()
else begin
Rec.CopyFilter("Budget Name", GLBudgetName.Name);
GLBudgetName.FindFirst();
end;
CurrPage.Editable := not GLBudgetName.Blocked;
GLSetup.Get();
GlobalDimension1CodeEnable := GLSetup."Global Dimension 1 Code" <> '';
GlobalDimension2CodeEnable := GLSetup."Global Dimension 2 Code" <> '';
BudgetDimension1CodeEnable := GLBudgetName."Budget Dimension 1 Code" <> '';
BudgetDimension2CodeEnable := GLBudgetName."Budget Dimension 2 Code" <> '';
BudgetDimension3CodeEnable := GLBudgetName."Budget Dimension 3 Code" <> '';
BudgetDimension4CodeEnable := GLBudgetName."Budget Dimension 4 Code" <> '';
GlobalDimension1CodeVisible := GLSetup."Global Dimension 1 Code" <> '';
GlobalDimension2CodeVisible := GLSetup."Global Dimension 2 Code" <> '';
BudgetDimension1CodeVisible := GLBudgetName."Budget Dimension 1 Code" <> '';
BudgetDimension2CodeVisible := GLBudgetName."Budget Dimension 2 Code" <> '';
BudgetDimension3CodeVisible := GLBudgetName."Budget Dimension 3 Code" <> '';
BudgetDimension4CodeVisible := GLBudgetName."Budget Dimension 4 Code" <> '';
end;
var
GLSetup: Record "General Ledger Setup";
GLBudgetName: Record "G/L Budget Name";
UpdateAnalysisView: Codeunit "Update Analysis View";
DimensionSetIDFilter: Page "Dimension Set ID Filter";
LowestModifiedEntryNo: Integer;
GlobalDimension1CodeVisible: Boolean;
GlobalDimension2CodeVisible: Boolean;
BudgetDimension1CodeVisible: Boolean;
BudgetDimension2CodeVisible: Boolean;
BudgetDimension3CodeVisible: Boolean;
BudgetDimension4CodeVisible: Boolean;
GlobalDimension1CodeEnable: Boolean;
GlobalDimension2CodeEnable: Boolean;
BudgetDimension1CodeEnable: Boolean;
BudgetDimension2CodeEnable: Boolean;
BudgetDimension3CodeEnable: Boolean;
BudgetDimension4CodeEnable: Boolean;
local procedure GetFirstGLAcc(GLAccFilter: Text[250]): Code[20]
var
GLAcc: Record "G/L Account";
begin
GLAcc.SetFilter("No.", GLAccFilter);
if GLAcc.FindFirst() then
exit(GLAcc."No.");
exit('');
end;
local procedure GetFirstDate(DateFilter: Text[250]): Date
var
Period: Record Date;
begin
if DateFilter = '' then
exit(0D);
Period.SetRange("Period Type", Period."Period Type"::Date);
Period.SetFilter("Period Start", DateFilter);
if Period.FindFirst() then
exit(Period."Period Start");
exit(0D);
end;
local procedure GetFirstDimValue(DimCode: Code[20]; DimValFilter: Text[250]): Code[20]
var
DimVal: Record "Dimension Value";
begin
if (DimCode = '') or (DimValFilter = '') then
exit('');
DimVal.SetRange("Dimension Code", DimCode);
DimVal.SetFilter(Code, DimValFilter);
if DimVal.FindFirst() then
exit(DimVal.Code);
exit('');
end;
local procedure GetFirstBusUnit(BusUnitFilter: Text[250]): Code[20]
var
BusUnit: Record "Business Unit";
begin
BusUnit.SetFilter(Code, BusUnitFilter);
if BusUnit.FindFirst() then
exit(BusUnit.Code);
exit('');
end;
}