Skip to content

KVSTRD Item Replacement Mgt.#

Procedures#

CalculateAvailableQuantity(Code[50], Code[10], Code[10], Code[10], Date) : Decimal#

Summary: Calculates the available quantity of an item based on various parameters such as item number, variant code, unit of measure code, location code, and availability date.

procedure CalculateAvailableQuantity(ItemNo: Code[50]; VariantCode: Code[10]; ItemUoMCode: Code[10]; LocationCode: Code[10]; AvailabilityDate: Date): Decimal

Parameters:

  • ItemNo: The item number to check availability for.
  • VariantCode: The variant code of the item.
  • ItemUoMCode: The unit of measure code for the item.
  • LocationCode: The location code where the item is stored.
  • AvailabilityDate: The date to check availability up to. If not provided, the work date is used.

Returns: The available quantity of the item in the specified unit of measure.

CalculateQuantityFactor(Record Sales Line) : Decimal#

Summary: Calculates the quantity factor for a given sales line based on the unit of measure.

procedure CalculateQuantityFactor(var SalesLine: Record "Sales Line"): Decimal

Parameters:

  • SalesLine: The sales line record for which the quantity factor is to be calculated.

Returns: A decimal value representing the quantity factor.

CheckForItemReplacement(Record Sales Line) : Boolean#

Summary: Checks if an item replacement is needed for the given sales line.

procedure CheckForItemReplacement(var SalesLine: Record "Sales Line"): Boolean

Parameters:

  • SalesLine: The sales line record to check for item replacement.

Returns: True if item replacement is needed, otherwise false.

InsertItemReplacementSalesLine(Record KVSTRD Item Replacement Line, Record Sales Line, Decimal) :#

Summary: Inserts a new item replacement sales line based on the provided item replacement line and sales line.

procedure InsertItemReplacementSalesLine(var ItemReplacementLine: Record "KVSTRD Item Replacement Line"; var SalesLine: Record "Sales Line"; Quantity: Decimal): 

Parameters:

  • ItemReplacementLine: The record of the item replacement line to be inserted.
  • SalesLine: The record of the sales line where the item replacement line will be inserted.
  • Quantity: The quantity of the item replacement line to be inserted.

ShowItemReplacementMethods(Record Sales Line) :#

Summary: Displays a menu to choose an item replacement method for the given sales line.

procedure ShowItemReplacementMethods(var SalesLine: Record "Sales Line"): 

Parameters:

  • SalesLine: The sales line record for which the item replacement methods are to be shown.

UseAvailableQuantitiesOfTheItemAndThenUseReplacements(Record Sales Line) :#

Summary: This procedure adjusts the quantity of a sales line by using available quantities of the item and its replacements. It first checks the available quantity of the item and adjusts the sales line quantity accordingly. If the available quantity is insufficient, it iterates through the item replacements and uses their available quantities to fulfill the remaining quantity needed. If there are still remaining quantities after using all replacements, it uses the last replacement to fulfill the remaining quantity.

procedure UseAvailableQuantitiesOfTheItemAndThenUseReplacements(var SalesLine: Record "Sales Line"): 

Parameters:

  • SalesLine: The sales line record to be adjusted.

UseOnlyTheAvailableQuantitiesOfTheItem(Record Sales Line) :#

Summary: Adjusts the quantity of the sales line to only use the available quantities of the item.

procedure UseOnlyTheAvailableQuantitiesOfTheItem(var SalesLine: Record "Sales Line"): 

Parameters:

  • SalesLine: The sales line record to be adjusted.

UseReplacementWithEnteredQuantity(Record Sales Line) :#

Summary: Replaces the item in the given Sales Line with a replacement item and adjusts the quantity based on the replacement item's quantity and a calculated quantity factor.

procedure UseReplacementWithEnteredQuantity(var SalesLine: Record "Sales Line"): 

Parameters:

  • SalesLine: The Sales Line record to be updated with the replacement item and quantity.

Events#

KVSTRDOnBeforeShowItemReplacementMethodsStrMenu(Record Sales Line, Integer, Boolean, Boolean) :#

Summary: This integration event is triggered before showing the item replacement methods string menu.

[IntegrationEvent(false, false)]
local procedure KVSTRDOnBeforeShowItemReplacementMethodsStrMenu(var SalesLine: Record "Sales Line"; var ItemReplacementMethod: Integer; var DoNotShowStrMenu: Boolean; var IsHandled: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSTRD Item Replacement Mgt.", 'KVSTRDOnBeforeShowItemReplacementMethodsStrMenu', '', false, false)]
local procedure DoSomethingKVSTRDOnBeforeShowItemReplacementMethodsStrMenu(var SalesLine: Record "Sales Line"; var ItemReplacementMethod: Integer; var DoNotShowStrMenu: Boolean; var IsHandled: Boolean)
begin
end;

Parameters:

  • SalesLine: The sales line record.
  • ItemReplacementMethod: The item replacement method identifier.
  • DoNotShowStrMenu: A boolean flag indicating whether to show the string menu or not.
  • IsHandled: A boolean flag indicating whether the event has been handled.