Table of Contents

KVSKBASalesLinePrice

Implements [#437dbf0e84ff417a965ded2bb9650972#Shipment Method ](https://github.com/search?q=Table+%5b%23437dbf0e84ff417a965ded2bb9650972%23Shipment+Method+%3aocticons-mark-github-16%3a%5d(https%3a%2f%2fgithub.com%2fsearch%3fq%3dTable%2b%2523437dbf0e84ff417a965ded2bb9650972%2523Shipment%2bMethod%2brepo%253AStefanMaron%252FMSDyn365BC.Code.History%26type%3dCode)+repo%3AStefanMaron%2FMSDyn365BC.Code.History&type=Code).

Procedures

GetTableNo() : Integer

Summary: Returns the table number for the Sales Line table.

procedure GetTableNo(): Integer

Returns: Integer representing the Sales Line table ID

Remarks: Used by the price calculation framework to identify the source table

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 Sales Line record.

procedure GetLine(var Line: Variant): 

Parameters:

  • Line: Variable to store the Sales Line record

Remarks: Returns only the line record without header information

GetLine(Variant, Variant) :

Summary: Retrieves both Sales Header and Sales Line records.

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

Parameters:

  • Header: Variable to store the Sales Header record
  • Line: Variable to store the Sales Line record

Remarks: Returns both header and line records used in the price calculation

GetPriceType() : Enum

Summary: Returns the current price type being calculated.

procedure GetPriceType(): Enum Price Type

Returns: The price type enum (Sale or Purchase)

Remarks: Used to determine which type of price calculation is currently active

IsPriceUpdateNeeded(Enum Price Amount Type, Boolean, Integer) : Boolean

procedure IsPriceUpdateNeeded(AmountType: Enum "Price Amount Type"; FoundPrice: Boolean; CalledByFieldNo: Integer): Boolean

IsDiscountAllowed() : Boolean

Summary: Checks if line discounts are allowed for the current sales line.

procedure IsDiscountAllowed(): Boolean

Returns: Boolean indicating if discounts are allowed

Remarks: Considers both the Allow Line Disc. field and whether price has been calculated

Verify() :

Summary: Verifies the integrity of the sales line and header data.

procedure Verify(): 

Remarks: Ensures required fields are properly filled before price calculation

SetAssetSourceForSetup(Record Dtld. Price Calculation Setup) : Boolean

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

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

Parameters:

  • DtldPriceCalculationSetup: The detailed price calculation setup record to populate

Returns: Boolean indicating if the setup was successful

Remarks: Configures the asset information needed for price calculation setup

GetAssetType() : Enum

Summary: Returns the asset type for the current sales line.

procedure GetAssetType(): Enum Price Asset Type

Returns: The price asset type enum

Remarks: Maps the sales line type to the corresponding price asset type

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"): 

AddActivatedCampaignsAsSource() :

Summary: Adds activated campaigns as price sources.

procedure AddActivatedCampaignsAsSource(): 

Remarks: Finds and adds relevant campaign price sources to the price source list

Events

OnAfterGetAssetType(Record Sales Line, Enum Price Asset Type) :

[IntegrationEvent(false, false)]
local procedure OnAfterGetAssetType(SalesLine: Record "Sales Line"; var AssetType: Enum "Price Asset Type"): 

OnAfterAddSources(Record Sales Header, Record Sales Line, Enum Price Type, Codeunit Price Source List) :

[IntegrationEvent(false, false)]
local procedure OnAfterAddSources(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; PriceType: Enum "Price Type"; var PriceSourceList: Codeunit "Price Source List"): 

OnAfterFillBuffer(Record Price Calculation Buffer, Record Sales Header, Record Sales Line) :

Summary: Integration event raised after filling the price calculation buffer.

[IntegrationEvent(false, false)]
local procedure OnAfterFillBuffer(var PriceCalculationBuffer: Record "Price Calculation Buffer"; SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"): 

Parameters:

  • PriceCalculationBuffer: The buffer record that can be modified
  • SalesHeader: The source sales header
  • SalesLine: The source sales line

Remarks: Allows customization of the buffer data before price calculation

OnAfterGetDocumentDate(Date, Record Sales Header, Record Sales Line) :

Summary: Integration event raised after determining the document date for price calculation.

[IntegrationEvent(false, false)]
local procedure OnAfterGetDocumentDate(var DocumentDate: Date; SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"): 

Parameters:

  • DocumentDate: The determined document date that can be modified
  • SalesHeader: The sales header providing context
  • SalesLine: The sales line providing context

Remarks: Allows customization of the date used for price calculations

OnAfterUpdate(Record Sales Line, Enum Price Type, Enum Price Amount Type, Record Sales Header) :

[IntegrationEvent(false, false)]
local procedure OnAfterUpdate(var SalesLine: Record "Sales Line"; CurrPriceType: Enum "Price Type"; AmountType: Enum "Price Amount Type"; var SalesHeader: Record "Sales Header"): 

OnAfterSetPrice(Record Sales Line, Record Price List Line, Enum Price Amount Type) :

[IntegrationEvent(false, false)]
local procedure OnAfterSetPrice(var SalesLine: Record "Sales Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"): 

OnBeforeSetPrice(Record Sales Line, Record Price List Line, Enum Price Amount Type, Boolean, Record Sales Header, Enum Price Type) :

[IntegrationEvent(false, false)]
local procedure OnBeforeSetPrice(var SalesLine: Record "Sales Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"; var IsHandled: Boolean; var SalesHeader: Record "Sales Header"; CurrPriceType: Enum "Price Type"): 

OnBeforeVerify(Record Sales Header, Record Sales Line, Boolean) :

Summary: Integration event raised before verifying sales line data integrity.

[IntegrationEvent(false, false)]
local procedure OnBeforeVerify(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var IsHandled: Boolean): 

Parameters:

  • SalesHeader: The sales header to verify
  • SalesLine: The sales line to verify
  • IsHandled: Set to true to skip default verification logic

Remarks: Allows custom verification logic to replace the standard behavior

OnCopyToBufferOnAfterPriceCalculationBufferMgtSet(Codeunit Price Calculation Buffer Mgt., Record Price Calculation Buffer, Codeunit Price Source List) :

[IntegrationEvent(false, false)]
local procedure OnCopyToBufferOnAfterPriceCalculationBufferMgtSet(var PriceCalculationBufferMgt: Codeunit "Price Calculation Buffer Mgt."; PriceCalculationBuffer: Record "Price Calculation Buffer"; var PriceSourceList: Codeunit "Price Source List"): 

OnAfterIsDiscountAllowed(Record Sales Line, Boolean, Boolean) :

Summary: Integration event raised after determining if discounts are allowed.

[IntegrationEvent(false, false)]
local procedure OnAfterIsDiscountAllowed(SalesLine: Record "Sales Line"; PriceCalculated: Boolean; var Result: Boolean): 

Parameters:

  • SalesLine: The sales line being evaluated
  • PriceCalculated: Whether price calculation has been performed
  • Result: The discount allowance result that can be modified

Remarks: Allows customization of discount allowance logic

OnAfterValidatePrice(Record Sales Line, Enum Price Type, Enum Price Amount Type) :

[IntegrationEvent(false, false)]
local procedure OnAfterValidatePrice(var SalesLine: Record "Sales Line"; CurrPriceType: Enum "Price Type"; AmountType: Enum "Price Amount Type"): 

OnAfterIsPriceUpdateNeeded(Enum Price Amount Type, Boolean, Integer, Boolean, Record Sales Line) :

[IntegrationEvent(false, false)]
local procedure OnAfterIsPriceUpdateNeeded(AmountType: Enum "Price Amount Type"; FoundPrice: Boolean; CalledByFieldNo: Integer; var Result: Boolean; SalesLine: Record "Sales Line"): 

OnAfterFindContactCompanyCampaigns(Code[20], Record Campaign Target Group, Boolean) :

Summary: Integration event raised after finding contact company campaigns.

[IntegrationEvent(false, false)]
local procedure OnAfterFindContactCompanyCampaigns(ContactNo: Code[20]; var TempCampaignTargetGr: Record "Campaign Target Group" temporary; var Found: Boolean): 

Parameters:

  • ContactNo: The contact number that was searched
  • TempCampaignTargetGr: The temporary campaign target group records found
  • Found: Whether any campaigns were found

Remarks: Allows customization of contact campaign discovery logic

OnAfterFindCustomerCampaigns(Code[20], Record Campaign Target Group, Boolean) :

Summary: Integration event raised after finding customer campaigns.

[IntegrationEvent(false, false)]
local procedure OnAfterFindCustomerCampaigns(CustomerNo: Code[20]; var TempCampaignTargetGr: Record "Campaign Target Group" temporary; var Found: Boolean): 

Parameters:

  • CustomerNo: The customer number that was searched
  • TempCampaignTargetGr: The temporary campaign target group records found
  • Found: Whether any campaigns were found

Remarks: Allows customization of customer campaign discovery logic

OnGetCustNoForSalesHeader(Record Sales Header, Code[20]) :

Summary: Integration event raised when getting the customer number for sales header.

[IntegrationEvent(false, false)]
local procedure OnGetCustNoForSalesHeader(var SalesHeader: Record "Sales Header"; var CustomerNo: Code[20]): 

Parameters:

  • SalesHeader: The sales header being processed
  • CustomerNo: The customer number that can be modified

Remarks: Allows customization of customer number determination logic for price calculations

OnGetContactNoForSalesHeader(Record Sales Header, Code[20]) :

Summary: Integration event raised when getting the contact number for sales header.

[IntegrationEvent(false, false)]
local procedure OnGetContactNoForSalesHeader(var SalesHeader: Record "Sales Header"; var ContactNo: Code[20]): 

Parameters:

  • SalesHeader: The sales header being processed
  • ContactNo: The contact number that can be modified

Remarks: Allows customization of contact number determination logic for price calculations

OnSetDiscountOriginFromPriceListLineOnBeforePriceListLineTypeCaseElse(Record Sales Line, Record Price List Line, Enum Price Amount Type) :

[IntegrationEvent(false, false)]
local procedure OnSetDiscountOriginFromPriceListLineOnBeforePriceListLineTypeCaseElse(var SalesLine: Record "Sales Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"): 

OnSetPriceOriginFromPriceListLineOnBeforePriceListLineTypeCaseElse(Record Sales Line, Record Price List Line, Enum Price Amount Type) :

[IntegrationEvent(false, false)]
local procedure OnSetPriceOriginFromPriceListLineOnBeforePriceListLineTypeCaseElse(var SalesLine: Record "Sales Line"; PriceListLine: Record "Price List Line"; AmountType: Enum "Price Amount Type"):