Page 6565 Invt. Shipment Subform, source in 29
Source29
src/Layers/W1/BaseApp/Inventory/Document/InvtShipmentSubform.Page.al442 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.Document;
using Microsoft.Finance.Dimension;
using Microsoft.Inventory.Availability;
using Microsoft.Inventory.Item.Catalog;
using Microsoft.Inventory.Setup;
page 6565 "Invt. Shipment Subform"
{
AutoSplitKey = true;
Caption = 'Lines';
DelayedInsert = true;
LinksAllowed = false;
MultipleNewLines = true;
PageType = ListPart;
SourceTable = "Invt. Document Line";
layout
{
area(content)
{
repeater(Control1)
{
ShowCaption = false;
field("Item No."; Rec."Item No.")
{
ApplicationArea = Basic, Suite;
trigger OnValidate()
begin
Rec.ShowShortcutDimCode(ShortcutDimCode);
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.InvtDocumentReferenceNoLookup(Rec);
Rec.ShowShortcutDimCode(ShortcutDimCode);
end;
trigger OnValidate()
begin
Rec.ShowShortcutDimCode(ShortcutDimCode);
end;
}
field("Variant Code"; Rec."Variant Code")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Bin Code"; Rec."Bin Code")
{
ApplicationArea = Warehouse;
Visible = false;
}
field(Description; Rec.Description)
{
ApplicationArea = Basic, Suite;
}
field(Quantity; Rec.Quantity)
{
ApplicationArea = Basic, Suite;
BlankZero = true;
}
field("Reason Code"; Rec."Reason Code")
{
ApplicationArea = Basic, Suite;
}
field("Reserved Quantity Outbnd."; Rec."Reserved Quantity Outbnd.")
{
ApplicationArea = Basic, Suite;
Visible = ReserveVisible;
}
field("Unit Cost"; Rec."Unit Cost")
{
ApplicationArea = Basic, Suite;
}
field("Unit Amount"; Rec."Unit Amount")
{
ApplicationArea = Basic, Suite;
}
field(Amount; Rec.Amount)
{
ApplicationArea = Basic, Suite;
}
field("Unit of Measure Code"; Rec."Unit of Measure Code")
{
ApplicationArea = Basic, Suite;
}
field("Shortcut Dimension 1 Code"; Rec."Shortcut Dimension 1 Code")
{
ApplicationArea = Dimensions;
Visible = DimVisible1;
}
field("Shortcut Dimension 2 Code"; Rec."Shortcut Dimension 2 Code")
{
ApplicationArea = Dimensions;
Visible = DimVisible2;
}
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));
ToolTip = 'Specifies the code for Shortcut Dimension 3';
Visible = DimVisible3;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(3, ShortcutDimCode[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));
ToolTip = 'Specifies the code for Shortcut Dimension 4';
Visible = DimVisible4;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(4, ShortcutDimCode[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));
ToolTip = 'Specifies the code for Shortcut Dimension 5';
Visible = DimVisible5;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(5, ShortcutDimCode[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));
ToolTip = 'Specifies the code for Shortcut Dimension 6';
Visible = DimVisible6;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(6, ShortcutDimCode[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));
ToolTip = 'Specifies the code for Shortcut Dimension 7';
Visible = DimVisible7;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(7, ShortcutDimCode[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));
ToolTip = 'Specifies the code for Shortcut Dimension 8';
Visible = DimVisible8;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(8, ShortcutDimCode[8]);
end;
}
field("Applies-to Entry"; Rec."Applies-to Entry")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
field("Applies-from Entry"; Rec."Applies-from Entry")
{
ApplicationArea = Basic, Suite;
Visible = false;
}
}
}
}
actions
{
area(processing)
{
group("F&unctions")
{
Caption = 'F&unctions';
Image = "Action";
action("&Reserve")
{
ApplicationArea = Basic, Suite;
Caption = '&Reserve';
Image = Reserve;
ToolTip = 'Specifies whether a reservation can be made for items on this line.';
Visible = ReserveVisible;
trigger OnAction()
begin
Rec.ShowReservation();
end;
}
action("Reserve from &Inventory")
{
ApplicationArea = Basic, Suite;
Caption = 'Reserve from &Inventory';
Image = ItemReservation;
ToolTip = 'Reserve items for the selected line from inventory.';
trigger OnAction()
begin
ReserveSelectedLines();
end;
}
}
group("&Line")
{
Caption = '&Line';
Image = Line;
group("Item Availability by")
{
Caption = 'Item Availability by';
Image = Timeline;
action("Event")
{
ApplicationArea = Basic, 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.ShowItemAvailabilityFromInvtDocLine(Rec, "Item Availability Type"::"Event");
end;
}
action(Period)
{
ApplicationArea = Basic, 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.ShowItemAvailabilityFromInvtDocLine(Rec, "Item Availability Type"::Period);
end;
}
action(Variant)
{
ApplicationArea = Basic, Suite;
Caption = 'Variant';
Image = ItemVariant;
ToolTip = 'View the actual and projected quantity of the item per variant.';
trigger OnAction()
begin
ItemAvailFormsMgt.ShowItemAvailabilityFromInvtDocLine(Rec, "Item Availability Type"::Variant);
end;
}
action(Location)
{
ApplicationArea = Basic, Suite;
Caption = 'Location';
Image = Warehouse;
ToolTip = 'View the actual and projected quantity of the item per location.';
trigger OnAction()
begin
ItemAvailFormsMgt.ShowItemAvailabilityFromInvtDocLine(Rec, "Item Availability Type"::Location);
end;
}
action(Lot)
{
ApplicationArea = ItemTracking;
Caption = 'Lot';
Image = LotInfo;
RunObject = Page "Item Availability by Lot No.";
RunPageLink = "No." = field("Item 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")
{
ApplicationArea = Basic, Suite;
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.ShowItemAvailabilityFromInvtDocLine(Rec, "Item Availability Type"::BOM);
end;
}
}
action(Dimensions)
{
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();
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();
end;
}
}
}
}
trigger OnAfterGetRecord()
begin
Rec.ShowShortcutDimCode(ShortcutDimCode);
end;
trigger OnDeleteRecord(): Boolean
var
InvtDocLineReserve: Codeunit "Invt. Doc. Line-Reserve";
begin
if (Rec.Quantity <> 0) then begin
Commit();
if not InvtDocLineReserve.DeleteLineConfirm(Rec) then
exit(false);
InvtDocLineReserve.DeleteLine(Rec);
end;
end;
trigger OnNewRecord(BelowxRec: Boolean)
begin
Clear(ShortcutDimCode);
end;
trigger OnOpenPage()
begin
SetDimensionsVisibility();
SetReservationVisibility();
end;
var
DimMgt: Codeunit DimensionManagement;
ItemAvailFormsMgt: Codeunit "Item Availability Forms Mgt";
protected var
ShortcutDimCode: array[8] of Code[20];
DimVisible1: Boolean;
DimVisible2: Boolean;
DimVisible3: Boolean;
DimVisible4: Boolean;
DimVisible5: Boolean;
DimVisible6: Boolean;
DimVisible7: Boolean;
DimVisible8: Boolean;
ReserveVisible: Boolean;
local procedure SetDimensionsVisibility()
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 SetReservationVisibility()
var
InventorySetup: Record "Inventory Setup";
begin
InventorySetup.Get();
ReserveVisible := InventorySetup."Allow Invt. Doc. Reservation";
end;
procedure UpdateForm(SetSaveRecord: Boolean)
begin
CurrPage.Update(SetSaveRecord);
end;
procedure ReserveSelectedLines()
var
InvtDocLine: Record "Invt. Document Line";
begin
CurrPage.SetSelectionFilter(InvtDocLine);
Rec.ReserveFromInventory(InvtDocLine);
end;
}