Page 9237 Resource Capacity Matrix, source in 29
Source29
src/Layers/W1/BaseApp/Projects/Resources/Analysis/ResourceCapacityMatrix.Page.al483 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.Projects.Resources.Analysis;
using Microsoft.Finance.Dimension;
using Microsoft.Foundation.Comment;
using Microsoft.Foundation.Enums;
using Microsoft.Pricing.Calculation;
using Microsoft.Pricing.PriceList;
using Microsoft.Projects.Resources.Ledger;
using Microsoft.Projects.Resources.Pricing;
using Microsoft.Projects.Resources.Resource;
using System.Utilities;
page 9237 "Resource Capacity Matrix"
{
Caption = 'Resource Capacity Matrix';
Editable = true;
LinksAllowed = false;
PageType = ListPart;
SourceTable = Resource;
layout
{
area(content)
{
repeater(Control1)
{
ShowCaption = false;
field("No."; Rec."No.")
{
ApplicationArea = Jobs;
}
field(Name; Rec.Name)
{
ApplicationArea = Jobs;
}
field(Field1; MATRIX_CellData[1])
{
AutoFormatType = 0;
ApplicationArea = Jobs;
CaptionClass = '3,' + MATRIX_ColumnCaption[1];
trigger OnDrillDown()
begin
MatrixOnDrillDown(1)
end;
trigger OnValidate()
begin
ValidateCapacity(1);
end;
}
field(Field2; MATRIX_CellData[2])
{
AutoFormatType = 0;
ApplicationArea = Jobs;
CaptionClass = '3,' + MATRIX_ColumnCaption[2];
trigger OnDrillDown()
begin
MatrixOnDrillDown(2)
end;
trigger OnValidate()
begin
ValidateCapacity(2);
end;
}
field(Field3; MATRIX_CellData[3])
{
AutoFormatType = 0;
ApplicationArea = Jobs;
CaptionClass = '3,' + MATRIX_ColumnCaption[3];
trigger OnDrillDown()
begin
MatrixOnDrillDown(3)
end;
trigger OnValidate()
begin
ValidateCapacity(3);
end;
}
field(Field4; MATRIX_CellData[4])
{
AutoFormatType = 0;
ApplicationArea = Jobs;
CaptionClass = '3,' + MATRIX_ColumnCaption[4];
trigger OnDrillDown()
begin
MatrixOnDrillDown(4)
end;
trigger OnValidate()
begin
ValidateCapacity(4);
end;
}
field(Field5; MATRIX_CellData[5])
{
AutoFormatType = 0;
ApplicationArea = Jobs;
CaptionClass = '3,' + MATRIX_ColumnCaption[5];
trigger OnDrillDown()
begin
MatrixOnDrillDown(5)
end;
trigger OnValidate()
begin
ValidateCapacity(5);
end;
}
field(Field6; MATRIX_CellData[6])
{
AutoFormatType = 0;
ApplicationArea = Jobs;
CaptionClass = '3,' + MATRIX_ColumnCaption[6];
trigger OnDrillDown()
begin
MatrixOnDrillDown(6)
end;
trigger OnValidate()
begin
ValidateCapacity(6);
end;
}
field(Field7; MATRIX_CellData[7])
{
AutoFormatType = 0;
ApplicationArea = Jobs;
CaptionClass = '3,' + MATRIX_ColumnCaption[7];
trigger OnDrillDown()
begin
MatrixOnDrillDown(7)
end;
trigger OnValidate()
begin
ValidateCapacity(7);
end;
}
field(Field8; MATRIX_CellData[8])
{
AutoFormatType = 0;
ApplicationArea = Jobs;
CaptionClass = '3,' + MATRIX_ColumnCaption[8];
trigger OnDrillDown()
begin
MatrixOnDrillDown(8)
end;
trigger OnValidate()
begin
ValidateCapacity(8);
end;
}
field(Field9; MATRIX_CellData[9])
{
AutoFormatType = 0;
ApplicationArea = Jobs;
CaptionClass = '3,' + MATRIX_ColumnCaption[9];
trigger OnDrillDown()
begin
MatrixOnDrillDown(9)
end;
trigger OnValidate()
begin
ValidateCapacity(9);
end;
}
field(Field10; MATRIX_CellData[10])
{
AutoFormatType = 0;
ApplicationArea = Jobs;
CaptionClass = '3,' + MATRIX_ColumnCaption[10];
trigger OnDrillDown()
begin
MatrixOnDrillDown(10)
end;
trigger OnValidate()
begin
ValidateCapacity(10);
end;
}
field(Field11; MATRIX_CellData[11])
{
AutoFormatType = 0;
ApplicationArea = Jobs;
CaptionClass = '3,' + MATRIX_ColumnCaption[11];
trigger OnDrillDown()
begin
MatrixOnDrillDown(11)
end;
trigger OnValidate()
begin
ValidateCapacity(11);
end;
}
field(Field12; MATRIX_CellData[12])
{
AutoFormatType = 0;
ApplicationArea = Jobs;
CaptionClass = '3,' + MATRIX_ColumnCaption[12];
trigger OnDrillDown()
begin
MatrixOnDrillDown(12)
end;
trigger OnValidate()
begin
ValidateCapacity(12);
end;
}
}
}
}
actions
{
area(processing)
{
group("&Resource")
{
Caption = '&Resource';
Image = Resource;
action(Card)
{
ApplicationArea = Jobs;
Caption = 'Card';
Image = EditLines;
RunObject = Page "Resource Card";
RunPageLink = "No." = field("No."),
"Date Filter" = field("Date Filter"),
"Unit of Measure Filter" = field("Unit of Measure Filter"),
"Chargeable Filter" = field("Chargeable Filter");
ShortCutKey = 'Shift+F7';
ToolTip = 'View or change detailed information about the record on the document or journal line.';
}
action(Statistics)
{
ApplicationArea = Jobs;
Caption = 'Statistics';
Image = Statistics;
RunObject = Page "Resource Statistics";
RunPageLink = "No." = field("No."),
"Date Filter" = field("Date Filter"),
"Unit of Measure Filter" = field("Unit of Measure Filter"),
"Chargeable Filter" = field("Chargeable Filter");
ShortCutKey = 'F7';
ToolTip = 'View statistical information, such as the value of posted entries, for the record.';
}
action("Co&mments")
{
ApplicationArea = Comments;
Caption = 'Co&mments';
Image = ViewComments;
RunObject = Page "Comment Sheet";
RunPageLink = "Table Name" = const(Resource),
"No." = field("No.");
ToolTip = 'View or add comments for the record.';
}
action(Dimensions)
{
ApplicationArea = Dimensions;
Caption = 'Dimensions';
Image = Dimensions;
RunObject = Page "Default Dimensions";
RunPageLink = "Table ID" = const(156),
"No." = field("No.");
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.';
}
action("Ledger E&ntries")
{
ApplicationArea = Jobs;
Caption = 'Ledger E&ntries';
Image = CustomerLedger;
RunObject = Page "Resource Ledger Entries";
RunPageLink = "Resource No." = field("No.");
RunPageView = sorting("Resource No.");
ShortCutKey = 'Ctrl+F7';
ToolTip = 'View the history of transactions that have been posted for the selected record.';
}
}
group("&Prices")
{
Caption = '&Prices';
Image = Price;
action(Costs)
{
ApplicationArea = Jobs;
Caption = 'Costs';
Image = ResourceCosts;
Visible = not ExtendedPriceEnabled;
RunObject = Page "Resource Costs";
RunPageLink = Type = const(Resource),
Code = field("No.");
ToolTip = 'View or change detailed information about costs for the resource.';
}
action(Prices)
{
ApplicationArea = Jobs;
Caption = 'Prices';
Image = Price;
Visible = not ExtendedPriceEnabled;
RunObject = Page "Resource Prices";
RunPageLink = Type = const(Resource),
Code = field("No.");
ToolTip = 'View or edit prices for the resource.';
}
action(PurchPriceLists)
{
ApplicationArea = Jobs;
Caption = 'Purchase Prices';
Image = ResourceCosts;
Visible = ExtendedPriceEnabled;
ToolTip = 'View or change detailed information about costs for the resource group.';
trigger OnAction()
var
AmountType: Enum "Price Amount Type";
PriceType: Enum "Price Type";
begin
Rec.ShowPriceListLines(PriceType::Purchase, AmountType::Any);
end;
}
action(SalesPriceLists)
{
ApplicationArea = Jobs;
Caption = 'Sales Prices';
Image = Price;
Visible = ExtendedPriceEnabled;
ToolTip = 'View or edit prices for the resource group.';
trigger OnAction()
var
AmountType: Enum "Price Amount Type";
PriceType: Enum "Price Type";
begin
Rec.ShowPriceListLines(PriceType::Sale, AmountType::Any);
end;
}
}
group("Plan&ning")
{
Caption = 'Plan&ning';
Image = Planning;
action("Resource A&vailability")
{
ApplicationArea = Jobs;
Caption = 'Resource A&vailability';
Image = Calendar;
RunObject = Page "Resource Availability";
RunPageLink = "No." = field("No."),
"Unit of Measure Filter" = field("Unit of Measure Filter"),
"Chargeable Filter" = field("Chargeable Filter");
ToolTip = 'View a summary of resource capacities, the quantity of resource hours allocated to projects on order, the quantity allocated to service orders, the capacity assigned to projects on quote, and the resource availability.';
}
}
}
}
trigger OnAfterGetRecord()
var
MATRIX_CurrentColumnOrdinal: Integer;
begin
MATRIX_CurrentColumnOrdinal := 0;
while MATRIX_CurrentColumnOrdinal < MATRIX_NoOfMatrixColumns do begin
MATRIX_CurrentColumnOrdinal := MATRIX_CurrentColumnOrdinal + 1;
MATRIX_OnAfterGetRecord(MATRIX_CurrentColumnOrdinal);
end;
end;
trigger OnOpenPage()
var
PriceCalculationMgt: Codeunit "Price Calculation Mgt.";
begin
ExtendedPriceEnabled := PriceCalculationMgt.IsExtendedPriceCalculationEnabled();
end;
var
MatrixRecords: array[32] of Record Date;
QtyType: Enum "Analysis Amount Type";
MATRIX_NoOfMatrixColumns: Integer;
MATRIX_CellData: array[32] of Decimal;
MATRIX_ColumnCaption: array[32] of Text[1024];
ExtendedPriceEnabled: Boolean;
local procedure SetDateFilter(ColumnID: Integer)
begin
if QtyType = QtyType::"Net Change" then
if MatrixRecords[ColumnID]."Period Start" = MatrixRecords[ColumnID]."Period End" then
Rec.SetRange("Date Filter", MatrixRecords[ColumnID]."Period Start")
else
Rec.SetRange("Date Filter", MatrixRecords[ColumnID]."Period Start", MatrixRecords[ColumnID]."Period End")
else
Rec.SetRange("Date Filter", 0D, MatrixRecords[ColumnID]."Period End");
end;
local procedure MATRIX_OnAfterGetRecord(ColumnID: Integer)
begin
SetDateFilter(ColumnID);
Rec.CalcFields(Capacity);
if Rec.Capacity <> 0 then
MATRIX_CellData[ColumnID] := Rec.Capacity
else
MATRIX_CellData[ColumnID] := 0;
OnAfterMATRIX_OnAfterGetRecord(Rec, MATRIX_CellData, ColumnID);
end;
procedure LoadMatrix(NewQtyType: Enum "Analysis Amount Type"; NewMatrixColumns: array[32] of Text[1024]; var NewMatrixRecords: array[32] of Record Date; NewNoOfMatrixColumns: Integer)
var
i: Integer;
begin
QtyType := NewQtyType;
CopyArray(MATRIX_ColumnCaption, NewMatrixColumns, 1);
for i := 1 to ArrayLen(MatrixRecords) do
MatrixRecords[i].Copy(NewMatrixRecords[i]);
MATRIX_NoOfMatrixColumns := NewNoOfMatrixColumns;
end;
local procedure MatrixOnDrillDown(ColumnID: Integer)
var
ResCapacityEntries: Record "Res. Capacity Entry";
IsHandled: Boolean;
begin
SetDateFilter(ColumnID);
ResCapacityEntries.SetCurrentKey("Resource No.", Date);
ResCapacityEntries.SetRange("Resource No.", Rec."No.");
ResCapacityEntries.SetFilter(Date, Rec.GetFilter("Date Filter"));
IsHandled := false;
OnAfterMatrixOnDrillDown(ResCapacityEntries, IsHandled);
if IsHandled then
exit;
PAGE.Run(0, ResCapacityEntries);
end;
local procedure ValidateCapacity(MATRIX_ColumnOrdinal: Integer)
begin
SetDateFilter(MATRIX_ColumnOrdinal);
Rec.CalcFields(Capacity);
Rec.Validate(Capacity, MATRIX_CellData[MATRIX_ColumnOrdinal]);
OnAfterValidateCapacity(Rec, MATRIX_CellData, MATRIX_ColumnOrdinal);
end;
[IntegrationEvent(false, false)]
local procedure OnAfterMatrixOnDrillDown(var ResCapacityEntry: Record "Res. Capacity Entry"; var IsHandled: Boolean)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnAfterMATRIX_OnAfterGetRecord(var Resource: Record Resource; var MATRIXCellData: array[32] of Decimal; ColumnID: Integer)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnAfterValidateCapacity(var Resource: Record Resource; var MATRIXCellData: array[32] of Decimal; MATRIXColumnOrdinal: Integer)
begin
end;
}