ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Table 5870 - "BOM Buffer" - OnBeforeCalcOvhdCost

Open UIBKH opened this issue 3 years ago • 1 comments

Dear Support,

We would like to add a new event OnBeforeCalcOvhdCost in the following Procedure below, using the IsHandled pattern. This would allow us to further customize the code and migrate existing customizations.

procedure CalcOvhdCost()
var
    Item: Record Item;
    UOMMgt: Codeunit "Unit of Measure Management";
    LotSize: Decimal;
    IsHandled: Boolean;  //New  Code --++
begin
    //New  Code --
    IsHandled := false;
    OnBeforeCalcOvhdCost(Rec, IsHandled);
    if IsHandled then
    exit;
    //New  Code ++
    LotSize := 1;
    if "Lot Size" <> 0 then
        LotSize := "Lot Size";

    Item.Get("No.");

    "Overhead Rate" :=
      RoundUnitAmt("Overhead Rate", UOMMgt.GetQtyPerUnitOfMeasure(Item, "Unit of Measure Code") * "Qty. per Top Item");

    "Single-Level Mfg. Ovhd Cost" +=
      (("Single-Level Material Cost" +
        "Single-Level Capacity Cost" +
        "Single-Level Subcontrd. Cost" +
        "Single-Level Cap. Ovhd Cost") *
       "Indirect Cost %" / 100) +
      ("Overhead Rate" * LotSize);
    "Single-Level Mfg. Ovhd Cost" := RoundUnitAmt("Single-Level Mfg. Ovhd Cost", 1);

    "Rolled-up Mfg. Ovhd Cost" +=
      (("Rolled-up Material Cost" +
        "Rolled-up Capacity Cost" +
        "Rolled-up Subcontracted Cost" +
        "Rolled-up Capacity Ovhd. Cost" +
        "Rolled-up Mfg. Ovhd Cost") *
       "Indirect Cost %" / 100) +
      ("Overhead Rate" * LotSize);
    "Rolled-up Mfg. Ovhd Cost" := RoundUnitAmt("Rolled-up Mfg. Ovhd Cost", 1);
end;

Event Signature:

[IntegrationEvent(false, false)]
local procedure OnBeforeCalcOvhdCost(var BOMBuffer: Record "BOM Buffer"; var IsHandled: Boolean)
begin
end;

UIBKH avatar Jan 31 '23 10:01 UIBKH

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Build ID: 53020.

JesperSchulz avatar Feb 08 '23 07:02 JesperSchulz