You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In table 36 Sales Header, GetQtyReservedFromStockState, we would like to exclude certain sales lines that will never have reservations from the 'outstanding qty' calculation used by the 'reserved from stock' calculation.
Suggestion 1
#region GetQtyReservedFromStockState
internal procedure GetQtyReservedFromStockState() Result: Enum "Reservation From Stock"
var
SalesLineLocal: Record "Sales Line";
QtyReservedFromStock: Decimal;
begin
QtyReservedFromStock := SalesLineReserve.GetReservedQtyFromInventory(Rec);
SalesLineLocal.SetRange("Document Type", "Document Type");
SalesLineLocal.SetRange("Document No.", "No.");
SalesLineLocal.SetRange(Type, SalesLineLocal.Type::Item);
OnBeforeGetQtyReservedFromStockState(SalesLineLocal); // Added publisher here
SalesLineLocal.CalcSums("Outstanding Qty. (Base)");
case QtyReservedFromStock of
0:
exit(Result::None);
SalesLineLocal."Outstanding Qty. (Base)":
exit(Result::Full);
else
exit(Result::Partial);
end;
end;
#endregion GetQtyReservedFromStockState
[IntegrationEvent(false, false)]
local procedure OnGetQtyReservedFromStockStateOnSetSalesLineFilters(var SalesLine: Record "Sales Line")
begin
end;
Suggestion 2 (Prefered)
#region GetQtyReservedFromStockState
internal procedure GetQtyReservedFromStockState() Result: Enum "Reservation From Stock"
begin
case SalesLineReserve.GetReservedQtyFromInventory(Rec) of
0:
exit(Result::None);
GetOutstandingQuantity(): // Move inside case = less reduncant calls if no reservations at all
exit(Result::Full);
else
exit(Result::Partial);
end;
end;
#endregion GetQtyReservedFromStockState
#region GetOutstandingQuantity
local procedure GetOutstandingQuantity() : Decimal
var
SalesLineLocal: Record "Sales Line";
begin
// Move to separate function, cleaner signature together with OnBefore publisher
OnBeforeGetOutstandingQuantity(SalesLineLocal);
SalesLineLocal.SetRange("Document Type", "Document Type");
SalesLineLocal.SetRange("Document No.", "No.");
SalesLineLocal.SetRange(Type, SalesLineLocal.Type::Item);
SalesLineLocal.CalcSums("Outstanding Qty. (Base)");
exit(SalesLineLocal."Outstanding Qty. (Base)");
end;
#endregion GetOutstandingQuantity
[IntegrationEvent(false, false)]
local procedure OnGetQtyReservedFromStockStateOnSetSalesLineFilters(var SalesLine: Record "Sales Line")
begin
end;
Describe the request
In table 36 Sales Header, GetQtyReservedFromStockState, we would like to exclude certain sales lines that will never have reservations from the 'outstanding qty' calculation used by the 'reserved from stock' calculation.
Suggestion 1
Suggestion 2 (Prefered)
Additional context
x
Internal work item: AB#558149
The text was updated successfully, but these errors were encountered: