Page 290 Recurring Resource Jnl., source in 29
Source29
src/Layers/W1/BaseApp/Projects/Resources/Journal/RecurringResourceJnl.Page.al467 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.Journal;
using Microsoft.Finance.Dimension;
using Microsoft.Foundation.Reporting;
using Microsoft.Projects.Resources.Ledger;
using Microsoft.Projects.Resources.Resource;
page 290 "Recurring Resource Jnl."
{
ApplicationArea = Jobs;
AutoSplitKey = true;
Caption = 'Recurring Resource Journal';
DataCaptionFields = "Journal Batch Name";
DelayedInsert = true;
PageType = Worksheet;
SaveValues = true;
SourceTable = "Res. Journal Line";
UsageCategory = Tasks;
layout
{
area(content)
{
field(CurrentJnlBatchName; CurrentJnlBatchName)
{
ApplicationArea = Jobs;
Caption = 'Batch Name';
Lookup = true;
ToolTip = 'Specifies the name of the journal batch, a personalized journal layout, that the journal is based on.';
trigger OnLookup(var Text: Text): Boolean
begin
CurrPage.SaveRecord();
ResJnlManagement.LookupName(CurrentJnlBatchName, Rec);
CurrPage.Update(false);
end;
trigger OnValidate()
begin
ResJnlManagement.CheckName(CurrentJnlBatchName, Rec);
CurrentJnlBatchNameOnAfterVali();
end;
}
repeater(Control1)
{
ShowCaption = false;
field("Recurring Method"; Rec."Recurring Method")
{
ApplicationArea = Jobs;
}
field("Recurring Frequency"; Rec."Recurring Frequency")
{
ApplicationArea = Jobs;
}
field("Posting Date"; Rec."Posting Date")
{
ApplicationArea = Jobs;
}
field("Document Date"; Rec."Document Date")
{
ApplicationArea = Jobs;
Visible = false;
}
field("Entry Type"; Rec."Entry Type")
{
ApplicationArea = Jobs;
}
field("Document No."; Rec."Document No.")
{
ApplicationArea = Jobs;
}
field("Resource No."; Rec."Resource No.")
{
ApplicationArea = Jobs;
trigger OnValidate()
begin
ResJnlManagement.GetRes(Rec."Resource No.", ResName);
Rec.ShowShortcutDimCode(ShortcutDimCode);
end;
}
field("Resource Group No."; Rec."Resource Group No.")
{
ApplicationArea = Jobs;
Visible = false;
trigger OnValidate()
begin
Rec.ShowShortcutDimCode(ShortcutDimCode);
end;
}
field(Description; Rec.Description)
{
ApplicationArea = Jobs;
}
field("Job No."; Rec."Job No.")
{
ApplicationArea = Jobs;
Visible = false;
trigger OnValidate()
begin
Rec.ShowShortcutDimCode(ShortcutDimCode);
end;
}
field("Shortcut Dimension 1 Code"; Rec."Shortcut Dimension 1 Code")
{
ApplicationArea = Dimensions;
Visible = false;
}
field("Shortcut Dimension 2 Code"; Rec."Shortcut Dimension 2 Code")
{
ApplicationArea = Dimensions;
Visible = false;
}
field("ShortcutDimCode[3]"; ShortcutDimCode[3])
{
ApplicationArea = Jobs;
CaptionClass = '1,2,3';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(3),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = false;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(3, ShortcutDimCode[3]);
end;
}
field("ShortcutDimCode[4]"; ShortcutDimCode[4])
{
ApplicationArea = Jobs;
CaptionClass = '1,2,4';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(4),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = false;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(4, ShortcutDimCode[4]);
end;
}
field("ShortcutDimCode[5]"; ShortcutDimCode[5])
{
ApplicationArea = Jobs;
CaptionClass = '1,2,5';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(5),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = false;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(5, ShortcutDimCode[5]);
end;
}
field("ShortcutDimCode[6]"; ShortcutDimCode[6])
{
ApplicationArea = Jobs;
CaptionClass = '1,2,6';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(6),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = false;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(6, ShortcutDimCode[6]);
end;
}
field("ShortcutDimCode[7]"; ShortcutDimCode[7])
{
ApplicationArea = Jobs;
CaptionClass = '1,2,7';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(7),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = false;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(7, ShortcutDimCode[7]);
end;
}
field("ShortcutDimCode[8]"; ShortcutDimCode[8])
{
ApplicationArea = Jobs;
CaptionClass = '1,2,8';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(8),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = false;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(8, ShortcutDimCode[8]);
end;
}
field("Work Type Code"; Rec."Work Type Code")
{
ApplicationArea = Jobs;
}
field("Gen. Bus. Posting Group"; Rec."Gen. Bus. Posting Group")
{
ApplicationArea = Jobs;
Visible = false;
}
field("Gen. Prod. Posting Group"; Rec."Gen. Prod. Posting Group")
{
ApplicationArea = Jobs;
Visible = false;
}
field(Quantity; Rec.Quantity)
{
ApplicationArea = Jobs;
}
field("Unit of Measure Code"; Rec."Unit of Measure Code")
{
ApplicationArea = Jobs;
}
field("Direct Unit Cost"; Rec."Direct Unit Cost")
{
ApplicationArea = Jobs;
}
field("Unit Cost"; Rec."Unit Cost")
{
ApplicationArea = Jobs;
}
field("Total Cost"; Rec."Total Cost")
{
ApplicationArea = Jobs;
}
field("Unit Price"; Rec."Unit Price")
{
ApplicationArea = Jobs;
}
field("Total Price"; Rec."Total Price")
{
ApplicationArea = Jobs;
}
field("Reason Code"; Rec."Reason Code")
{
ApplicationArea = Jobs;
Visible = false;
}
field("Expiration Date"; Rec."Expiration Date")
{
ApplicationArea = Jobs;
}
}
group(Control41)
{
ShowCaption = false;
fixed(Control1903222401)
{
ShowCaption = false;
group("Resource Name")
{
Caption = 'Resource Name';
field(ResName; ResName)
{
ApplicationArea = Jobs;
Editable = false;
ShowCaption = false;
}
}
}
}
}
area(factboxes)
{
systempart(Control1900383207; Links)
{
ApplicationArea = RecordLinks;
Visible = false;
}
systempart(Control1905767507; Notes)
{
ApplicationArea = Notes;
Visible = false;
}
}
}
actions
{
area(navigation)
{
group("&Line")
{
Caption = '&Line';
Image = Line;
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;
}
}
group("&Resource")
{
Caption = '&Resource';
Image = Resource;
action(Card)
{
ApplicationArea = Jobs;
Caption = 'Card';
Image = EditLines;
RunObject = Page "Resource Card";
RunPageLink = "No." = field("Resource No.");
ShortCutKey = 'Shift+F7';
ToolTip = 'View or change detailed information about the record on the document or journal line.';
}
action("Ledger E&ntries")
{
ApplicationArea = Jobs;
Caption = 'Ledger E&ntries';
Image = ResourceLedger;
//The property 'PromotedCategory' can only be set if the property 'Promoted' is set to 'true'
//PromotedCategory = Process;
RunObject = Page "Resource Ledger Entries";
RunPageLink = "Resource No." = field("Resource No.");
RunPageView = sorting("Resource No.");
ShortCutKey = 'Ctrl+F7';
ToolTip = 'View the history of transactions that have been posted for the selected record.';
}
}
}
area(processing)
{
group("P&osting")
{
Caption = 'P&osting';
Image = Post;
action("Test Report")
{
ApplicationArea = Jobs;
Caption = 'Test Report';
Ellipsis = true;
Image = TestReport;
ToolTip = 'View a test report so that you can find and correct any errors before you perform the actual posting of the journal or document.';
trigger OnAction()
begin
ReportPrint.PrintResJnlLine(Rec);
end;
}
action("P&ost")
{
ApplicationArea = Jobs;
Caption = 'P&ost';
Image = PostOrder;
ShortCutKey = 'F9';
ToolTip = 'Finalize the document or journal by posting the amounts and quantities to the related accounts in your company books.';
trigger OnAction()
begin
CODEUNIT.Run(CODEUNIT::"Res. Jnl.-Post", Rec);
CurrentJnlBatchName := Rec.GetRangeMax("Journal Batch Name");
CurrPage.Update(false);
end;
}
action("Post and &Print")
{
ApplicationArea = Jobs;
Caption = 'Post and &Print';
Image = PostPrint;
ShortCutKey = 'Shift+F9';
ToolTip = 'Finalize and prepare to print the document or journal. The values and quantities are posted to the related accounts. A report request window where you can specify what to include on the print-out.';
trigger OnAction()
begin
CODEUNIT.Run(CODEUNIT::"Res. Jnl.-Post+Print", Rec);
CurrentJnlBatchName := Rec.GetRangeMax("Journal Batch Name");
CurrPage.Update(false);
end;
}
}
}
area(Promoted)
{
group(Category_Process)
{
Caption = 'Process';
group(Category_Posting)
{
Caption = 'Posting';
ShowAs = SplitButton;
actionref("P&ost_Promoted"; "P&ost")
{
}
actionref("Post and &Print_Promoted"; "Post and &Print")
{
}
}
actionref(Dimensions_Promoted; Dimensions)
{
}
}
}
}
trigger OnAfterGetCurrRecord()
begin
ResJnlManagement.GetRes(Rec."Resource No.", ResName);
end;
trigger OnAfterGetRecord()
begin
Rec.ShowShortcutDimCode(ShortcutDimCode);
end;
trigger OnNewRecord(BelowxRec: Boolean)
begin
Rec.SetUpNewLine(xRec);
Clear(ShortcutDimCode);
end;
trigger OnOpenPage()
var
JnlSelected: Boolean;
begin
if Rec.IsOpenedFromBatch() then begin
CurrentJnlBatchName := Rec."Journal Batch Name";
ResJnlManagement.OpenJnl(CurrentJnlBatchName, Rec);
exit;
end;
ResJnlManagement.TemplateSelection(PAGE::"Recurring Resource Jnl.", true, Rec, JnlSelected);
if not JnlSelected then
Error('');
ResJnlManagement.OpenJnl(CurrentJnlBatchName, Rec);
end;
var
ResJnlManagement: Codeunit ResJnlManagement;
ReportPrint: Codeunit "Test Report-Print";
CurrentJnlBatchName: Code[10];
ResName: Text[50];
protected var
ShortcutDimCode: array[8] of Code[20];
local procedure CurrentJnlBatchNameOnAfterVali()
begin
CurrPage.SaveRecord();
ResJnlManagement.SetName(CurrentJnlBatchName, Rec);
CurrPage.Update(false);
end;
}