Skip to content

[Event Request] codeunit 5870 "Calculate BOM Tree" #30206

Description

@Simon110394

Why do you need this change?

We need a way to calculate DueDate differently.
At the moment there are no other available events to do that. It is necessary to include the event as last line of the procedure in order to be able to overwrite the already calculate DueDate.

Describe the request

In procedure CalcCompDueDate of codeunit 5870 "Calculate BOM Tree" we need an event:

[IntegrationEvent(false, false)]
local procedure OnAfterCalcCompDueDate(var DueDate: Date; DemandDate: Date; ParentItem: Record Item; LeadTimeOffset: DateFormula)
begin
end;

Changes between **:

procedure CalcCompDueDate(DemandDate: Date; ParentItem: Record Item; LeadTimeOffset: DateFormula) DueDate: Date
    var
        InventorySetup: Record "Inventory Setup";
        EndDate: Date;
        StartDate: Date;
    begin
        if DemandDate = 0D then
            exit;

        EndDate := DemandDate;
        if Format(ParentItem."Safety Lead Time") <> '' then
            EndDate := DemandDate - (CalcDate(ParentItem."Safety Lead Time", DemandDate) - DemandDate)
        else
            if InventorySetup.Get() and (Format(InventorySetup."Default Safety Lead Time") <> '') then
                EndDate := DemandDate - (CalcDate(InventorySetup."Default Safety Lead Time", DemandDate) - DemandDate);

        if Format(ParentItem."Lead Time Calculation") = '' then
            StartDate := EndDate
        else
            StartDate := EndDate - (CalcDate(ParentItem."Lead Time Calculation", EndDate) - EndDate);

        if Format(LeadTimeOffset) = '' then
            DueDate := StartDate
        else
            DueDate := StartDate - (CalcDate(LeadTimeOffset, StartDate) - StartDate);

        **OnAfterCalcCompDueDate(DueDate, DemandDate, ParentItem, LeadTimeOffset);**
    end;

Internal work item: AB#640604

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaevent-requestRequest for adding an event

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions