KVSKBAPriceCalcLowestPrice#
Procedures#
GetLine(Variant) :#
Summary: Retrieves the current line being processed.
procedure GetLine(var Line: Variant):
Parameters:
Line: Output variant containing the line record.
Remarks: Returns the line from the current LineWithPrice interface implementation. Used to access the underlying line record during price calculations.
Init(Interface Line With Price, Record Price Calculation Setup) :#
procedure Init(NewLineWithPrice: Interface "Line With Price"; PriceCalculationSetup: Record "Price Calculation Setup"):
ApplyDiscount() :#
Summary: Applies the best discount to the current line.
procedure ApplyDiscount():
Remarks: Checks read permissions for discount access tables. Only processes if discount is allowed on the line. Finds applicable discount lines and calculates the best discount. Handles KUMAVISION condition-based discounts for sales, service, and purchase lines. Updates the line with the calculated discount.
ApplyPrice(Integer) :#
Summary: Applies the best price to the current line.
procedure ApplyPrice(CalledByFieldNo: Integer):
Parameters:
CalledByFieldNo: The field number that triggered the price calculation.
Remarks: Checks read permissions for price access tables. Verifies the line before processing. Finds applicable price lines and calculates the best price. Handles KUMAVISION condition-based prices for sales, service, and purchase lines. Only updates the price if needed based on the calling field. Updates the line with the calculated price and validates it.
CountDiscount(Boolean) : Integer#
Summary: Counts the number of discount lines available for the current line.
procedure CountDiscount(ShowAll: Boolean): Integer
Parameters:
ShowAll: If true, shows all lines; if false, only shows applicable lines.
Returns: The number of discount lines found.
Remarks: Useful for determining if discount options are available before displaying them.
CountPrice(Boolean) : Integer#
Summary: Counts the number of price lines available for the current line.
procedure CountPrice(ShowAll: Boolean): Integer
Parameters:
ShowAll: If true, shows all lines; if false, only shows applicable lines.
Returns: The number of price lines found.
Remarks: Useful for determining if price options are available before displaying them.
FindDiscount(Record Price List Line, Boolean) : Boolean#
Summary: Finds all discount lines applicable to the current line.
procedure FindDiscount(var TempPriceListLine: Record "Price List Line"; ShowAll: Boolean): Boolean
Parameters:
TempPriceListLine: Temporary buffer to receive the found discount lines.ShowAll: If true, shows all lines; if false, only shows applicable lines.
Returns: True if discount lines were found, false otherwise.
Remarks: Populates the temporary price list line buffer with matching discount lines. Used for displaying discount options or analyzing available discounts.
FindPrice(Record Price List Line, Boolean) : Boolean#
Summary: Finds all price lines applicable to the current line.
procedure FindPrice(var TempPriceListLine: Record "Price List Line"; ShowAll: Boolean): Boolean
Parameters:
TempPriceListLine: Temporary buffer to receive the found price lines.ShowAll: If true, shows all lines; if false, only shows applicable lines.
Returns: True if price lines were found, false otherwise.
Remarks: Populates the temporary price list line buffer with matching price lines. Used for displaying price options or analyzing available prices.
IsDiscountExists(Boolean) : Boolean#
Summary: Checks if any discount lines exist for the current line.
procedure IsDiscountExists(ShowAll: Boolean): Boolean
Parameters:
ShowAll: If true, checks all lines; if false, only checks applicable lines.
Returns: True if discount lines exist, false otherwise.
Remarks: Quick check to determine discount availability without retrieving all lines.
IsPriceExists(Boolean) : Boolean#
Summary: Checks if any price lines exist for the current line.
procedure IsPriceExists(ShowAll: Boolean): Boolean
Parameters:
ShowAll: If true, checks all lines; if false, only checks applicable lines.
Returns: True if price lines exist, false otherwise.
Remarks: Quick check to determine price availability without retrieving all lines.
PickDiscount() :#
Summary: Opens a page to manually select a discount line.
procedure PickDiscount():
Remarks: Displays all applicable discount lines in a lookup page. Applies the selected discount to the current line. Handles KUMAVISION condition-based discounts. Validates the selected line before applying.
PickPrice() :#
Summary: Opens a page to manually select a price line.
procedure PickPrice():
Remarks: Displays all applicable price lines in a lookup page. Applies the selected price to the current line. Handles KUMAVISION condition-based prices. Validates the selected line before applying.
ShowPrices(Record Price List Line) :#
Summary: Displays price lines in a lookup page without selection.
procedure ShowPrices(var TempPriceListLine: Record "Price List Line"):
Parameters:
TempPriceListLine: Temporary buffer containing price lines to display.
Remarks: Opens the Get Price Line page for viewing only. Does not apply any selection to the current line. Useful for displaying price information without making changes. The OnBeforeShowPrices event allows customization before displaying.
IsBetterLine(Record Price List Line, Enum Price Amount Type, Record Price List Line) : Boolean#
procedure IsBetterLine(var PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"; BestPriceListLine: Record "Price List Line"): Boolean
FindLines(Enum Price Amount Type, Record Price List Line, Codeunit Price Calculation Buffer Mgt., Boolean) : Boolean#
procedure FindLines(AmountType: Enum "Price Amount Type"; var TempPriceListLine: Record "Price List Line" temporary; var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt."; ShowAll: Boolean): Boolean
CopyLinesBySource(Record Price List Line, Record Price Source, Codeunit Price Asset List, Record Price List Line) : Boolean#
procedure CopyLinesBySource(var PriceListLine: Record "Price List Line"; PriceSource: Record "Price Source"; var PriceAssetList: Codeunit "Price Asset List"; var TempPriceListLine: Record "Price List Line" temporary): Boolean
CopyLinesBySource(Record Price List Line, Record Price Source, Record Price Asset, Record Price List Line) : Boolean#
Summary: Copies price lines for a specific price source and asset combination.
procedure CopyLinesBySource(var PriceListLine: Record "Price List Line"; PriceSource: Record "Price Source"; PriceAsset: Record "Price Asset"; var TempPriceListLine: Record "Price List Line" temporary): Boolean
Parameters:
PriceListLine: The price list line record with filters applied.PriceSource: The price source to filter by.PriceAsset: The price asset to filter by.TempPriceListLine: Temporary buffer to receive copied lines.
Returns: True if any lines were found and copied, false otherwise.
Remarks: Applies both source and asset filters to find matching price lines. Copies all matching lines to the temporary buffer. Preserves the original filters after copying.
CalcBestAmount(Enum Price Amount Type, Codeunit Price Calculation Buffer Mgt., Record Price List Line) : Boolean#
procedure CalcBestAmount(AmountType: Enum "Price Amount Type"; var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt."; var PriceListLine: Record "Price List Line"): Boolean
Events#
OnAfterIsBetterLine(Record Price List Line, Enum Price Amount Type, Record Price List Line, Boolean) :#
[IntegrationEvent(true, false)]
local procedure OnAfterIsBetterLine(PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"; BestPriceListLine: Record "Price List Line"; var Result: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPriceCalcLowestPrice", 'OnAfterIsBetterLine', '', false, false)]
local procedure DoSomethingOnAfterIsBetterLine(PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"; BestPriceListLine: Record "Price List Line"; var Result: Boolean)
begin
end;
OnAfterIsDegradedLine(Record Price List Line, Record Price List Line, Boolean) :#
Summary: Integration event triggered after checking if a line is degraded compared to the best line.
[IntegrationEvent(true, false)]
local procedure OnAfterIsDegradedLine(PriceListLine: Record "Price List Line"; BestPriceListLine: Record "Price List Line"; var Result: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPriceCalcLowestPrice", 'OnAfterIsDegradedLine', '', false, false)]
local procedure DoSomethingOnAfterIsDegradedLine(PriceListLine: Record "Price List Line"; BestPriceListLine: Record "Price List Line"; var Result: Boolean)
begin
end;
Parameters:
PriceListLine: The price line being evaluated.BestPriceListLine: The current best line.Result: The degradation check result (can be modified).
Remarks: A line is degraded if it has blank values where the best line has values. Use this event to add custom degradation criteria.
OnAfterIsImprovedLine(Record Price List Line, Record Price List Line, Boolean) :#
Summary: Integration event triggered after checking if a line is improved compared to the best line.
[IntegrationEvent(true, false)]
local procedure OnAfterIsImprovedLine(PriceListLine: Record "Price List Line"; BestPriceListLine: Record "Price List Line"; var Result: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPriceCalcLowestPrice", 'OnAfterIsImprovedLine', '', false, false)]
local procedure DoSomethingOnAfterIsImprovedLine(PriceListLine: Record "Price List Line"; BestPriceListLine: Record "Price List Line"; var Result: Boolean)
begin
end;
Parameters:
PriceListLine: The price line being evaluated.BestPriceListLine: The current best line.Result: The improvement check result (can be modified).
Remarks: A line is improved if it has values where the best line has blank values. Use this event to add custom improvement criteria.
OnAfterPickBestLine(Enum Price Amount Type, Record Price List Line, Record Price List Line, Boolean) :#
[IntegrationEvent(false, false)]
local procedure OnAfterPickBestLine(AmountType: Enum "Price Amount Type"; PriceListLine: Record "Price List Line"; var BestPriceListLine: Record "Price List Line"; var FoundBestLine: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPriceCalcLowestPrice", 'OnAfterPickBestLine', '', false, false)]
local procedure DoSomethingOnAfterPickBestLine(AmountType: Enum "Price Amount Type"; PriceListLine: Record "Price List Line"; var BestPriceListLine: Record "Price List Line"; var FoundBestLine: Boolean)
begin
end;
OnBeforeFindLines(Enum Price Amount Type, Record Price List Line, Codeunit Price Calculation Buffer Mgt., Boolean, Boolean, Boolean) :#
[IntegrationEvent(false, false)]
local procedure OnBeforeFindLines(AmountType: Enum "Price Amount Type"; var TempPriceListLine: Record "Price List Line" temporary; var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt."; ShowAll: Boolean; var FoundLines: Boolean; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPriceCalcLowestPrice", 'OnBeforeFindLines', '', false, false)]
local procedure DoSomethingOnBeforeFindLines(AmountType: Enum "Price Amount Type"; var TempPriceListLine: Record "Price List Line" temporary; var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt."; ShowAll: Boolean; var FoundLines: Boolean; var IsHandled: Boolean)
begin
end;
OnBeforePickBestLine(Enum Price Amount Type, Record Price List Line, Record Price List Line, Boolean, Boolean) :#
[IntegrationEvent(false, false)]
local procedure OnBeforePickBestLine(AmountType: Enum "Price Amount Type"; PriceListLine: Record "Price List Line"; var BestPriceListLine: Record "Price List Line"; var FoundBestLine: Boolean; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPriceCalcLowestPrice", 'OnBeforePickBestLine', '', false, false)]
local procedure DoSomethingOnBeforePickBestLine(AmountType: Enum "Price Amount Type"; PriceListLine: Record "Price List Line"; var BestPriceListLine: Record "Price List Line"; var FoundBestLine: Boolean; var IsHandled: Boolean)
begin
end;
OnBeforeCalcBestAmount(Enum Price Amount Type, Codeunit Price Calculation Buffer Mgt., Record Price List Line) :#
[IntegrationEvent(false, false)]
local procedure OnBeforeCalcBestAmount(AmountType: Enum "Price Amount Type"; var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt."; var PriceListLine: Record "Price List Line"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPriceCalcLowestPrice", 'OnBeforeCalcBestAmount', '', false, false)]
local procedure DoSomethingOnBeforeCalcBestAmount(AmountType: Enum "Price Amount Type"; var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt."; var PriceListLine: Record "Price List Line")
begin
end;
OnApplyDiscountOnBeforeFillBestLine(Record Price List Line, Codeunit Price Calculation Buffer Mgt.) :#
[IntegrationEvent(false, false)]
local procedure OnApplyDiscountOnBeforeFillBestLine(var TempPriceListLine: Record "Price List Line" temporary; var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt."):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPriceCalcLowestPrice", 'OnApplyDiscountOnBeforeFillBestLine', '', false, false)]
local procedure DoSomethingOnApplyDiscountOnBeforeFillBestLine(var TempPriceListLine: Record "Price List Line" temporary; var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt.")
begin
end;
OnIsDisabled(Boolean) :#
Summary: Integration event to check if the price calculation method is disabled.
[IntegrationEvent(false, false)]
local procedure OnIsDisabled(var Disabled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPriceCalcLowestPrice", 'OnIsDisabled', '', false, false)]
local procedure DoSomethingOnIsDisabled(var Disabled: Boolean)
begin
end;
Parameters:
Disabled: Set to true to disable this price calculation method.
Remarks: Use this event to conditionally disable the Lowest Price calculation method.
OnAfterCalcBestAmount(Enum Price Amount Type, Codeunit Price Calculation Buffer Mgt., Record Price List Line, Boolean) :#
[IntegrationEvent(true, false)]
local procedure OnAfterCalcBestAmount(AmountType: Enum "Price Amount Type"; var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt."; var PriceListLine: Record "Price List Line"; var FoundBestPrice: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPriceCalcLowestPrice", 'OnAfterCalcBestAmount', '', false, false)]
local procedure DoSomethingOnAfterCalcBestAmount(AmountType: Enum "Price Amount Type"; var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt."; var PriceListLine: Record "Price List Line"; var FoundBestPrice: Boolean)
begin
end;
OnAfterFindLines(Enum Price Amount Type, Record Price List Line, Codeunit Price Calculation Buffer Mgt., Boolean, Boolean) :#
[IntegrationEvent(false, false)]
local procedure OnAfterFindLines(AmountType: Enum "Price Amount Type"; var TempPriceListLine: Record "Price List Line" temporary; var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt."; ShowAll: Boolean; var FoundLines: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPriceCalcLowestPrice", 'OnAfterFindLines', '', false, false)]
local procedure DoSomethingOnAfterFindLines(AmountType: Enum "Price Amount Type"; var TempPriceListLine: Record "Price List Line" temporary; var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt."; ShowAll: Boolean; var FoundLines: Boolean)
begin
end;
OnBeforeShowPrices(Record Price List Line, Interface Line With Price) :#
[IntegrationEvent(false, false)]
local procedure OnBeforeShowPrices(var TempPriceListLine: Record "Price List Line"; LineWithPrice: Interface "Line With Price"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPriceCalcLowestPrice", 'OnBeforeShowPrices', '', false, false)]
local procedure DoSomethingOnBeforeShowPrices(var TempPriceListLine: Record "Price List Line"; LineWithPrice: Interface "Line With Price")
begin
end;
OnFindLinesOnBeforePriceSourceListGetMinMaxLevel(Codeunit Price Asset List, Codeunit Price Source List, Enum Price Amount Type, Codeunit Price Calculation Buffer Mgt.) :#
[IntegrationEvent(false, false)]
local procedure OnFindLinesOnBeforePriceSourceListGetMinMaxLevel(var PriceAssetList: Codeunit "Price Asset List"; var PriceSourceList: Codeunit "Price Source List"; AmountType: Enum "Price Amount Type"; var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt."):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPriceCalcLowestPrice", 'OnFindLinesOnBeforePriceSourceListGetMinMaxLevel', '', false, false)]
local procedure DoSomethingOnFindLinesOnBeforePriceSourceListGetMinMaxLevel(var PriceAssetList: Codeunit "Price Asset List"; var PriceSourceList: Codeunit "Price Source List"; AmountType: Enum "Price Amount Type"; var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt.")
begin
end;
OnFindLinesOnBeforeCopyConditionLines(Record Price Calculation Buffer, Record Price List Line) :#
Summary: Integration event triggered before copying condition lines during FindLines.
[IntegrationEvent(false, false)]
local procedure OnFindLinesOnBeforeCopyConditionLines(var KVSKBAPriceCalculationBuffer: Record "Price Calculation Buffer"; var TempPriceListLine: Record "Price List Line" temporary):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPriceCalcLowestPrice", 'OnFindLinesOnBeforeCopyConditionLines', '', false, false)]
local procedure DoSomethingOnFindLinesOnBeforeCopyConditionLines(var KVSKBAPriceCalculationBuffer: Record "Price Calculation Buffer"; var TempPriceListLine: Record "Price List Line" temporary)
begin
end;
Parameters:
KVSKBAPriceCalculationBuffer: The price calculation buffer.TempPriceListLine: The temporary price list line (can be modified).
Remarks: Use this event to modify or prepare data before KUMAVISION condition line processing.
OnFindLinesOnAfterCopyConditionLines(Record Price Calculation Buffer, Record Price List Line) :#
Summary: Integration event triggered after copying condition lines during FindLines.
[IntegrationEvent(false, false)]
local procedure OnFindLinesOnAfterCopyConditionLines(var KVSKBAPriceCalculationBuffer: Record "Price Calculation Buffer"; var TempPriceListLine: Record "Price List Line" temporary):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPriceCalcLowestPrice", 'OnFindLinesOnAfterCopyConditionLines', '', false, false)]
local procedure DoSomethingOnFindLinesOnAfterCopyConditionLines(var KVSKBAPriceCalculationBuffer: Record "Price Calculation Buffer"; var TempPriceListLine: Record "Price List Line" temporary)
begin
end;
Parameters:
KVSKBAPriceCalculationBuffer: The price calculation buffer.TempPriceListLine: The temporary price list line (can be modified).
Remarks: Use this event to perform post-processing after KUMAVISION condition line processing. Subscribe to adjust calculated prices or discounts.