ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] codeunit 5750 "Whse.-Create Source Document" OnFromSalesLine2ShptLineOnBeforeCreateATOShipmentLine

Open JeremyOrgan-DC opened this issue 4 years ago • 1 comments

Please could we have OnFromSalesLine2ShptLineOnBeforeCreateATOShipmentLine event added to allow the updating of ATOWhseShptLineQtyBase and ATOWhseShptLineQty

procedure FromSalesLine2ShptLine(WhseShptHeader: Record "Warehouse Shipment Header"; SalesLine: Record "Sales Line") Result: Boolean var AsmHeader: Record "Assembly Header"; TotalOutstandingWhseShptQty: Decimal; TotalOutstandingWhseShptQtyBase: Decimal; ATOWhseShptLineQty: Decimal; ATOWhseShptLineQtyBase: Decimal; IsHandled: Boolean; begin IsHandled := false; OnBeforeFromSalesLine2ShptLine(SalesLine, Result, IsHandled); if IsHandled then exit(Result);

    SalesLine.CalcFields("Whse. Outstanding Qty.", "ATO Whse. Outstanding Qty.",
      "Whse. Outstanding Qty. (Base)", "ATO Whse. Outstd. Qty. (Base)");
    TotalOutstandingWhseShptQty := Abs(SalesLine."Outstanding Quantity") - SalesLine."Whse. Outstanding Qty.";
    TotalOutstandingWhseShptQtyBase := Abs(SalesLine."Outstanding Qty. (Base)") - SalesLine."Whse. Outstanding Qty. (Base)";
    if SalesLine.AsmToOrderExists(AsmHeader) then begin
        ATOWhseShptLineQty := AsmHeader."Remaining Quantity" - SalesLine."ATO Whse. Outstanding Qty.";
        ATOWhseShptLineQtyBase := AsmHeader."Remaining Quantity (Base)" - SalesLine."ATO Whse. Outstd. Qty. (Base)";
        OnFromSalesLine2ShptLineOnBeforeCreateATOShipmentLine(
          WhseShptHeader, AsmHeader, SalesLine, ATOWhseShptLineQty, ATOWhseShptLineQtyBase );
        if ATOWhseShptLineQtyBase > 0 then begin
            if not CreateShptLineFromSalesLine(WhseShptHeader, SalesLine, ATOWhseShptLineQty, ATOWhseShptLineQtyBase, true) then
                exit(false);
            TotalOutstandingWhseShptQty -= ATOWhseShptLineQty;
            TotalOutstandingWhseShptQtyBase -= ATOWhseShptLineQtyBase;
        end;
    end;

    OnFromSalesLine2ShptLineOnBeforeCreateShipmentLine(
      WhseShptHeader, SalesLine, TotalOutstandingWhseShptQty, TotalOutstandingWhseShptQtyBase);

    if TotalOutstandingWhseShptQtyBase > 0 then
        exit(CreateShptLineFromSalesLine(WhseShptHeader, SalesLine, TotalOutstandingWhseShptQty, TotalOutstandingWhseShptQtyBase, false));
    exit(true);
end;

[IntegrationEvent(false, false)]
local procedure OnFromSalesLine2ShptLineOnBeforeCreateATOShipmentLine(WarehouseShipmentHeader: Record "Warehouse Shipment Header";  AsmHeader: Record "Assembly Header"; SalesLine: Record "Sales Line"; var ATOWhseShptLineQty: Decimal; var ATOWhseShptLineQtyBase : Decimal)
begin
end;

JeremyOrgan-DC avatar Jun 07 '22 13:06 JeremyOrgan-DC

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

JesperSchulz avatar Jul 07 '22 12:07 JesperSchulz