Page 961 Manager Time Sheet Archive
src/Layers/W1/BaseApp/Projects/TimeSheet/ManagerTimeSheetArchive.Page.al411 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.TimeSheet;using System.Utilities;page 961 "Manager Time Sheet Archive"{ Caption = 'Manager Time Sheet Archive'; DataCaptionFields = "Time Sheet No."; DeleteAllowed = false; InsertAllowed = false; PageType = Worksheet; SaveValues = true; SourceTable = "Time Sheet Line Archive"; layout { area(content) { group(Control26) { ShowCaption = false; field(CurrTimeSheetNo; CurrTimeSheetNo) { ApplicationArea = Jobs; Caption = 'Time Sheet No'; ToolTip = 'Specifies the number of the time sheet.'; trigger OnLookup(var Text: Text): Boolean begin CurrPage.SaveRecord(); TimeSheetMgt.LookupApproverTimeSheetArchive(CurrTimeSheetNo, Rec, TimeSheetHeaderArchive); UpdateControls(); end; trigger OnValidate() begin TimeSheetHeaderArchive.Reset(); TimeSheetMgt.FilterTimeSheetsArchive(TimeSheetHeaderArchive, TimeSheetHeaderArchive.FieldNo("Approver User ID")); TimeSheetMgt.CheckTimeSheetArchiveNo(TimeSheetHeaderArchive, CurrTimeSheetNo); CurrPage.SaveRecord(); TimeSheetMgt.SetTimeSheetArchiveNo(CurrTimeSheetNo, Rec); UpdateControls(); end; }#pragma warning disable AA0100 field("TimeSheetHeaderArchive.""Resource No."""; TimeSheetHeaderArchive."Resource No.")#pragma warning restore AA0100 { ApplicationArea = Jobs; Caption = 'Resource No.'; Editable = false; ToolTip = 'Specifies a number for the resource.'; }#pragma warning disable AA0100 field("TimeSheetHeaderArchive.""Approver User ID"""; TimeSheetHeaderArchive."Approver User ID")#pragma warning restore AA0100 { ApplicationArea = Jobs; Caption = 'Approver User ID'; Editable = false; ToolTip = 'Specifies the ID of the time sheet approver.'; }#pragma warning disable AA0100 field("TimeSheetHeaderArchive.""Starting Date"""; TimeSheetHeaderArchive."Starting Date")#pragma warning restore AA0100 { ApplicationArea = Jobs; Caption = 'Starting Date'; Editable = false; ToolTip = 'Specifies the date from which the report or batch job processes information.'; }#pragma warning disable AA0100 field("TimeSheetHeaderArchive.""Ending Date"""; TimeSheetHeaderArchive."Ending Date")#pragma warning restore AA0100 { ApplicationArea = Jobs; Caption = 'Ending Date'; Editable = false; ToolTip = 'Specifies the date to which the report or batch job processes information.'; } } repeater(Control1) { Editable = false; ShowCaption = false; field(Type; Rec.Type) { ApplicationArea = Jobs; trigger OnValidate() begin AfterGetCurrentRecord(); CurrPage.Update(true); end; } field("Job No."; Rec."Job No.") { ApplicationArea = Jobs; } field("Job Task No."; Rec."Job Task No.") { ApplicationArea = Jobs; } field(Description; Rec.Description) { ApplicationArea = Jobs; } field("Cause of Absence Code"; Rec."Cause of Absence Code") { ApplicationArea = Jobs; } field(Chargeable; Rec.Chargeable) { ApplicationArea = Jobs; } field("Work Type Code"; Rec."Work Type Code") { ApplicationArea = Jobs; } field("Assembly Order No."; Rec."Assembly Order No.") { ApplicationArea = Assembly; } field(Status; Rec.Status) { ApplicationArea = Jobs; } field(Field1; CellData[1]) { AutoFormatType = 0; ApplicationArea = Jobs; BlankZero = true; CaptionClass = '3,' + ColumnCaption[1]; Width = 6; } field(Field2; CellData[2]) { AutoFormatType = 0; ApplicationArea = Jobs; BlankZero = true; CaptionClass = '3,' + ColumnCaption[2]; Width = 6; } field(Field3; CellData[3]) { AutoFormatType = 0; ApplicationArea = Jobs; BlankZero = true; CaptionClass = '3,' + ColumnCaption[3]; Width = 6; } field(Field4; CellData[4]) { AutoFormatType = 0; ApplicationArea = Jobs; BlankZero = true; CaptionClass = '3,' + ColumnCaption[4]; Width = 6; } field(Field5; CellData[5]) { AutoFormatType = 0; ApplicationArea = Jobs; BlankZero = true; CaptionClass = '3,' + ColumnCaption[5]; Width = 6; } field(Field6; CellData[6]) { AutoFormatType = 0; ApplicationArea = Jobs; BlankZero = true; CaptionClass = '3,' + ColumnCaption[6]; Width = 6; } field(Field7; CellData[7]) { AutoFormatType = 0; ApplicationArea = Jobs; BlankZero = true; CaptionClass = '3,' + ColumnCaption[7]; Width = 6; } field("Total Quantity"; Rec."Total Quantity") { AutoFormatType = 0; ApplicationArea = Jobs; Caption = 'Total'; DrillDown = false; } } } area(factboxes) { part(PeriodSummaryArchiveFactBox; "Period Summary Archive FactBox") { ApplicationArea = Jobs; Visible = true; } } } actions { area(navigation) { group("&Time Sheet") { Caption = '&Time Sheet'; Image = Timesheet; action("&Previous Period") { ApplicationArea = Jobs; Caption = '&Previous Period'; Image = PreviousSet; ToolTip = 'Show the information based on the previous period. If you set the View by field to Day, the date filter changes to the day before.'; trigger OnAction() begin FindTimeSheet(SetWanted::Previous); end; } action("&Next Period") { ApplicationArea = Jobs; Caption = '&Next Period'; Image = NextSet; ToolTip = 'View information for the next period.'; trigger OnAction() begin FindTimeSheet(SetWanted::Next); end; } } group("&Line") { Caption = '&Line'; Image = Line; action("Posting E&ntries") { ApplicationArea = Jobs; Caption = 'Posting E&ntries'; Image = PostingEntries; ShortCutKey = 'Ctrl+F7'; ToolTip = 'View the resource ledger entries that have been posted in connection with the.'; trigger OnAction() begin TimeSheetMgt.ShowPostingEntries(Rec."Time Sheet No.", Rec."Line No."); end; } } group("Co&mments") { Caption = 'Co&mments'; Image = ViewComments; action(TimeSheetComments) { ApplicationArea = Comments; Caption = '&Time Sheet Comments'; Image = ViewComments; RunObject = Page "Time Sheet Arc. Comment Sheet"; RunPageLink = "No." = field("Time Sheet No."), "Time Sheet Line No." = const(0); ToolTip = 'View comments about the time sheet.'; } action(LineComments) { ApplicationArea = Comments; Caption = '&Line Comments'; Image = ViewComments; RunObject = Page "Time Sheet Arc. Comment Sheet"; RunPageLink = "No." = field("Time Sheet No."), "Time Sheet Line No." = field("Line No."); ToolTip = 'View or create comments.'; } } } area(Promoted) { group(Category_Report) { Caption = 'Report', Comment = 'Generated from the PromotedActionCategories property index 2.'; } group(Category_Category4) { Caption = 'Navigate', Comment = 'Generated from the PromotedActionCategories property index 3.'; actionref("&Previous Period_Promoted"; "&Previous Period") { } actionref("&Next Period_Promoted"; "&Next Period") { } } group(Category_Category5) { Caption = 'Show', Comment = 'Generated from the PromotedActionCategories property index 4.'; actionref("Posting E&ntries_Promoted"; "Posting E&ntries") { } actionref(TimeSheetComments_Promoted; TimeSheetComments) { } actionref(LineComments_Promoted; LineComments) { } } } } trigger OnAfterGetRecord() begin AfterGetCurrentRecord(); end; trigger OnNewRecord(BelowxRec: Boolean) begin AfterGetCurrentRecord(); end; trigger OnOpenPage() begin if Rec."Time Sheet No." <> '' then CurrTimeSheetNo := Rec."Time Sheet No." else CurrTimeSheetNo := TimeSheetHeaderArchive.FindLastTimeSheetArchiveNo( TimeSheetHeaderArchive.FieldNo("Approver User ID")); TimeSheetMgt.SetTimeSheetArchiveNo(CurrTimeSheetNo, Rec); UpdateControls(); end; var TimeSheetHeaderArchive: Record "Time Sheet Header Archive"; TimeSheetDetailArchive: Record "Time Sheet Detail Archive"; ColumnRecords: array[32] of Record Date; TimeSheetMgt: Codeunit "Time Sheet Management"; NoOfColumns: Integer; CellData: array[32] of Decimal; ColumnCaption: array[32] of Text[1024]; CurrTimeSheetNo: Code[20]; SetWanted: Option Previous,Next; procedure SetColumns() var Calendar: Record Date; begin Clear(ColumnCaption); Clear(ColumnRecords); Clear(Calendar); Clear(NoOfColumns); TimeSheetHeaderArchive.Get(CurrTimeSheetNo); Calendar.SetRange("Period Type", Calendar."Period Type"::Date); Calendar.SetRange("Period Start", TimeSheetHeaderArchive."Starting Date", TimeSheetHeaderArchive."Ending Date"); if Calendar.FindSet() then repeat NoOfColumns += 1; ColumnRecords[NoOfColumns]."Period Start" := Calendar."Period Start"; ColumnCaption[NoOfColumns] := TimeSheetMgt.FormatDate(Calendar."Period Start", 1); until Calendar.Next() = 0; end; local procedure AfterGetCurrentRecord() var i: Integer; begin i := 0; while i < NoOfColumns do begin i := i + 1; if (Rec."Line No." <> 0) and TimeSheetDetailArchive.Get( Rec."Time Sheet No.", Rec."Line No.", ColumnRecords[i]."Period Start") then CellData[i] := TimeSheetDetailArchive.Quantity else CellData[i] := 0; end; UpdateFactBox(); end; local procedure FindTimeSheet(Which: Option) begin CurrTimeSheetNo := TimeSheetMgt.FindTimeSheetArchive(TimeSheetHeaderArchive, Which); TimeSheetMgt.SetTimeSheetArchiveNo(CurrTimeSheetNo, Rec); UpdateControls(); end; local procedure UpdateFactBox() begin CurrPage.PeriodSummaryArchiveFactBox.PAGE.UpdateData(TimeSheetHeaderArchive); end; local procedure UpdateControls() begin SetColumns(); UpdateFactBox(); CurrPage.Update(false); end;}