Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Event Request] Codeunit 5896 "Calc. Inventory Adjmt. - Order" - Procedure CalcShareOfCapCost - OnBeforeCalcShareOfCapCost #28013

Closed
mavohra opened this issue Jan 29, 2025 · 1 comment
Assignees
Labels
event-request Request for adding an event SCM GitHub request for SCM area ships-in-future-update Fix ships in a future update

Comments

@mavohra
Copy link

mavohra commented Jan 29, 2025

Describe the request

Please add the event in OnBeforeCalcShareOfCapCost Procedure CalcShareOfCapCost in Codeunit 5896 "Calc. Inventory Adjmt. - Order"

local procedure CalcShareOfCapCost(InvtAdjmtEntryOrder: Record "Inventory Adjmt. Entry (Order)") ShareOfCapCost: Decimal
    var
        CapLedgEntry: Record "Capacity Ledger Entry";

    begin

        if InvtAdjmtEntryOrder."Order Type" = InvtAdjmtEntryOrder."Order Type"::Assembly then
            exit(1);

        OnBeforeCalcShareOfCapCost(InvtAdjmtEntryOrder); // <--- New Event

        CapLedgEntry.SetCurrentKey("Order Type", "Order No.");
        CapLedgEntry.SetRange("Order Type", InvtAdjmtEntryOrder."Order Type");
        CapLedgEntry.SetRange("Order No.", InvtAdjmtEntryOrder."Order No.");
        CapLedgEntry.SetRange("Order Line No.", InvtAdjmtEntryOrder."Order Line No.");
        CapLedgEntry.SetRange("Routing No.", InvtAdjmtEntryOrder."Routing No.");
        CapLedgEntry.SetRange("Routing Reference No.", InvtAdjmtEntryOrder."Routing Reference No.");
        CapLedgEntry.SetRange("Item No.", InvtAdjmtEntryOrder."Item No.");
        CapLedgEntry.CalcSums(CapLedgEntry."Output Quantity");
        ShareOfCapCost := CapLedgEntry."Output Quantity";

        if InvtAdjmtEntryOrder."Order Type" = InvtAdjmtEntryOrder."Order Type"::Production then
            CapLedgEntry.SetRange("Order Line No.");
        CapLedgEntry.CalcSums(CapLedgEntry."Output Quantity");
        if CapLedgEntry."Output Quantity" <> 0 then
            ShareOfCapCost := ShareOfCapCost / CapLedgEntry."Output Quantity"
        else
            ShareOfCapCost := 1;
    end;

[IntegrationEvent(false, false)]
    local procedure OnBeforeCalcShareOfCapCost(InvtAdjmtEntryOrder: Record "Inventory Adjmt. Entry (Order)")
    begin
    end;

Additional context

We need to add our customisation at the start of the procedure which would check for certain type of BOMOrder. and exit(1) from the procedure CalcShareOfCapCost if it's true.
Internal work item: AB#563989

@AndersLarsenMicrosoft AndersLarsenMicrosoft added event-request Request for adding an event SCM GitHub request for SCM area labels Jan 29, 2025
@alexei-dobriansky alexei-dobriansky self-assigned this Feb 7, 2025
@JesperSchulz JesperSchulz added the ships-in-future-update Fix ships in a future update label Feb 12, 2025
@JesperSchulz
Copy link
Contributor

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: 29982.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event-request Request for adding an event SCM GitHub request for SCM area ships-in-future-update Fix ships in a future update
Projects
None yet
Development

No branches or pull requests

4 participants