Page 286 Recurring Item Jnl.
src/Layers/W1/BaseApp/Inventory/Journal/RecurringItemJnl.Page.al840 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.Inventory.Journal;using Microsoft.Finance.Dimension;using Microsoft.Foundation.Reporting;using Microsoft.Inventory.Availability;using Microsoft.Inventory.BOM;using Microsoft.Inventory.Item;using Microsoft.Inventory.Item.Catalog;using Microsoft.Inventory.Ledger;using Microsoft.Inventory.Location;using Microsoft.Inventory.Posting;using Microsoft.Warehouse.Journal;using Microsoft.Warehouse.Reports;using Microsoft.Warehouse.Structure;page 286 "Recurring Item Jnl."{ ApplicationArea = Suite; AutoSplitKey = true; Caption = 'Recurring Item Journal'; DataCaptionFields = "Journal Batch Name"; DelayedInsert = true; PageType = Worksheet; SaveValues = true; SourceTable = "Item Journal Line"; UsageCategory = Tasks; layout { area(content) { field(CurrentJnlBatchName; CurrentJnlBatchName) { ApplicationArea = Suite; 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); CurrPage.Update(false); end; trigger OnValidate() begin ItemJnlMgt.CheckName(CurrentJnlBatchName, Rec); CurrentJnlBatchNameOnAfterVali(); end; } repeater(Control1) { ShowCaption = false; field("Recurring Method"; Rec."Recurring Method") { ApplicationArea = Suite; } field("Recurring Frequency"; Rec."Recurring Frequency") { ApplicationArea = Suite; ToolTip = 'Specifies a recurring frequency if you have indicated that the journal is recurring.'; } field("Posting Date"; Rec."Posting Date") { ApplicationArea = Suite; } field("Document Date"; Rec."Document Date") { ApplicationArea = Basic, Suite; Visible = false; } field("Entry Type"; EntryType) { ApplicationArea = Suite; Caption = 'Entry Type'; ToolTip = 'Specifies the type of transaction that will be posted from the item journal line.'; trigger OnValidate() begin CheckEntryType(); Rec.Validate("Entry Type", EntryType); end; } field("Document No."; Rec."Document No.") { ApplicationArea = Suite; } field("Item No."; Rec."Item No.") { ApplicationArea = Suite; trigger OnValidate() begin ItemNoOnAfterValidate(); end; } field("Item Reference No."; Rec."Item Reference No.") { AccessByPermission = tabledata "Item Reference" = R; ApplicationArea = Suite, ItemReferences; QuickEntry = false; 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("Variant Code"; Rec."Variant Code") { ApplicationArea = Planning; Visible = false; } field(Description; Rec.Description) { ApplicationArea = Suite; } field("Shortcut Dimension 1 Code"; Rec."Shortcut Dimension 1 Code") { ApplicationArea = Dimensions; Visible = false; } field("New Shortcut Dimension 1 Code"; Rec."New Shortcut Dimension 1 Code") { ApplicationArea = Dimensions; Visible = false; } field("Shortcut Dimension 2 Code"; Rec."Shortcut Dimension 2 Code") { ApplicationArea = Dimensions; Visible = false; } field("New Shortcut Dimension 2 Code"; Rec."New Shortcut Dimension 2 Code") { ApplicationArea = Dimensions; Visible = false; } field("ShortcutDimCode[3]"; 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 = false; trigger OnValidate() begin Rec.ValidateShortcutDimCode(3, ShortcutDimCode[3]); end; } field("NewShortcutDimCode[3]"; NewShortcutDimCode[3]) { ApplicationArea = Dimensions; CaptionClass = Text001; Visible = false; trigger OnLookup(var Text: Text): Boolean begin Rec.LookupNewShortcutDimCode(3, NewShortcutDimCode[3]); end; trigger OnValidate() begin Rec.TestField("Entry Type", Rec."Entry Type"::Transfer); Rec.ValidateNewShortcutDimCode(3, NewShortcutDimCode[3]); end; } field("ShortcutDimCode[4]"; 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 = false; trigger OnValidate() begin Rec.ValidateShortcutDimCode(4, ShortcutDimCode[4]); end; } field("NewShortcutDimCode[4]"; NewShortcutDimCode[4]) { ApplicationArea = Dimensions; CaptionClass = Text002; Visible = false; trigger OnLookup(var Text: Text): Boolean begin Rec.LookupNewShortcutDimCode(4, NewShortcutDimCode[4]); end; trigger OnValidate() begin Rec.TestField("Entry Type", Rec."Entry Type"::Transfer); Rec.ValidateNewShortcutDimCode(4, NewShortcutDimCode[4]); end; } field("ShortcutDimCode[5]"; 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 = false; trigger OnValidate() begin Rec.ValidateShortcutDimCode(5, ShortcutDimCode[5]); end; } field("NewShortcutDimCode[5]"; NewShortcutDimCode[5]) { ApplicationArea = Dimensions; CaptionClass = Text003; Visible = false; trigger OnLookup(var Text: Text): Boolean begin Rec.LookupNewShortcutDimCode(5, NewShortcutDimCode[5]); end; trigger OnValidate() begin Rec.TestField("Entry Type", Rec."Entry Type"::Transfer); Rec.ValidateNewShortcutDimCode(5, NewShortcutDimCode[5]); end; } field("ShortcutDimCode[6]"; 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 = false; trigger OnValidate() begin Rec.ValidateShortcutDimCode(6, ShortcutDimCode[6]); end; } field("NewShortcutDimCode[6]"; NewShortcutDimCode[6]) { ApplicationArea = Dimensions; CaptionClass = Text004; Visible = false; trigger OnLookup(var Text: Text): Boolean begin Rec.LookupNewShortcutDimCode(6, NewShortcutDimCode[6]); end; trigger OnValidate() begin Rec.TestField("Entry Type", Rec."Entry Type"::Transfer); Rec.ValidateNewShortcutDimCode(6, NewShortcutDimCode[6]); end; } field("ShortcutDimCode[7]"; 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 = false; trigger OnValidate() begin Rec.ValidateShortcutDimCode(7, ShortcutDimCode[7]); end; } field("NewShortcutDimCode[7]"; NewShortcutDimCode[7]) { ApplicationArea = Dimensions; CaptionClass = Text005; Visible = false; trigger OnLookup(var Text: Text): Boolean begin Rec.LookupNewShortcutDimCode(7, NewShortcutDimCode[7]); end; trigger OnValidate() begin Rec.TestField("Entry Type", Rec."Entry Type"::Transfer); Rec.ValidateNewShortcutDimCode(7, NewShortcutDimCode[7]); end; } field("ShortcutDimCode[8]"; 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 = false; trigger OnValidate() begin Rec.ValidateShortcutDimCode(8, ShortcutDimCode[8]); end; } field("NewShortcutDimCode[8]"; NewShortcutDimCode[8]) { ApplicationArea = Dimensions; CaptionClass = Text006; Visible = false; trigger OnLookup(var Text: Text): Boolean begin Rec.LookupNewShortcutDimCode(8, NewShortcutDimCode[8]); end; trigger OnValidate() begin Rec.TestField("Entry Type", Rec."Entry Type"::Transfer); Rec.ValidateNewShortcutDimCode(8, NewShortcutDimCode[8]); end; } field("Location Code"; Rec."Location Code") { ApplicationArea = Location; Visible = true; trigger OnValidate() var WMSManagement: Codeunit "WMS Management"; begin WMSManagement.CheckItemJnlLineLocation(Rec, xRec); end; } field("Bin Code"; Rec."Bin Code") { ApplicationArea = Warehouse; Visible = false; } field("New Location Code"; Rec."New Location Code") { ApplicationArea = Location; Visible = false; trigger OnValidate() var WMSManagement: Codeunit "WMS Management"; begin WMSManagement.CheckItemJnlLineLocation(Rec, xRec); end; } field("New Bin Code"; Rec."New Bin Code") { ApplicationArea = Warehouse; Visible = false; } field("Salespers./Purch. Code"; Rec."Salespers./Purch. Code") { ApplicationArea = Basic, Suite; Visible = false; } field("Gen. Bus. Posting Group"; Rec."Gen. Bus. Posting Group") { ApplicationArea = Suite; Visible = false; } field("Gen. Prod. Posting Group"; Rec."Gen. Prod. Posting Group") { ApplicationArea = Suite; Visible = false; } field(Quantity; Rec.Quantity) { ApplicationArea = Suite; ToolTip = 'Specifies the number of units of the item specified on the line.'; } field("Unit of Measure Code"; Rec."Unit of Measure Code") { ApplicationArea = Suite; } field("Unit Amount"; Rec."Unit Amount") { ApplicationArea = Suite; } field(Amount; Rec.Amount) { ApplicationArea = Suite; } field("Indirect Cost %"; Rec."Indirect Cost %") { ApplicationArea = Basic, Suite; Visible = false; } field("Unit Cost"; Rec."Unit Cost") { ApplicationArea = Suite; } field("Applies-to Entry"; Rec."Applies-to Entry") { ApplicationArea = Suite; } field("Transaction Type"; Rec."Transaction Type") { ApplicationArea = BasicEU, BasicNO; Visible = false; } field("Transport Method"; Rec."Transport Method") { ApplicationArea = BasicEU, BasicNO; Visible = false; } field("Country/Region Code"; Rec."Country/Region Code") { ApplicationArea = Basic, Suite; Visible = false; } field("Reason Code"; Rec."Reason Code") { ApplicationArea = Suite; Visible = false; } field("Expiration Date"; Rec."Expiration Date") { ApplicationArea = Suite; } } group(Control26) { ShowCaption = false; fixed(Control1902454601) { ShowCaption = false; group("Item Description") { Caption = 'Item Description'; field(ItemDescription; ItemDescription) { ApplicationArea = Suite; Editable = false; ShowCaption = false; ToolTip = 'Specifies a description of the item.'; } } } } } 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; } 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; } action("Bin Contents") { ApplicationArea = Warehouse; Caption = 'Bin Contents'; Image = BinContent; RunObject = Page "Bin Contents List"; RunPageLink = "Location Code" = field("Location Code"), "Item No." = field("Item No."), "Variant Code" = field("Variant Code"); RunPageView = sorting("Location Code", "Bin Code", "Item No.", "Variant Code"); ToolTip = 'View items in the bin if the selected line contains a bin code.'; } } group("&Item") { Caption = '&Item'; Image = Item; action(Card) { ApplicationArea = Suite; Caption = 'Card'; Image = EditLines; RunObject = Page "Item Card"; RunPageLink = "No." = field("Item No."); ShortCutKey = 'Shift+F7'; ToolTip = 'View or change detailed information about the record on the document or journal line.'; } action("Ledger E&ntries") { ApplicationArea = Suite; Caption = 'Ledger E&ntries'; Image = ItemLedger; //The property 'PromotedCategory' can only be set if the property 'Promoted' is set to 'true' //PromotedCategory = Process; RunObject = Page "Item Ledger Entries"; RunPageLink = "Item No." = field("Item No."); RunPageView = sorting("Item No."); ShortCutKey = 'Ctrl+F7'; ToolTip = 'View the history of transactions that have been posted for the selected record.'; } group("Item Availability by") { Caption = 'Item Availability by'; Image = ItemAvailability; action("Event") { ApplicationArea = Suite; Caption = 'Event'; Image = "Event"; ToolTip = 'View how the actual and the projected available balance of an item will develop over time according to supply and demand events.'; trigger OnAction() begin ItemAvailFormsMgt.ShowItemAvailabilityFromItemJnlLine(Rec, "Item Availability Type"::"Event") end; } action(Period) { ApplicationArea = Suite; Caption = 'Period'; Image = Period; ToolTip = 'Show the projected quantity of the item over time according to time periods, such as day, week, or month.'; trigger OnAction() begin ItemAvailFormsMgt.ShowItemAvailabilityFromItemJnlLine(Rec, "Item Availability Type"::Period) end; } action(Variant) { ApplicationArea = Planning; Caption = 'Variant'; Image = ItemVariant; ToolTip = 'View or edit the item''s variants. Instead of setting up each color of an item as a separate item, you can set up the various colors as variants of the item.'; trigger OnAction() begin ItemAvailFormsMgt.ShowItemAvailabilityFromItemJnlLine(Rec, "Item Availability Type"::Variant) end; } action(Location) { AccessByPermission = TableData Location = R; ApplicationArea = Basic, Suite; Caption = 'Location'; Image = Warehouse; ToolTip = 'View the actual and projected quantity of the item per location.'; trigger OnAction() begin ItemAvailFormsMgt.ShowItemAvailabilityFromItemJnlLine(Rec, "Item Availability Type"::Location) end; } action(Lot) { ApplicationArea = ItemTracking; Caption = 'Lot'; Image = LotInfo; RunObject = Page "Item Availability by Lot No."; RunPageLink = "No." = field("No."), "Location Filter" = field("Location Code"), "Variant Filter" = field("Variant Code"); ToolTip = 'View the current and projected quantity of the item in each lot.'; } action("BOM Level") { AccessByPermission = TableData "BOM Buffer" = R; ApplicationArea = Assembly; Caption = 'BOM Level'; Image = BOMLevel; ToolTip = 'View availability figures for items on bills of materials that show how many units of a parent item you can make based on the availability of child items.'; trigger OnAction() begin ItemAvailFormsMgt.ShowItemAvailabilityFromItemJnlLine(Rec, "Item Availability Type"::BOM) end; } } } } area(processing) { group("F&unctions") { Caption = 'F&unctions'; Image = "Action"; action("E&xplode BOM") { AccessByPermission = TableData "BOM Component" = R; ApplicationArea = Assembly; Caption = 'E&xplode BOM'; Image = ExplodeBOM; RunObject = Codeunit "Item Jnl.-Explode BOM"; ToolTip = 'Insert new lines for the components on the bill of materials, for example to sell the parent item as a kit. CAUTION: The line for the parent item will be deleted and represented by a description only. To undo, you must delete the component lines and add a line the parent item again.'; } } group("P&osting") { Caption = 'P&osting'; Image = Post; action("Test Report") { ApplicationArea = Suite; 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 = Suite; Caption = 'P&ost'; Image = PostOrder; RunObject = Codeunit "Item Jnl.-Post"; ShortCutKey = 'F9'; ToolTip = 'Finalize the document or journal by posting the amounts and quantities to the related accounts in your company books.'; } action("Post and &Print") { ApplicationArea = Suite; Caption = 'Post and &Print'; Image = PostPrint; RunObject = Codeunit "Item Jnl.-Post+Print"; 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.'; } } action("&Print") { ApplicationArea = Suite; Caption = '&Print'; Ellipsis = true; Image = Print; ToolTip = 'Prepare to print the document. The report request window for the document opens where you can specify what to include on the print-out.'; trigger OnAction() var ItemJnlLine: Record "Item Journal Line"; begin ItemJnlLine.Copy(Rec); ItemJnlLine.SetRange("Journal Template Name", Rec."Journal Template Name"); ItemJnlLine.SetRange("Journal Batch Name", Rec."Journal Batch Name"); REPORT.RunModal(Report::"Inventory Movement", true, true, ItemJnlLine); end; } } area(Promoted) { group(Category_Process) { Caption = 'Process'; actionref("&Print_Promoted"; "&Print") { } group(Category_Posting) { Caption = 'Posting'; ShowAs = SplitButton; actionref("P&ost_Promoted"; "P&ost") { } actionref("Post and &Print_Promoted"; "Post and &Print") { } } } group(Category_Line) { Caption = 'Line'; actionref("Item &Tracking Lines_Promoted"; "Item &Tracking Lines") { } actionref(Dimensions_Promoted; Dimensions) { } actionref("Bin Contents_Promoted"; "Bin Contents") { } } } } trigger OnAfterGetCurrRecord() begin ItemJnlMgt.GetItem(Rec."Item No.", ItemDescription); EntryType := Rec."Entry Type"; end; trigger OnAfterGetRecord() begin Rec.ShowShortcutDimCode(ShortcutDimCode); Rec.ShowNewShortcutDimCode(NewShortcutDimCode); EntryType := Rec."Entry Type"; end; trigger OnDeleteRecord(): Boolean var ItemJnlLineReserve: Codeunit "Item Jnl. Line-Reserve"; begin Commit(); if not ItemJnlLineReserve.DeleteLineConfirm(Rec) then exit(false); ItemJnlLineReserve.DeleteLine(Rec); end; trigger OnInsertRecord(BelowxRec: Boolean): Boolean begin CheckEntryType(); end; trigger OnNewRecord(BelowxRec: Boolean) begin Rec.SetUpNewLine(xRec); Clear(ShortcutDimCode); Clear(NewShortcutDimCode); end; trigger OnOpenPage() var JnlSelected: Boolean; begin if Rec.IsOpenedFromBatch() then begin CurrentJnlBatchName := Rec."Journal Batch Name"; ItemJnlMgt.OpenJnl(CurrentJnlBatchName, Rec); exit; end; ItemJnlMgt.TemplateSelection(PAGE::"Recurring Item Jnl.", 0, true, Rec, JnlSelected); if not JnlSelected then Error(''); ItemJnlMgt.OpenJnl(CurrentJnlBatchName, Rec); end; var EntryTypeErr: Label 'You cannot use entry type %1 in this journal.', Comment = '%1 - Entry Type';#pragma warning disable AA0074 Text001: Label '1,2,3,New '; Text002: Label '1,2,4,New '; Text003: Label '1,2,5,New '; Text004: Label '1,2,6,New '; Text005: Label '1,2,7,New '; Text006: Label '1,2,8,New ';#pragma warning restore AA0074 ItemJnlMgt: Codeunit ItemJnlManagement; ReportPrint: Codeunit "Test Report-Print"; ItemAvailFormsMgt: Codeunit "Item Availability Forms Mgt"; ItemDescription: Text[100]; protected var EntryType: Enum "Item Journal Entry Type"; ShortcutDimCode: array[8] of Code[20]; NewShortcutDimCode: array[8] of Code[20]; CurrentJnlBatchName: Code[10]; local procedure CurrentJnlBatchNameOnAfterVali() begin CurrPage.SaveRecord(); ItemJnlMgt.SetName(CurrentJnlBatchName, Rec); CurrPage.Update(false); end; procedure ItemNoOnAfterValidate(); begin ItemJnlMgt.GetItem(Rec."Item No.", ItemDescription); Rec.ShowShortcutDimCode(ShortcutDimCode); end; local procedure CheckEntryType() begin if Rec."Entry Type".AsInteger() > Rec."Entry Type"::"Negative Adjmt.".AsInteger() then Error(EntryTypeErr, Rec."Entry Type"); end; [IntegrationEvent(false, false)] local procedure OnReferenceNoOnAfterLookup(var ItemJournalLine: Record "Item Journal Line") begin end;}