KVSKBARequisitionLinePrice#
Procedures#
GetTableNo() : Integer#
Summary: Returns the table number for the Requisition Line table.
procedure GetTableNo(): Integer
Returns: Database ID of the Requisition Line table.
Remarks: This procedure implements the Line With Price interface method and returns the constant Database::"Requisition Line" to identify which table this price calculation implementation handles. It is used by the price calculation framework to determine the correct pricing handler for requisition lines. This is part of the Business Central extensible price calculation architecture.
SetLine(Enum Price Type, Variant) :#
procedure SetLine(PriceType: Enum "Price Type"; Line: Variant):
SetLine(Enum Price Type, Variant, Variant) :#
procedure SetLine(PriceType: Enum "Price Type"; Header: Variant; Line: Variant):
SetSources(Codeunit Price Source List) :#
procedure SetSources(var NewPriceSourceList: Codeunit "Price Source List"):
GetLine(Variant) :#
Summary: Retrieves the current requisition line from the price calculation context.
procedure GetLine(var Line: Variant):
Parameters:
Line: Variant parameter to receive the requisition line.
Remarks: This procedure returns the currently stored requisition line that was set via SetLine. It allows calling code to retrieve the line after price calculations have been performed, potentially with updated pricing fields. The line is returned as a variant to match the Line With Price interface requirements.
GetLine(Variant, Variant) :#
Summary: Retrieves the current requisition line and header from the price calculation context.
procedure GetLine(var Header: Variant; var Line: Variant):
Parameters:
Header: Variant parameter for header (cleared as requisition lines have no separate header).Line: Variant parameter to receive the requisition line.
Remarks: This procedure overloads GetLine to match the Line With Price interface signature that expects both header and line return parameters. Since requisition lines do not have a separate header record, the header parameter is cleared and only the line is returned. This maintains interface compatibility while supporting the requisition line structure.
GetPriceType() : Enum#
Summary: Returns the current price type being used for calculation.
procedure GetPriceType(): Enum Price Type
Returns: Current price type (Purchase or Sale).
Remarks: This procedure returns the price type that was set during SetLine initialization. For requisition lines, this is typically Price Type::Purchase since requisition lines represent planned purchases. The price type determines which price lists and calculation methods are used during price calculation.
IsPriceUpdateNeeded(Enum Price Amount Type, Boolean, Integer) : Boolean#
procedure IsPriceUpdateNeeded(AmountType: Enum "Price Amount Type"; FoundPrice: Boolean; CalledByFieldNo: Integer): Boolean
IsDiscountAllowed() : Boolean#
Summary: Determines whether line discounts are allowed for the requisition line.
procedure IsDiscountAllowed(): Boolean
Returns: True if discounts are allowed, false otherwise.
Remarks: This procedure returns true if discounts are explicitly allowed by the DiscountIsAllowed flag or if no price calculation has been performed yet (PriceCalculated is false). The DiscountIsAllowed flag is set from the price list line's Allow Line Disc. field when a price is applied. This ensures discount settings from price lists are respected while allowing discounts on lines without calculated prices.
Verify() :#
Summary: Validates that required fields for price calculation are populated correctly.
procedure Verify():
Remarks: This procedure performs validation checks to ensure the requisition line has valid data for price calculation. It verifies that Qty. per Unit of Measure is not zero and, if a currency code is specified, that Currency Factor is not zero. Extensions can bypass standard verification through the OnBeforeVerify event by setting IsHandled to true. This prevents price calculation errors caused by missing or invalid unit of measure or currency data.
SetAssetSourceForSetup(Record Dtld. Price Calculation Setup) : Boolean#
Summary: Configures the asset source for detailed price calculation setup.
procedure SetAssetSourceForSetup(var DtldPriceCalculationSetup: Record "Dtld. Price Calculation Setup"): Boolean
Parameters:
DtldPriceCalculationSetup: Detailed price calculation setup record to initialize.
Returns: True if a valid source group was found, false otherwise.
Remarks: This procedure initializes a Dtld. Price Calculation Setup record with the current price type, price calculation method from the requisition line, asset type (Item or G/L Account), and asset number. It then calls GetSourceGroup on the price source list to determine the appropriate source group configuration. This is used by the price calculation framework to identify which price calculation implementation should handle the requisition line based on its configuration and sources.
GetAssetType() : Enum#
Summary: Determines the price asset type based on the requisition line type.
procedure GetAssetType(): Enum Price Asset Type
Returns: Price asset type corresponding to the requisition line type.
Remarks: This procedure maps the requisition line Type field to the corresponding Price Asset Type enum value. It returns Item for Type::Item, G/L Account for Type::"G/L Account", and blank for other types (e.g., Fixed Asset, Charge (Item)). Extensions can customize the asset type mapping through the OnAfterGetAssetType event. The asset type is used throughout price calculation to find applicable price list lines and determine calculation methods.
CopyToBuffer(Codeunit Price Calculation Buffer Mgt.) : Boolean#
procedure CopyToBuffer(var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt."): Boolean
SetPrice(Enum Price Amount Type, Record Price List Line) :#
procedure SetPrice(AmountType: Enum "Price Amount Type"; PriceListLine: Record "Price List Line"):
ValidatePrice(Enum Price Amount Type) :#
procedure ValidatePrice(AmountType: Enum "Price Amount Type"):
Update(Enum Price Amount Type) :#
procedure Update(AmountType: Enum "Price Amount Type"):
Events#
OnAfterAddSources(Record Requisition Line, Enum Price Type, Codeunit Price Source List) :#
[IntegrationEvent(false, false)]
local procedure OnAfterAddSources(RequisitionLine: Record "Requisition Line"; PriceType: Enum "Price Type"; var PriceSourceList: Codeunit "Price Source List"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBARequisitionLinePrice", 'OnAfterAddSources', '', false, false)]
local procedure DoSomethingOnAfterAddSources(RequisitionLine: Record "Requisition Line"; PriceType: Enum "Price Type"; var PriceSourceList: Codeunit "Price Source List")
begin
end;
OnAfterFillBuffer(Record Price Calculation Buffer, Record Requisition Line) :#
Summary: Integration event raised after the price calculation buffer has been populated with requisition line data.
[IntegrationEvent(false, false)]
local procedure OnAfterFillBuffer(var PriceCalculationBuffer: Record "Price Calculation Buffer"; RequisitionLine: Record "Requisition Line"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBARequisitionLinePrice", 'OnAfterFillBuffer', '', false, false)]
local procedure DoSomethingOnAfterFillBuffer(var PriceCalculationBuffer: Record "Price Calculation Buffer"; RequisitionLine: Record "Requisition Line")
begin
end;
Parameters:
PriceCalculationBuffer: Price calculation buffer record with standard fields already filled.RequisitionLine: Source requisition line providing the data.
Remarks: This event allows extensions to add custom fields to the price calculation buffer before it is used for price calculation. Subscribers can transfer additional data from the requisition line or related records to influence price calculation logic. This is useful for implementing custom pricing rules based on fields not included in the standard buffer, such as project information, custom dimensions, or special pricing categories.
OnAfterGetAssetType(Record Requisition Line, Enum Price Asset Type) :#
[IntegrationEvent(false, false)]
local procedure OnAfterGetAssetType(RequisitionLine: Record "Requisition Line"; var AssetType: Enum "Price Asset Type"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBARequisitionLinePrice", 'OnAfterGetAssetType', '', false, false)]
local procedure DoSomethingOnAfterGetAssetType(RequisitionLine: Record "Requisition Line"; var AssetType: Enum "Price Asset Type")
begin
end;
OnAfterIsPriceUpdateNeeded(Enum Price Amount Type, Boolean, Integer, Record Requisition Line, Boolean, Boolean) :#
[IntegrationEvent(false, false)]
local procedure OnAfterIsPriceUpdateNeeded(AmountType: Enum "Price Amount Type"; FoundPrice: Boolean; CalledByFieldNo: Integer; RequisitionLine: Record "Requisition Line"; var Result: Boolean; IsSKU: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBARequisitionLinePrice", 'OnAfterIsPriceUpdateNeeded', '', false, false)]
local procedure DoSomethingOnAfterIsPriceUpdateNeeded(AmountType: Enum "Price Amount Type"; FoundPrice: Boolean; CalledByFieldNo: Integer; RequisitionLine: Record "Requisition Line"; var Result: Boolean; IsSKU: Boolean)
begin
end;
OnAfterSetPrice(Record Requisition Line, Record Price List Line, Enum Price Amount Type) :#
[IntegrationEvent(false, false)]
local procedure OnAfterSetPrice(var RequisitionLine: Record "Requisition Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBARequisitionLinePrice", 'OnAfterSetPrice', '', false, false)]
local procedure DoSomethingOnAfterSetPrice(var RequisitionLine: Record "Requisition Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type")
begin
end;
OnBeforeVerify(Record Requisition Line, Boolean) :#
Summary: Integration event raised before verifying requisition line data for price calculation.
[IntegrationEvent(false, false)]
local procedure OnBeforeVerify(RequisitionLine: Record "Requisition Line"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBARequisitionLinePrice", 'OnBeforeVerify', '', false, false)]
local procedure DoSomethingOnBeforeVerify(RequisitionLine: Record "Requisition Line"; var IsHandled: Boolean)
begin
end;
Parameters:
RequisitionLine: Requisition line to be verified.IsHandled: Set to true to skip standard verification logic.
Remarks: This event allows extensions to bypass or supplement standard verification checks before price calculation. Subscribers can implement custom validation logic, skip standard checks for specific scenarios, or perform additional validations. Setting IsHandled to true prevents the standard TestField checks on Qty. per Unit of Measure and Currency Factor, allowing custom validation approaches.
OnBeforeSetPrice(Record Requisition Line, Record Price List Line, Enum Price Amount Type, Boolean, Enum Price Type) :#
[IntegrationEvent(false, false)]
local procedure OnBeforeSetPrice(var RequisitionLine: Record "Requisition Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"; var IsHandled: Boolean; CurrPriceType: Enum "Price Type"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBARequisitionLinePrice", 'OnBeforeSetPrice', '', false, false)]
local procedure DoSomethingOnBeforeSetPrice(var RequisitionLine: Record "Requisition Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"; var IsHandled: Boolean; CurrPriceType: Enum "Price Type")
begin
end;
OnSetPriceOriginFromPriceListLineOnBeforePriceListLineTypeCaseElse(Record Requisition Line, Record Price List Line, Enum Price Amount Type) :#
[IntegrationEvent(false, false)]
local procedure OnSetPriceOriginFromPriceListLineOnBeforePriceListLineTypeCaseElse(RequisitionLine: Record "Requisition Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBARequisitionLinePrice", 'OnSetPriceOriginFromPriceListLineOnBeforePriceListLineTypeCaseElse', '', false, false)]
local procedure DoSomethingOnSetPriceOriginFromPriceListLineOnBeforePriceListLineTypeCaseElse(RequisitionLine: Record "Requisition Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type")
begin
end;