Page 8063 Assigned Items
src/Apps/W1/Subscription Billing/App/Service Commitments/Pages/AssignedItems.Page.al140 lines, Copyright (c) Microsoft Corporation. MIT
namespace Microsoft.SubscriptionBilling;using Microsoft.Inventory.Item;using System.Utilities;page 8063 "Assigned Items"{ Caption = 'Assigned Items'; PageType = List; SourceTable = "Item Subscription Package"; Editable = false; UsageCategory = None; ApplicationArea = All; layout { area(content) { repeater(General) { field("Item No."; Rec."Item No.") { ToolTip = 'Specifies the number of the item.'; } field(Description; Item.Description) { ToolTip = 'Specifies a description of the item.'; Caption = 'Description'; } field(BaseUnitOfMeasure; Item."Base Unit of Measure") { ToolTip = 'Specifies the base unit used to measure the item, such as piece, box, or pallet. The base unit of measure also serves as the conversion basis for alternate units of measure.'; Caption = 'Base Unit of Measure'; } field(UnitPrice; Item."Unit Price") { ToolTip = 'Specifies the price for one unit of the item, in LCY.'; Caption = 'Unit Price'; AutoFormatType = 2; AutoFormatExpression = ''; } } } } actions { area(Processing) { action(AssignItemsAction) { Caption = 'Assign New Items'; Image = NewItem; ToolTip = 'Assign new items to the Subscription Package.'; trigger OnAction() begin AssignItems(CopyStr(Rec.GetFilter(Code), 1, MaxStrLen(Rec.Code))); end; } action(RemoveItemsAction) { Caption = 'Remove Items'; Image = Delete; ToolTip = 'Removes the assignment of items to the Subscription Package.'; trigger OnAction() var ItemServCommitmentPackage: Record "Item Subscription Package"; begin CurrPage.SetSelectionFilter(ItemServCommitmentPackage); RemoveItems(ItemServCommitmentPackage); end; } } area(Promoted) { group(Category_Process) { Caption = 'Process'; actionref(AssignItemsAction_Promoted; AssignItemsAction) { } actionref(RemoveItemsAction_Promoted; RemoveItemsAction) { } } } } trigger OnAfterGetRecord() begin if not Item.Get(Rec."Item No.") then Item.Init(); end; var Item: Record Item; DeletionQst: Label 'Do you really want to delete assignment of the selected item(s)?'; internal procedure AssignItems(PackageCode: Code[20]) var Item2: Record Item; ItemServCommitmentPackage: Record "Item Subscription Package"; ContractsItemManagement: Codeunit "Sub. Contracts Item Management"; ItemList: Page "Item List"; begin Item2.SetRange("Subscription Option", Enum::"Item Service Commitment Type"::"Sales with Service Commitment", Enum::"Item Service Commitment Type"::"Service Commitment Item"); OnAssignItemsOnAfterItem2SetFilters(PackageCode, Item2); if Item2.FindSet() then repeat if not ItemServCommitmentPackage.Get(Item2."No.", PackageCode) then Item2.Mark(true); until Item2.Next() = 0; Item2.MarkedOnly(true); ItemList.SetTableView(Item2); ItemList.LookupMode(true); if ItemList.RunModal() = Action::LookupOK then begin Item2.SetFilter("No.", ItemList.GetSelectionFilter()); if Item2.FindSet() then repeat ContractsItemManagement.InsertItemServiceCommitmentPackage(Item2, PackageCode, false); until Item2.Next() = 0; end; end; internal procedure RemoveItems(var ItemServCommitmentPackage: Record "Item Subscription Package") var ConfirmManagement: Codeunit "Confirm Management"; begin if ConfirmManagement.GetResponse(DeletionQst, false) then ItemServCommitmentPackage.DeleteAll(false); end; [IntegrationEvent(false, false)] local procedure OnAssignItemsOnAfterItem2SetFilters(PackageCode: Code[20]; var Item2: Record Item) begin end;}