Page 1110 Cost Type Balance
src/Layers/W1/BaseApp/CostAccounting/Account/CostTypeBalance.Page.al221 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.CostAccounting.Account;using Microsoft.Finance.Analysis;using Microsoft.Foundation.Enums;using System.Utilities;page 1110 "Cost Type Balance"{ Caption = 'Cost Type Balance'; DeleteAllowed = false; InsertAllowed = false; LinksAllowed = false; PageType = ListPlus; SourceTable = "Cost Type"; layout { area(content) { group(General) { Caption = 'General'; field(CostCenterFilter; CostCenterFilter) { ApplicationArea = CostAccounting; Caption = 'Cost Center Filter'; TableRelation = "Cost Center"; ToolTip = 'Specifies a cost center for which you want to view budget amounts.'; trigger OnValidate() begin UpdateMatrixSubform(); end; } field(CostObjectFilter; CostObjectFilter) { ApplicationArea = CostAccounting; Caption = 'Cost Object Filter'; TableRelation = "Cost Object"; ToolTip = 'Specifies a cost object for which you want to view budget amounts.'; trigger OnValidate() begin UpdateMatrixSubform(); end; } field(PeriodType; PeriodType) { ApplicationArea = CostAccounting; Caption = 'View by'; ToolTip = 'Specifies by which period amounts are displayed.'; trigger OnValidate() begin SetMatrixColumns("Matrix Page Step Type"::Initial); UpdateMatrixSubform(); end; } field(AmountType; AmountType) { ApplicationArea = CostAccounting; Caption = 'View as'; ToolTip = 'Specifies how amounts are displayed. Net Change: The net change in the balance for the selected period. Balance at Date: The balance as of the last day in the selected period.'; trigger OnValidate() begin UpdateMatrixSubform(); end; } field(RoundingFactor; RoundingFactor) { ApplicationArea = CostAccounting; Caption = 'Rounding Factor'; ToolTip = 'Specifies the factor that is used to round the amounts.'; trigger OnValidate() begin UpdateMatrixSubform(); end; } } part(MatrixForm; "Cost Type Balance Matrix") { ApplicationArea = CostAccounting; } } } actions { area(processing) { action(PreviousSet) { ApplicationArea = CostAccounting; Caption = 'Previous Set'; Image = PreviousSet; ToolTip = 'Go to the previous set of data.'; trigger OnAction() begin GenerateColumnCaptions("Matrix Page Step Type"::Previous); UpdateMatrixSubform(); end; } action(PreviousColumn) { ApplicationArea = CostAccounting; Caption = 'Previous Column'; Image = PreviousRecord; ToolTip = 'Go to the previous column.'; trigger OnAction() begin GenerateColumnCaptions("Matrix Page Step Type"::PreviousColumn); UpdateMatrixSubform(); end; } action(NextColumn) { ApplicationArea = CostAccounting; Caption = 'Next Column'; Image = NextRecord; ToolTip = 'Go to the next column.'; trigger OnAction() begin GenerateColumnCaptions("Matrix Page Step Type"::NextColumn); UpdateMatrixSubform(); end; } action(NextSet) { ApplicationArea = CostAccounting; Caption = 'Next Set'; Image = NextSet; ToolTip = 'Go to the next set of data.'; trigger OnAction() begin GenerateColumnCaptions("Matrix Page Step Type"::Next); UpdateMatrixSubform(); end; } } area(Promoted) { group(Category_Process) { Caption = 'Process'; actionref(PreviousSet_Promoted; PreviousSet) { } actionref(PreviousColumn_Promoted; PreviousColumn) { } actionref(NextColumn_Promoted; NextColumn) { } actionref(NextSet_Promoted; NextSet) { } } } } trigger OnOpenPage() begin SetMatrixColumns("Matrix Page Step Type"::Initial); CostCenterFilter := Rec.GetFilter("Cost Center Filter"); CostObjectFilter := Rec.GetFilter("Cost Object Filter"); GenerateColumnCaptions("Matrix Page Step Type"::Initial); UpdateMatrixSubform(); end; var MatrixRecords: array[32] of Record Date; CostCenterFilter: Text; CostObjectFilter: Text; MatrixColumnCaptions: array[32] of Text[80]; ColumnSet: Text[80]; PKFirstRecInCurrSet: Text[80]; PeriodType: Enum "Analysis Period Type"; AmountType: Enum "Analysis Amount Type"; RoundingFactor: Enum "Analysis Rounding Factor"; CurrSetLength: Integer; procedure SetMatrixColumns(StepType: Enum "Matrix Page Step Type") var MatrixMgt: Codeunit "Matrix Management"; begin MatrixMgt.GeneratePeriodMatrixData(StepType.AsInteger(), 12, false, PeriodType, '', PKFirstRecInCurrSet, MatrixColumnCaptions, ColumnSet, CurrSetLength, MatrixRecords); end; local procedure UpdateMatrixSubform() begin CurrPage.MatrixForm.PAGE.LoadMatrix( MatrixColumnCaptions, MatrixRecords, CurrSetLength, CostCenterFilter, CostObjectFilter, RoundingFactor, AmountType); end; local procedure GenerateColumnCaptions(StepType: Enum "Matrix Page Step Type") var MatrixMgt: Codeunit "Matrix Management"; begin Clear(MatrixColumnCaptions); CurrSetLength := 12; MatrixMgt.GeneratePeriodMatrixData( StepType.AsInteger(), CurrSetLength, false, PeriodType, '', PKFirstRecInCurrSet, MatrixColumnCaptions, ColumnSet, CurrSetLength, MatrixRecords); end;}