Skip to content

[Event Request] codeunit 5895 "Inventory Adjustment" OnBeforeProcessTransValueEntry #29503

@AdeleStankeviciute

Description

@AdeleStankeviciute

Why do you need this change?

In 4PS Construct we add additional checks before recalculating value entry costs.

Describe the request

On behalf of 4PS, I would like to request crating new event OnBeforeProcessTransValueEntry in codeunit 5895 "Inventory Adjustment"

    local procedure CalcTransEntryOldCost(var CostElementBuf: Record "Cost Element Buffer"; var TransValueEntry: Record "Value Entry"; ItemLedgEntryNo: Integer)
    var
        TransValueEntry2: Record "Value Entry";
        ProcessTransValueEntry: Boolean;
    begin
        Clear(CostElementBuf);
        TransValueEntry2 := TransValueEntry;
        TransValueEntry.SetCurrentKey("Item Ledger Entry No.", "Entry Type");
        TransValueEntry.SetRange("Item Ledger Entry No.", ItemLedgEntryNo);
        TransValueEntry.SetRange("Entry Type", TransValueEntry."Entry Type"::"Direct Cost");
        TransValueEntry.Ascending(false);
        TransValueEntry.SetBaseLoadFields();
        TransValueEntry.FindSet();
        repeat
            ProcessTransValueEntry := TransValueEntry."Item Charge No." = '';
            OnBeforeProcessTransValueEntry(TransValueEntry, ProcessTransValueEntry);
            if ProcessTransValueEntry then begin
                if TempInvtAdjmtBuf.Get(TransValueEntry."Entry No.") then
                    TransValueEntry.AddCost(TempInvtAdjmtBuf);
                CostElementBuf."Actual Cost" := CostElementBuf."Actual Cost" + TransValueEntry."Cost Amount (Actual)";
                CostElementBuf."Actual Cost (ACY)" := CostElementBuf."Actual Cost (ACY)" + TransValueEntry."Cost Amount (Actual) (ACY)";
                TransValueEntry2 := TransValueEntry;
            end;
    [IntegrationEvent(false, false)]
    local procedure OnBeforeProcessTransValueEntry(var TransValueEntry: Record "Value Entry"; var ProcessTransValueEntry: Boolean)
    begin
    end;
Internal work item: [AB#615872](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/615872)

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaevent-requestRequest for adding an event

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions