Skip to content

KVSKBAResJournalLinePrice#

Implements [#437dbf0e84ff417a965ded2bb9650972#Shipment Method ](https://github.com/search?q=Table+%23437dbf0e84ff417a965ded2bb9650972%23Shipment+Method+repo%3AStefanMaron%2FMSDyn365BC.Code.History&type=Code) .

Procedures#

GetTableNo() : Integer#

Summary: Gets the table number for the resource journal line.

procedure GetTableNo(): Integer

Returns: Integer representing the database table number for Res. Journal Line

Remarks: This procedure is part of the "Line With Price" interface implementation and returns the table ID (Database::"Res. Journal Line") to identify which document line type this price calculation handler supports. The price calculation framework uses this to route price calculations to the correct handler.

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 resource journal line with updated price information.

procedure GetLine(var Line: Variant): 

Parameters:

  • Line: Output variant that will receive the Res. Journal Line record

Remarks: This procedure returns the resource journal line that was set via SetLine, potentially with updated price or cost information after price calculation. The price calculation framework uses this to retrieve the modified line after applying prices. The line is returned as a variant to maintain interface compatibility.

GetLine(Variant, Variant) :#

Summary: Retrieves the current resource journal line with updated price information (header-line overload).

procedure GetLine(var Header: Variant; var Line: Variant): 

Parameters:

  • Header: Output variant for the header record (cleared for resource journal lines)
  • Line: Output variant that will receive the Res. Journal Line record

Remarks: This overload is provided for interface compatibility where both header and line retrieval is expected. Since resource journal lines don't have a separate header record, the header parameter is cleared and only the line is returned via the single-parameter GetLine overload. This maintains compatibility with the standard price calculation framework.

GetPriceType() : Enum#

Summary: Gets the current price type being used for price calculation.

procedure GetPriceType(): Enum Price Type

Returns: Price Type enum indicating Sale or Purchase

Remarks: This procedure returns the price type (Sale or Purchase) that was set via SetLine. The price type determines whether sales prices (Unit Price) or purchase costs (Direct Unit Cost, Unit Cost) are calculated. The price calculation framework uses this to identify which price lists and calculation methods to apply.

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 resource journal line.

procedure IsDiscountAllowed(): Boolean

Returns: Boolean indicating whether discounts are allowed

Remarks: This procedure returns true if discounts are explicitly allowed via the DiscountIsAllowed flag or if no price has been calculated yet (PriceCalculated is false). This allows discounts to be applied before price calculation or when explicitly enabled. The price calculation framework uses this to determine whether to search for and apply discount price list lines.

Verify() :#

Summary: Verifies that the resource journal line has required fields populated for price calculation.

procedure Verify(): 

Remarks: This procedure validates that the Qty. per Unit of Measure field is filled on the resource journal line. This field is essential for price calculation as it's used to convert quantities between different units of measure. The price calculation framework calls this before performing calculations to ensure data integrity. If the field is blank, a test field error is raised.

SetAssetSourceForSetup(Record Dtld. Price Calculation Setup) : Boolean#

Summary: Sets up the asset source information for price calculation setup selection.

procedure SetAssetSourceForSetup(var DtldPriceCalculationSetup: Record "Dtld. Price Calculation Setup"): Boolean

Parameters:

  • DtldPriceCalculationSetup: Detailed Price Calculation Setup record to populate with asset source information

Returns: Boolean indicating whether a valid source group was found

Remarks: This procedure initializes the Detailed Price Calculation Setup record with the price type (Sale/Purchase), calculation method, asset type (Resource), and asset number. It then calls GetSourceGroup to determine the appropriate source group from the price source list. The price calculation framework uses this to identify which price calculation implementation to use (e.g., Best Price, Lowest Price) based on the configuration for the resource and source combination.

GetAssetType() : Enum#

Summary: Gets the asset type for price calculation.

procedure GetAssetType(): Enum Price Asset Type

Returns: Price Asset Type enum value Resource

Remarks: This procedure always returns Resource as the asset type since this price handler is specifically for resource journal lines. The price calculation framework uses the asset type to determine which price list lines are applicable (resource prices vs. item prices vs. other asset types). This is a key identifier in the price calculation architecture.

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#

OnAfterFillBuffer(Record Price Calculation Buffer, Record Res. Journal Line) :#

Summary: Integration event raised after the price calculation buffer has been filled with resource journal line data.

[IntegrationEvent(false, false)]
local procedure OnAfterFillBuffer(var PriceCalculationBuffer: Record "Price Calculation Buffer"; ResJournalLine: Record "Res. Journal Line"): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAResJournalLinePrice", 'OnAfterFillBuffer', '', false, false)]
local procedure DoSomethingOnAfterFillBuffer(var PriceCalculationBuffer: Record "Price Calculation Buffer"; ResJournalLine: Record "Res. Journal Line")
begin
end;

Parameters:

  • PriceCalculationBuffer: The Price Calculation Buffer record that has been populated
  • ResJournalLine: The source Res. Journal Line record

Remarks: This integration event allows subscribers to modify or extend the price calculation buffer after it has been populated with standard resource journal line information. Subscribers can add custom fields, modify calculation settings, or adjust buffer values before the buffer is passed to the price calculation engine. This is useful for implementing custom price calculation logic or adding KUMAVISION-specific fields to the buffer for use in custom price calculation implementations.

OnAfterSetPrice(Record Res. Journal Line, Record Price List Line, Enum Price Amount Type) :#

[IntegrationEvent(false, false)]
local procedure OnAfterSetPrice(var ResJournalLine: Record "Res. Journal Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAResJournalLinePrice", 'OnAfterSetPrice', '', false, false)]
local procedure DoSomethingOnAfterSetPrice(var ResJournalLine: Record "Res. Journal Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type")
begin
end;

OnBeforeSetPrice(Record Res. Journal Line, Record Price List Line, Enum Price Amount Type, Boolean, Enum Price Type) :#

[IntegrationEvent(false, false)]
local procedure OnBeforeSetPrice(var ResJournalLine: Record "Res. Journal Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"; var IsHandled: Boolean; CurrPriceType: Enum "Price Type"): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAResJournalLinePrice", 'OnBeforeSetPrice', '', false, false)]
local procedure DoSomethingOnBeforeSetPrice(var ResJournalLine: Record "Res. Journal Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"; var IsHandled: Boolean; CurrPriceType: Enum "Price Type")
begin
end;