Codeunit 99000799 Mfg. Posting Preview Handler

App
Base Application
Namespace
Microsoft.Finance.GeneralLedger.Preview
Versions
26-28

Procedures, 2

Versions171819202122232425262728

Source29

Source in 29

src/Layers/W1/BaseApp/Manufacturing/Finance/Preview/MfgPostingPreviewHandler.Codeunit.al42 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.Finance.GeneralLedger.Preview;

using Microsoft.Manufacturing.Capacity;

codeunit 99000799 "Mfg. Posting Preview Handler"
{
    EventSubscriberInstance = Manual;
    SingleInstance = true;

    var
        TempCapacityLedgerEntry: Record "Capacity Ledger Entry" temporary;

    [EventSubscriber(ObjectType::Table, Database::"Capacity Ledger Entry", 'OnAfterInsertEvent', '', true, false)]
    local procedure OnInsertCapacityLedgerEntry(var Rec: Record "Capacity Ledger Entry"; RunTrigger: Boolean)
    begin
        if Rec.IsTemporary() then
            exit;

        if TempCapacityLedgerEntry.Get(Rec."Entry No.") then
            exit;

        TempCapacityLedgerEntry := Rec;
        TempCapacityLedgerEntry."Document No." := '***';
        TempCapacityLedgerEntry.Insert();
    end;

    procedure DeleteAll()
    begin
        TempCapacityLedgerEntry.Reset();
        TempCapacityLedgerEntry.DeleteAll();
    end;

    procedure GetTempCapacityLedgerEntry(var OutTempCapacityLedgerEntry: Record "Capacity Ledger Entry" temporary)
    begin
        OutTempCapacityLedgerEntry.Copy(TempCapacityLedgerEntry, true);
    end;
}