Page 959 Time Sheet Archive
- App
- Base Application
- Namespace
- Microsoft.Projects.TimeSheet
- Versions
- 17-28
- Source table
- 955
Versions171819202122232425262728
Source29
Source in 29
src/Layers/W1/BaseApp/Projects/TimeSheet/TimeSheetArchive.Page.al414 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 959 "Time Sheet Archive"
{
Caption = 'Time Sheet Archive';
DataCaptionFields = "Time Sheet No.";
DeleteAllowed = false;
InsertAllowed = false;
ModifyAllowed = 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.LookupOwnerTimeSheetArchive(CurrTimeSheetNo, Rec, TimeSheetHeaderArchive);
UpdateControls();
end;
trigger OnValidate()
begin
TimeSheetHeaderArchive.Reset();
TimeSheetMgt.FilterTimeSheetsArchive(TimeSheetHeaderArchive, TimeSheetHeaderArchive.FieldNo("Owner User ID"));
TimeSheetMgt.CheckTimeSheetArchiveNo(TimeSheetHeaderArchive, CurrTimeSheetNo);
CurrPage.SaveRecord();
TimeSheetMgt.SetTimeSheetArchiveNo(CurrTimeSheetNo, Rec);
UpdateControls();
end;
}
field(ResourceNo; TimeSheetHeaderArchive."Resource No.")
{
ApplicationArea = Jobs;
Caption = 'Resource No.';
Editable = false;
ToolTip = 'Specifies a number for the resource.';
}
field(ApproverUserID; TimeSheetHeaderArchive."Approver User ID")
{
ApplicationArea = Jobs;
Caption = 'Approver User ID';
Editable = false;
ToolTip = 'Specifies the ID of the time sheet approver.';
}
field(StartingDate; TimeSheetHeaderArchive."Starting Date")
{
ApplicationArea = Jobs;
Caption = 'Starting Date';
Editable = false;
ToolTip = 'Specifies the date from which the report or batch job processes information.';
}
field(EndingDate; TimeSheetHeaderArchive."Ending Date")
{
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])
{
ApplicationArea = Jobs;
AutoFormatType = 0;
BlankZero = true;
CaptionClass = '3,' + ColumnCaption[1];
Width = 6;
}
field(Field2; CellData[2])
{
ApplicationArea = Jobs;
AutoFormatType = 0;
BlankZero = true;
CaptionClass = '3,' + ColumnCaption[2];
Width = 6;
}
field(Field3; CellData[3])
{
ApplicationArea = Jobs;
AutoFormatType = 0;
BlankZero = true;
CaptionClass = '3,' + ColumnCaption[3];
Width = 6;
}
field(Field4; CellData[4])
{
ApplicationArea = Jobs;
AutoFormatType = 0;
BlankZero = true;
CaptionClass = '3,' + ColumnCaption[4];
Width = 6;
}
field(Field5; CellData[5])
{
ApplicationArea = Jobs;
AutoFormatType = 0;
BlankZero = true;
CaptionClass = '3,' + ColumnCaption[5];
Width = 6;
}
field(Field6; CellData[6])
{
ApplicationArea = Jobs;
AutoFormatType = 0;
BlankZero = true;
CaptionClass = '3,' + ColumnCaption[6];
Width = 6;
}
field(Field7; CellData[7])
{
ApplicationArea = Jobs;
AutoFormatType = 0;
BlankZero = true;
CaptionClass = '3,' + ColumnCaption[7];
Width = 6;
}
field("Total Quantity"; Rec."Total Quantity")
{
ApplicationArea = Jobs;
AutoFormatType = 0;
Caption = 'Total';
DrillDown = false;
}
}
}
area(factboxes)
{
part(PeriodSummaryArcFactBox; "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_Process)
{
Caption = 'Process';
actionref("&Previous Period_Promoted"; "&Previous Period")
{
}
actionref("&Next Period_Promoted"; "&Next Period")
{
}
actionref(TimeSheetComments_Promoted; TimeSheetComments)
{
}
actionref(LineComments_Promoted; LineComments)
{
}
}
group(Category_Category5)
{
Caption = 'Show', Comment = 'Generated from the PromotedActionCategories property index 4.';
}
group(Category_Line)
{
Caption = 'Line';
actionref("Posting E&ntries_Promoted"; "Posting E&ntries")
{
}
}
group(Category_Category4)
{
Caption = 'Navigate', Comment = 'Generated from the PromotedActionCategories property index 3.';
}
group(Category_Report)
{
Caption = 'Report', Comment = 'Generated from the PromotedActionCategories property index 2.';
}
}
}
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("Owner 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.PeriodSummaryArcFactBox.PAGE.UpdateData(TimeSheetHeaderArchive);
end;
local procedure UpdateControls()
begin
SetColumns();
UpdateFactBox();
CurrPage.Update(false);
end;
}