Page 99000773 Capacity Journal
- App
- Base Application
- Namespace
- Microsoft.Manufacturing.Capacity
- Versions
- 17-28
- Source table
- 83
Versions171819202122232425262728
Source29
Source in 29
src/Layers/W1/BaseApp/Manufacturing/Capacity/CapacityJournal.Page.al725 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.Manufacturing.Capacity;
using Microsoft.Finance.Dimension;
using Microsoft.Foundation.Reporting;
using Microsoft.Inventory.Item.Catalog;
using Microsoft.Inventory.Journal;
using Microsoft.Inventory.Posting;
using Microsoft.Manufacturing.MachineCenter;
using Microsoft.Manufacturing.WorkCenter;
using Microsoft.Utilities;
page 99000773 "Capacity Journal"
{
ApplicationArea = Manufacturing;
AutoSplitKey = true;
Caption = 'Capacity Journals';
DataCaptionFields = "Journal Batch Name";
DelayedInsert = true;
PageType = Worksheet;
SaveValues = true;
SourceTable = "Item Journal Line";
UsageCategory = Tasks;
layout
{
area(content)
{
field(CurrentJnlBatchName; CurrentJnlBatchName)
{
ApplicationArea = Manufacturing;
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();
ItemJnlMgt.LookupName(CurrentJnlBatchName, Rec);
SetControlAppearanceFromBatch();
CurrPage.Update(false);
end;
trigger OnValidate()
begin
ItemJnlMgt.CheckName(CurrentJnlBatchName, Rec);
CurrentJnlBatchNameOnAfterValidate();
end;
}
repeater(Control1)
{
ShowCaption = false;
field("Posting Date"; Rec."Posting Date")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the posting date for the entry.';
}
field("Order No."; Rec."Order No.")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the number of the order that created the entry.';
Visible = false;
}
field("Document No."; Rec."Document No.")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies a document number for the journal line.';
ShowMandatory = true;
}
field("Item No."; Rec."Item No.")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the number of the item on the journal line.';
Visible = false;
trigger OnLookup(var Text: Text): Boolean
begin
Rec.LookupItemNo();
Rec.ShowShortcutDimCode(ShortcutDimCode);
end;
trigger OnValidate()
begin
ItemNoOnAfterValidate();
end;
}
field("Item Reference No."; Rec."Item Reference No.")
{
AccessByPermission = tabledata "Item Reference" = R;
ApplicationArea = Manufacturing, ItemReferences;
QuickEntry = false;
ToolTip = 'Specifies a reference to the item number as defined by the item''s barcode.';
Visible = false;
trigger OnLookup(var Text: Text): Boolean
var
ItemReferenceManagement: Codeunit "Item Reference Management";
begin
ItemReferenceManagement.ItemJournalReferenceNoLookup(Rec);
ItemNoOnAfterValidate();
OnReferenceNoOnAfterLookup(Rec);
end;
trigger OnValidate()
begin
ItemNoOnAfterValidate();
end;
}
field("Operation No."; Rec."Operation No.")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the number of the production operation on the item journal line when the journal functions as an output journal.';
Visible = false;
}
field(Type; Rec.Type)
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the journal type, which is either Work Center or Machine Center.';
trigger OnValidate()
begin
MfgItemJournalMgt.GetCapacity(Rec.Type, Rec."No.", CapDescription);
end;
}
field("No."; Rec."No.")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the number of the involved entry or record, according to the specified number series.';
trigger OnValidate()
begin
MfgItemJournalMgt.GetCapacity(Rec.Type, Rec."No.", CapDescription);
end;
}
field(Description; Rec.Description)
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies a description of the item on the journal line.';
}
field("Work Shift Code"; Rec."Work Shift Code")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the work shift code for this Journal line.';
Visible = false;
}
field("Starting Time"; Rec."Starting Time")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the starting time of the operation on the item journal line.';
Visible = false;
}
field("Ending Time"; Rec."Ending Time")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the ending time of the operation on the item journal line.';
Visible = false;
}
field("Concurrent Capacity"; Rec."Concurrent Capacity")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the concurrent capacity.';
Visible = false;
}
field("Stop Time"; Rec."Stop Time")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the stop time of this capacity ledger entry.';
}
field("Cap. Unit of Measure Code"; Rec."Cap. Unit of Measure Code")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the unit of measure code for the capacity usage.';
}
field("Stop Code"; Rec."Stop Code")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the stop code.';
}
field("Scrap Code"; Rec."Scrap Code")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the scrap code.';
Visible = false;
}
field("Output Quantity"; Rec."Output Quantity")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the quantity of the produced item that can be posted as output on the journal line.';
Visible = false;
}
field("Scrap Quantity"; Rec."Scrap Quantity")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the number of units produced incorrectly, and therefore cannot be used.';
Visible = false;
}
field("Unit of Measure Code"; Rec."Unit of Measure Code")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies how each unit of the item or resource is measured, such as in pieces or hours. By default, the value in the Base Unit of Measure field on the item or resource card is inserted.';
Visible = false;
}
field("Document Date"; Rec."Document Date")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the date when the related document was created.';
Visible = false;
}
field("Reason Code"; Rec."Reason Code")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies the reason code, a supplementary source code that enables you to trace the entry.';
Visible = false;
}
field("External Document No."; Rec."External Document No.")
{
ApplicationArea = Manufacturing;
ToolTip = 'Specifies a document number that refers to the customer''s or vendor''s numbering system.';
Visible = false;
}
field("Shortcut Dimension 1 Code"; Rec."Shortcut Dimension 1 Code")
{
ApplicationArea = Dimensions;
ToolTip = 'Specifies the code for Shortcut Dimension 1, which is one of two global dimension codes that you set up in the General Ledger Setup window.';
Visible = DimVisible1;
}
field("Shortcut Dimension 2 Code"; Rec."Shortcut Dimension 2 Code")
{
ApplicationArea = Dimensions;
ToolTip = 'Specifies the code for Shortcut Dimension 2, which is one of two global dimension codes that you set up in the General Ledger Setup window.';
Visible = DimVisible2;
}
field(ShortcutDimCode3; ShortcutDimCode[3])
{
ApplicationArea = Dimensions;
CaptionClass = '1,2,3';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(3),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = DimVisible3;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(3, ShortcutDimCode[3]);
end;
}
field(ShortcutDimCode4; ShortcutDimCode[4])
{
ApplicationArea = Dimensions;
CaptionClass = '1,2,4';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(4),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = DimVisible4;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(4, ShortcutDimCode[4]);
end;
}
field(ShortcutDimCode5; ShortcutDimCode[5])
{
ApplicationArea = Dimensions;
CaptionClass = '1,2,5';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(5),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = DimVisible5;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(5, ShortcutDimCode[5]);
end;
}
field(ShortcutDimCode6; ShortcutDimCode[6])
{
ApplicationArea = Dimensions;
CaptionClass = '1,2,6';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(6),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = DimVisible6;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(6, ShortcutDimCode[6]);
end;
}
field(ShortcutDimCode7; ShortcutDimCode[7])
{
ApplicationArea = Dimensions;
CaptionClass = '1,2,7';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(7),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = DimVisible7;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(7, ShortcutDimCode[7]);
end;
}
field(ShortcutDimCode8; ShortcutDimCode[8])
{
ApplicationArea = Dimensions;
CaptionClass = '1,2,8';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(8),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = DimVisible8;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(8, ShortcutDimCode[8]);
end;
}
}
group(Control73)
{
ShowCaption = false;
fixed(Control1902114901)
{
ShowCaption = false;
group("Capacity Name")
{
Caption = 'Capacity Name';
field(CapDescription; CapDescription)
{
ApplicationArea = Manufacturing;
Editable = false;
ShowCaption = false;
}
}
}
}
}
area(factboxes)
{
part(JournalErrorsFactBox; "Item Journal Errors FactBox")
{
ApplicationArea = Basic, Suite;
ShowFilter = false;
Visible = BackgroundErrorCheck;
SubPageLink = "Journal Template Name" = field("Journal Template Name"),
"Journal Batch Name" = field("Journal Batch Name"),
"Line No." = field("Line No.");
}
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;
}
action("Item &Tracking Lines")
{
ApplicationArea = ItemTracking;
Caption = 'Item &Tracking Lines';
Image = ItemTrackingLines;
ShortCutKey = 'Ctrl+Alt+I';
ToolTip = 'View or edit serial, lot and package numbers that are assigned to the item on the document or journal line.';
trigger OnAction()
begin
Rec.OpenItemTrackingLines(false);
end;
}
}
group("&Capacity")
{
Caption = '&Capacity';
Image = Capacity;
action(Card)
{
ApplicationArea = Manufacturing;
Caption = 'Card';
Image = EditLines;
ShortCutKey = 'Shift+F7';
ToolTip = 'View or change detailed information about the record on the document or journal line.';
trigger OnAction()
var
WorkCenter: Record "Work Center";
MachCenter: Record "Machine Center";
begin
case Rec.Type of
Rec.Type::"Work Center":
begin
WorkCenter.SetRange("No.", Rec."No.");
PAGE.Run(Page::"Work Center Card", WorkCenter);
end;
Rec.Type::"Machine Center":
begin
MachCenter.SetRange("No.", Rec."No.");
PAGE.Run(Page::"Machine Center Card", MachCenter);
end;
end;
end;
}
action("Ledger E&ntries")
{
ApplicationArea = Manufacturing;
Caption = 'Ledger E&ntries';
Image = CustomerLedger;
RunObject = Page "Capacity Ledger Entries";
RunPageLink = "Order Type" = const(Production),
"Order No." = field("Order No.");
RunPageView = sorting("Order Type", "Order 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 = Manufacturing;
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.PrintItemJnlLine(Rec);
end;
}
action("P&ost")
{
ApplicationArea = Manufacturing;
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::"Item Jnl.-Post", Rec);
CurrentJnlBatchName := Rec.GetRangeMax("Journal Batch Name");
CurrPage.Update(false);
end;
}
action(PreviewPosting)
{
ApplicationArea = Manufacturing;
Caption = 'Preview Posting';
Image = ViewPostedOrder;
ShortCutKey = 'Ctrl+Alt+F9';
ToolTip = 'Review the different types of entries that will be created when you post the document or journal.';
trigger OnAction()
begin
ShowPreview();
CurrPage.Update(false);
end;
}
action("Post and &Print")
{
ApplicationArea = Manufacturing;
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::"Item Jnl.-Post+Print", Rec);
CurrentJnlBatchName := Rec.GetRangeMax("Journal Batch Name");
CurrPage.Update(false);
end;
}
}
group("Page")
{
Caption = 'Page';
group(Errors)
{
Caption = 'Issues';
Image = ErrorLog;
Visible = BackgroundErrorCheck;
action(ShowLinesWithErrors)
{
ApplicationArea = Basic, Suite;
Caption = 'Show Lines with Issues';
Image = Error;
Visible = BackgroundErrorCheck;
Enabled = not ShowAllLinesEnabled;
ToolTip = 'View a list of journal lines that have issues before you post the journal.';
trigger OnAction()
begin
Rec.SwitchLinesWithErrorsFilter(ShowAllLinesEnabled);
end;
}
action(ShowAllLines)
{
ApplicationArea = Basic, Suite;
Caption = 'Show All Lines';
Image = ExpandAll;
Visible = BackgroundErrorCheck;
Enabled = ShowAllLinesEnabled;
ToolTip = 'View all journal lines, including lines with and without issues.';
trigger OnAction()
begin
Rec.SwitchLinesWithErrorsFilter(ShowAllLinesEnabled);
end;
}
}
}
}
area(Promoted)
{
group(Category_Process)
{
Caption = 'Process';
group(Category_Category4)
{
Caption = 'Post/Print', Comment = 'Generated from the PromotedActionCategories property index 3.';
ShowAs = SplitButton;
actionref("P&ost_Promoted"; "P&ost")
{
}
actionref("Post and &Print_Promoted"; "Post and &Print")
{
}
actionref(PreviewPosting_Promoted; PreviewPosting)
{
}
}
}
group(Category_Category5)
{
Caption = 'Line', Comment = 'Generated from the PromotedActionCategories property index 4.';
actionref("Item &Tracking Lines_Promoted"; "Item &Tracking Lines")
{
}
actionref(Dimensions_Promoted; Dimensions)
{
}
}
group(Category_Category6)
{
Caption = 'Capacity', Comment = 'Generated from the PromotedActionCategories property index 5.';
actionref(Card_Promoted; Card)
{
}
}
group(Category_Category7)
{
Caption = 'Page', Comment = 'Generated from the PromotedActionCategories property index 6.';
actionref(ShowLinesWithErrors_Promoted; ShowLinesWithErrors)
{
}
actionref(ShowAllLines_Promoted; ShowAllLines)
{
}
}
group(Category_Report)
{
Caption = 'Report', Comment = 'Generated from the PromotedActionCategories property index 2.';
}
}
}
trigger OnAfterGetCurrRecord()
begin
MfgItemJournalMgt.GetCapacity(Rec.Type, Rec."No.", CapDescription);
end;
trigger OnAfterGetRecord()
begin
Rec.ShowShortcutDimCode(ShortcutDimCode);
end;
trigger OnNewRecord(BelowxRec: Boolean)
begin
Rec.SetUpNewLine(xRec);
Rec.Validate("Entry Type", Rec."Entry Type"::Output);
Clear(ShortcutDimCode);
end;
trigger OnOpenPage()
var
JnlSelected: Boolean;
begin
SetDimensionsVisibility();
if Rec.IsOpenedFromBatch() then begin
CurrentJnlBatchName := Rec."Journal Batch Name";
ItemJnlMgt.OpenJnl(CurrentJnlBatchName, Rec);
SetControlAppearanceFromBatch();
exit;
end;
ItemJnlMgt.TemplateSelection(Page::"Capacity Journal", 6, false, Rec, JnlSelected);
if not JnlSelected then
Error('');
ItemJnlMgt.OpenJnl(CurrentJnlBatchName, Rec);
SetControlAppearanceFromBatch();
end;
var
ItemJnlMgt: Codeunit ItemJnlManagement;
MfgItemJournalMgt: Codeunit "Mfg. Item Journal Mgt.";
ReportPrint: Codeunit "Test Report-Print";
ItemJournalErrorsMgt: Codeunit "Item Journal Errors Mgt.";
CapDescription: Text[100];
CurrentJnlBatchName: Code[10];
BackgroundErrorCheck: Boolean;
ShowAllLinesEnabled: Boolean;
protected var
ShortcutDimCode: array[8] of Code[20];
DimVisible1: Boolean;
DimVisible2: Boolean;
DimVisible3: Boolean;
DimVisible4: Boolean;
DimVisible5: Boolean;
DimVisible6: Boolean;
DimVisible7: Boolean;
DimVisible8: Boolean;
local procedure CurrentJnlBatchNameOnAfterValidate()
begin
CurrPage.SaveRecord();
ItemJnlMgt.SetName(CurrentJnlBatchName, Rec);
SetControlAppearanceFromBatch();
CurrPage.Update(false);
end;
local procedure SetControlAppearanceFromBatch()
var
ItemJournalBatch: Record "Item Journal Batch";
BackgroundErrorHandlingMgt: Codeunit "Background Error Handling Mgt.";
begin
if not ItemJournalBatch.Get(Rec.GetRangeMax("Journal Template Name"), CurrentJnlBatchName) then
exit;
BackgroundErrorCheck := BackgroundErrorHandlingMgt.BackgroundValidationFeatureEnabled();
ShowAllLinesEnabled := true;
Rec.SwitchLinesWithErrorsFilter(ShowAllLinesEnabled);
ItemJournalErrorsMgt.SetFullBatchCheck(true);
end;
procedure ItemNoOnAfterValidate()
begin
Rec.ShowShortcutDimCode(ShortcutDimCode);
end;
local procedure SetDimensionsVisibility()
var
DimMgt: Codeunit DimensionManagement;
begin
DimVisible1 := false;
DimVisible2 := false;
DimVisible3 := false;
DimVisible4 := false;
DimVisible5 := false;
DimVisible6 := false;
DimVisible7 := false;
DimVisible8 := false;
DimMgt.UseShortcutDims(
DimVisible1, DimVisible2, DimVisible3, DimVisible4, DimVisible5, DimVisible6, DimVisible7, DimVisible8);
Clear(DimMgt);
end;
local procedure ShowPreview()
var
ItemJnlPost: Codeunit "Item Jnl.-Post";
begin
ItemJnlPost.Preview(Rec);
end;
[IntegrationEvent(false, false)]
local procedure OnReferenceNoOnAfterLookup(var ItemJournalLine: Record "Item Journal Line")
begin
end;
}