KVSKBAServicePriceCalcLib#
Procedures#
CollectOtherItemsOfServiceDoc(Record Service Header, Record Service Line, Boolean, Record KVSKBASalesPurchPriceCalcBuf, Boolean) :#
Summary: Collect in temporary buffer table combinations of item no., variant code, customer price group, etc. for service lines with different item no. and same "KVSKBAItemPriceGroup" or "KVSKBAItemDiscGroup" as the current service line.
procedure CollectOtherItemsOfServiceDoc(ServiceHeader: Record "Service Header"; CurrentServiceLine: Record "Service Line"; IncludeCurrentServiceLine: Boolean; var TempSalesPurchPriceCalcBuf: Record "KVSKBASalesPurchPriceCalcBuf" temporary; DeleteAllBufferRecords: Boolean):
Parameters:
ServiceHeader: Serivce Header to useCurrentServiceLine: Actual Service LineIncludeCurrentServiceLine: Set include Service lineTempSalesPurchPriceCalcBuf: Calculated Sales Purch Price Calc BufDeleteAllBufferRecords: Delete All Buffer Records
Remarks: This procedure collects combinations of item configurations (item number, variant code, customer price group, unit of measure, quantity per unit of measure) in a temporary buffer for service lines that share the same item price group or item discount group as the current service line, but have different item numbers.
Key functionality:
- Collects only lines where IsPriceOrDiscMinQtyPerLine returns FALSE (lines eligible for quantity summing)
- Optionally includes the current service line in the buffer if IncludeCurrentServiceLine is TRUE
- Can delete all existing buffer records or append to existing buffer based on DeleteAllBufferRecords parameter
- Processes lines with same item price group (if not empty) and same customer price group
- Processes lines with same item discount group (if not empty)
- Uses FilterServLineToSumUpQty to ensure consistent filtering with other price calculation functions
The buffer is used for price update operations where changes to one line affect multiple related lines.
For example, when a line quantity changes, all lines in the same price/discount group may need their
unit prices and line discounts recalculated based on new total quantities.
The collected buffer entries represent unique combinations that need price/discount updates, avoiding
duplicate processing of lines with identical pricing characteristics.
Note: Function exits immediately if ServiceHeader.KVSKBAPriceDiscMinQtyperLine is TRUE, as in that
mode each line calculates prices independently without considering other lines.
Events#
OnAfterCopyUnitPriceAndLineDiscToOtherLines(Record Service Line, Record Service Line, Record Service Header) :#
Summary: Integration event that fires after unit price and line discount have been copied to other service lines.
[IntegrationEvent(false, false)]
local procedure OnAfterCopyUnitPriceAndLineDiscToOtherLines(var ToServiceLine: Record "Service Line"; FromServiceLine: Record "Service Line"; ServiceHeader: Record "Service Header"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServicePriceCalcLib", 'OnAfterCopyUnitPriceAndLineDiscToOtherLines', '', false, false)]
local procedure DoSomethingOnAfterCopyUnitPriceAndLineDiscToOtherLines(var ToServiceLine: Record "Service Line"; FromServiceLine: Record "Service Line"; ServiceHeader: Record "Service Header")
begin
end;
Parameters:
ToServiceLine: Service Line record that received the copied price and discount values.FromServiceLine: Service Line record from which price and discount values were copied.ServiceHeader: Service Header record for the document.
Remarks: This event allows subscribers to perform additional actions after CopyUnitPriceAndLineDiscToOtherLines has completed copying unit price and line discount % from one service line to all other lines with the same item configuration. Subscribers can add custom logic such as: - Logging price copy operations - Validating additional fields - Copying custom price-related fields - Triggering workflow notifications
OnAfterIsPriceOrDiscMinQtyPerLine(Record Service Header, Record Service Line, Boolean) :#
Summary: Integration event that allows customization of the result from IsPriceOrDiscMinQtyPerLine function.
[IntegrationEvent(false, false)]
local procedure OnAfterIsPriceOrDiscMinQtyPerLine(ServiceHeader: Record "Service Header"; ServiceLine: Record "Service Line"; var Result: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServicePriceCalcLib", 'OnAfterIsPriceOrDiscMinQtyPerLine', '', false, false)]
local procedure DoSomethingOnAfterIsPriceOrDiscMinQtyPerLine(ServiceHeader: Record "Service Header"; ServiceLine: Record "Service Line"; var Result: Boolean)
begin
end;
Parameters:
ServiceHeader: Service Header record being evaluated.ServiceLine: Service Line record being evaluated.Result: The calculated result; subscribers can modify this value.
Remarks: This event fires at the end of IsPriceOrDiscMinQtyPerLine and allows subscribers to override whether minimum quantity for price/discount calculation is per line or summed across lines. Subscribers can implement custom logic to: - Add additional conditions for excluding lines from quantity summing - Force certain line types to calculate independently - Implement customer-specific pricing rules - Override standard behavior based on custom fields or setup
Note: Changing this result affects graduated pricing calculations throughout the service document.
If Result is set to TRUE, the line will calculate prices independently. If FALSE, quantities will be
summed with other matching lines.
OnAfterSetFilterServiceLineToSumUpQty2(Record Service Line) :#
Summary: Integration event that allows additional filtering of service lines eligible for quantity summing.
[IntegrationEvent(false, false)]
local procedure OnAfterSetFilterServiceLineToSumUpQty2(var ServiceLine: Record "Service Line"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServicePriceCalcLib", 'OnAfterSetFilterServiceLineToSumUpQty2', '', false, false)]
local procedure DoSomethingOnAfterSetFilterServiceLineToSumUpQty2(var ServiceLine: Record "Service Line")
begin
end;
Parameters:
ServiceLine: Service Line record with filters already applied; subscribers can add more filters.
Remarks: This event fires in FilterServLineToSumUpQty2 after standard filters have been applied to identify service lines that should be included when summing quantities for graduated pricing calculations.
Standard filters already applied include:
- Shipment No. = blank
- Shipment Line No. = 0
- Not Billable = blank (or Null Position = blank/No in older versions)
- Warranty = FALSE
- Alternative = blank
- Price Adjmt. Status = blank
- Price Origin not Manual or External
- Line Discount Origin not Manual or External
- Price Calculation Method (if extended price calculation is enabled)
Subscribers can add custom filters to further restrict which lines participate in quantity summing,
such as:
- Custom field values
- Specific customer requirements
- Special line characteristics
Note: Filters must match conditions in IsPriceOrDiscMinQtyPerLine to maintain consistency.
OnAfterValidateLineDiscPctOnCopyUnitPriceAndLineDiscToOtherLine(Record Service Line, Record Service Line, Record Service Header, Boolean) :#
Summary: Integration event that fires after line discount percentage is validated during price copying.
[IntegrationEvent(false, false)]
local procedure OnAfterValidateLineDiscPctOnCopyUnitPriceAndLineDiscToOtherLine(var ToServiceLine: Record "Service Line"; FromServiceLine: Record "Service Line"; ServiceHeader: Record "Service Header"; var ModifyLine: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServicePriceCalcLib", 'OnAfterValidateLineDiscPctOnCopyUnitPriceAndLineDiscToOtherLine', '', false, false)]
local procedure DoSomethingOnAfterValidateLineDiscPctOnCopyUnitPriceAndLineDiscToOtherLine(var ToServiceLine: Record "Service Line"; FromServiceLine: Record "Service Line"; ServiceHeader: Record "Service Header"; var ModifyLine: Boolean)
begin
end;
Parameters:
ToServiceLine: Service Line receiving the price and discount values.FromServiceLine: Service Line from which values are being copied.ServiceHeader: Service Header record for the document.ModifyLine: Flag indicating whether the line should be modified; subscribers can set to TRUE to force modification.
Remarks: This event fires in CopyUnitPriceAndLineDiscToOtherLine after the line discount percentage has been validated and copied from FromServiceLine to ToServiceLine. Subscribers can: - Copy additional custom price-related fields - Perform additional validations - Calculate derived values - Set ModifyLine to TRUE to ensure line is modified even if standard fields haven't changed
At this point the following fields have already been processed and may have set ModifyLine to TRUE:
- Allow Invoice Disc.
- Allow Line Disc.
- Line Discount %
Still to be processed after this event:
- Price Unit
- Unit Price
- Price Origin and Line Discount Origin
OnBeforeCompareVariantCodeInIsPriceUpdateOfOtherLinesRequired(Boolean, Code[10], Code[10], Code[20]) :#
Summary: Integration event that allows customization of variant code comparison when determining if price updates are required.
[IntegrationEvent(false, false)]
local procedure OnBeforeCompareVariantCodeInIsPriceUpdateOfOtherLinesRequired(var ChangedVariantCode: Boolean; OldVariantCode: Code[10]; NewVariantCode: Code[10]; ItemNo: Code[20]):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServicePriceCalcLib", 'OnBeforeCompareVariantCodeInIsPriceUpdateOfOtherLinesRequired', '', false, false)]
local procedure DoSomethingOnBeforeCompareVariantCodeInIsPriceUpdateOfOtherLinesRequired(var ChangedVariantCode: Boolean; OldVariantCode: Code[10]; NewVariantCode: Code[10]; ItemNo: Code[20])
begin
end;
Parameters:
ChangedVariantCode: Result of the comparison; subscribers can modify this value.OldVariantCode: Variant code from the old service line.NewVariantCode: Variant code from the new service line.ItemNo: Item number being evaluated.
Remarks: This event fires in CompareVariantCodeInIsPriceUpdateOfOtherLinesRequired during evaluation of whether other lines need price updates. Standard logic returns TRUE if old and new variant codes match (no change), or if variant-independent pricing is blocked for the item.
Subscribers can implement custom variant comparison logic such as:
- Treating certain variants as equivalent for pricing purposes
- Ignoring variant changes under specific conditions
- Implementing custom variant grouping logic
Return TRUE in ChangedVariantCode to indicate variants should be treated as unchanged (no price update needed).
Return FALSE to indicate variants differ (price update may be required).
OnBeforeCompareVariantCodeInUpdateOtherServiceLinesUnitPrice(Boolean, Code[10], Code[10], Code[20]) :#
Summary: Integration event that allows customization of variant code comparison during price updates to other lines.
[IntegrationEvent(false, false)]
local procedure OnBeforeCompareVariantCodeInUpdateOtherServiceLinesUnitPrice(var ChangedVariantCode: Boolean; OldVariantCode: Code[10]; NewVariantCode: Code[10]; ItemNo: Code[20]):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServicePriceCalcLib", 'OnBeforeCompareVariantCodeInUpdateOtherServiceLinesUnitPrice', '', false, false)]
local procedure DoSomethingOnBeforeCompareVariantCodeInUpdateOtherServiceLinesUnitPrice(var ChangedVariantCode: Boolean; OldVariantCode: Code[10]; NewVariantCode: Code[10]; ItemNo: Code[20])
begin
end;
Parameters:
ChangedVariantCode: Result of the comparison; subscribers can modify this value.OldVariantCode: Variant code from the buffer (old/different line).NewVariantCode: Variant code from the current service line.ItemNo: Item number being evaluated.
Remarks: This event fires in CompareVariantCodeInUpdateOtherServiceLinesUnitPriced when determining whether a buffered item configuration differs from the current service line and needs a price update.
Standard logic returns TRUE if variant codes differ, unless variant-independent pricing is blocked
for the item (in which case returns FALSE as variants are treated the same).
Subscribers can implement custom logic such as:
- Grouping variants that should share pricing
- Treating variant code differences as insignificant under certain conditions
- Implementing special variant handling for specific items
Return TRUE in ChangedVariantCode to indicate variants differ (line needs separate price update).
Return FALSE to indicate variants should be treated as same (no separate price update).
OnBeforeCompareVariantCodeInCompareVariantCodeInCollectOtherItemsOfServiceDoc(Boolean, Code[10], Code[10], Code[20]) :#
Summary: Integration event that allows customization of variant code comparison when collecting other items.
[IntegrationEvent(false, false)]
local procedure OnBeforeCompareVariantCodeInCompareVariantCodeInCollectOtherItemsOfServiceDoc(var ChangedVariantCode: Boolean; VariantCode: Code[10]; CurrentVariantCode: Code[10]; ItemNo: Code[20]):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServicePriceCalcLib", 'OnBeforeCompareVariantCodeInCompareVariantCodeInCollectOtherItemsOfServiceDoc', '', false, false)]
local procedure DoSomethingOnBeforeCompareVariantCodeInCompareVariantCodeInCollectOtherItemsOfServiceDoc(var ChangedVariantCode: Boolean; VariantCode: Code[10]; CurrentVariantCode: Code[10]; ItemNo: Code[20])
begin
end;
Parameters:
ChangedVariantCode: Result of the comparison; subscribers can modify this value.VariantCode: Variant code from the candidate service line.CurrentVariantCode: Variant code from the current service line.ItemNo: Item number being evaluated.
Remarks: This event fires in CompareVariantCodeInCompareVariantCodeInCollectOtherItemsOfServiceDoc when collecting item configurations that should be included in the price calculation buffer.
Standard logic returns TRUE if variant codes differ (include in buffer as different configuration),
unless variant-independent pricing is blocked for the item (returns FALSE as variants are treated the same).
Subscribers can implement custom logic such as:
- Excluding certain variant combinations from collection
- Including variants that would normally be excluded
- Implementing custom variant grouping for price group calculations
Return TRUE in ChangedVariantCode to include the line in the collection buffer (treat as different).
Return FALSE to exclude the line from the buffer (treat as same as current).
OnBeforeInsertInAddItemToPriceCalcBuffer(Record KVSKBASalesPurchPriceCalcBuf, Record Service Line, Record Service Header) :#
Summary: Integration event that fires before inserting an item configuration into the price calculation buffer.
[IntegrationEvent(false, false)]
local procedure OnBeforeInsertInAddItemToPriceCalcBuffer(var TempKVSKBASalesPurchPriceCalcBuf: Record "KVSKBASalesPurchPriceCalcBuf" temporary; ServiceLine: Record "Service Line"; ServiceHeader: Record "Service Header"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServicePriceCalcLib", 'OnBeforeInsertInAddItemToPriceCalcBuffer', '', false, false)]
local procedure DoSomethingOnBeforeInsertInAddItemToPriceCalcBuffer(var TempKVSKBASalesPurchPriceCalcBuf: Record "KVSKBASalesPurchPriceCalcBuf" temporary; ServiceLine: Record "Service Line"; ServiceHeader: Record "Service Header")
begin
end;
Parameters:
TempKVSKBASalesPurchPriceCalcBuf: Temporary buffer record about to be inserted; subscribers can modify field values.ServiceLine: Service Line from which the buffer entry is being created.ServiceHeader: Service Header for the document.
Remarks: This event fires in AddItemToPriceCalcBuffer just before inserting a new entry into the temporary price calculation buffer. The buffer entry represents a unique combination of: - Item number and variant code - Customer price group - Unit of measure and quantity per unit of measure
Subscribers can:
- Set additional custom fields in the buffer record
- Modify field values based on custom logic
- Log buffer entry creation
- Perform validation before insertion
The buffer is used to track unique item configurations that need price updates, ensuring each
configuration is processed only once even if multiple service lines share that configuration.
OnBeforeModifyLineOnCopyUnitPriceAndLineDiscToOtherLine(Record Service Line, Record Service Line, Record Service Header, Boolean) :#
Summary: Integration event that fires before modifying a service line during price and discount copying.
[IntegrationEvent(false, false)]
local procedure OnBeforeModifyLineOnCopyUnitPriceAndLineDiscToOtherLine(var ToServiceLine: Record "Service Line"; FromServiceLine: Record "Service Line"; ServiceHeader: Record "Service Header"; var ModifyLine: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServicePriceCalcLib", 'OnBeforeModifyLineOnCopyUnitPriceAndLineDiscToOtherLine', '', false, false)]
local procedure DoSomethingOnBeforeModifyLineOnCopyUnitPriceAndLineDiscToOtherLine(var ToServiceLine: Record "Service Line"; FromServiceLine: Record "Service Line"; ServiceHeader: Record "Service Header"; var ModifyLine: Boolean)
begin
end;
Parameters:
ToServiceLine: Service Line about to be modified.FromServiceLine: Service Line from which values were copied.ServiceHeader: Service Header for the document.ModifyLine: Flag indicating whether to modify the line; subscribers can change this value.
Remarks: This event fires in CopyUnitPriceAndLineDiscToOtherLine after all standard fields have been validated and copied but before the ToServiceLine record is modified. At this point the following fields have been processed: - Allow Invoice Disc. - Allow Line Disc. - Line Discount % - Price Unit - Unit Price - Price Origin and Line Discount Origin
Subscribers can:
- Copy additional custom fields
- Set ModifyLine to TRUE to force modification even if standard fields are unchanged
- Set ModifyLine to FALSE to prevent modification
- Perform final validation before line is modified
- Make last-minute adjustments to ToServiceLine field values
After this event, if ModifyLine is TRUE, ToServiceLine.Modify() will be called, followed by
copying of price/discount calculation detail lines.
OnBeforeTestFieldVariantCodeInCopyUnitPriceAndLineDiscToOtherLine(Record Service Header, Record Service Line, Record Service Line, Boolean) :#
Summary: Integration event that allows bypassing the variant code validation when copying prices between lines.
[IntegrationEvent(false, false)]
local procedure OnBeforeTestFieldVariantCodeInCopyUnitPriceAndLineDiscToOtherLine(ServiceHeader: Record "Service Header"; FromServiceLine: Record "Service Line"; ToServiceLine: Record "Service Line"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServicePriceCalcLib", 'OnBeforeTestFieldVariantCodeInCopyUnitPriceAndLineDiscToOtherLine', '', false, false)]
local procedure DoSomethingOnBeforeTestFieldVariantCodeInCopyUnitPriceAndLineDiscToOtherLine(ServiceHeader: Record "Service Header"; FromServiceLine: Record "Service Line"; ToServiceLine: Record "Service Line"; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceHeader: Service Header for the document.FromServiceLine: Service Line from which prices are being copied.ToServiceLine: Service Line to which prices are being copied.IsHandled: Set to TRUE to skip the variant code TestField validation.
Remarks: This event fires in CopyUnitPriceAndLineDiscToOtherLine before validating that the variant codes match between FromServiceLine and ToServiceLine. Standard logic requires variant codes to match unless variant-independent pricing is blocked for the item.
Subscribers can set IsHandled to TRUE to bypass the variant code validation, allowing prices to be
copied between lines with different variants. Use cases include:
- Custom variant grouping where different variants should share pricing
- Special pricing scenarios where variant differences are intentionally ignored
- Testing or migration scenarios
Warning: Bypassing this validation may result in price inconsistencies if variants should normally
have different pricing. Use carefully and ensure custom logic properly handles variant pricing rules.
OnGetTotalItemPriceGrpQtyOnAfterSetFilterServiceLine(Record Service Line, Record Service Line, Decimal, Boolean) :#
Summary: Integration event that allows customization of total quantity calculation for item price groups.
[IntegrationEvent(false, false)]
local procedure OnGetTotalItemPriceGrpQtyOnAfterSetFilterServiceLine(CurrentServiceLine: Record "Service Line"; var ServiceLine: Record "Service Line"; var TotalQty: Decimal; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServicePriceCalcLib", 'OnGetTotalItemPriceGrpQtyOnAfterSetFilterServiceLine', '', false, false)]
local procedure DoSomethingOnGetTotalItemPriceGrpQtyOnAfterSetFilterServiceLine(CurrentServiceLine: Record "Service Line"; var ServiceLine: Record "Service Line"; var TotalQty: Decimal; var IsHandled: Boolean)
begin
end;
Parameters:
CurrentServiceLine: Current Service Line for which total is being calculated.ServiceLine: Filtered Service Line recordset; subscribers can modify filters.TotalQty: Total quantity calculated; subscribers can modify this value.IsHandled: Set to TRUE to skip standard quantity summation logic.
Remarks: This event fires in GetTotalItemPriceGrpQty after filters have been set but before summing quantities across service lines with the same item price group. Standard filters applied include: - Same item price group (KVSKBAItemPriceGroup) - Same customer price group - Same unit of measure and quantity per unit of measure - Lines eligible for quantity summing (via FilterServLineToSumUpQty)
Subscribers can:
- Add additional filters to ServiceLine
- Calculate TotalQty using custom logic and set IsHandled = TRUE
- Modify TotalQty after standard calculation (if IsHandled = FALSE)
- Implement special quantity calculation rules for specific price groups
If IsHandled is set to TRUE, the standard quantity summation loop will be skipped.
GetTotalItemDiscGrpQtyOnAfterSetFilterServiceLine(Record Service Line, Record Service Line, Decimal, Boolean) :#
Summary: Integration event that allows customization of total quantity calculation for item discount groups.
[IntegrationEvent(false, false)]
local procedure GetTotalItemDiscGrpQtyOnAfterSetFilterServiceLine(CurrentServiceLine: Record "Service Line"; var ServiceLine: Record "Service Line"; var TotalQty: Decimal; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServicePriceCalcLib", 'GetTotalItemDiscGrpQtyOnAfterSetFilterServiceLine', '', false, false)]
local procedure DoSomethingGetTotalItemDiscGrpQtyOnAfterSetFilterServiceLine(CurrentServiceLine: Record "Service Line"; var ServiceLine: Record "Service Line"; var TotalQty: Decimal; var IsHandled: Boolean)
begin
end;
Parameters:
CurrentServiceLine: Current Service Line for which total is being calculated.ServiceLine: Filtered Service Line recordset; subscribers can modify filters.TotalQty: Total quantity calculated; subscribers can modify this value.IsHandled: Set to TRUE to skip standard quantity summation logic.
Remarks: This event fires in GetTotalItemDiscGrpQty after filters have been set but before summing quantities across service lines with the same item discount group. Standard filters applied include: - Same item discount group (KVSKBAItemDiscGroup) - Same unit of measure and quantity per unit of measure - Type = Item - Lines eligible for quantity summing (via FilterServLineToSumUpQty)
Subscribers can:
- Add additional filters to ServiceLine
- Calculate TotalQty using custom logic and set IsHandled = TRUE
- Modify TotalQty after standard calculation (if IsHandled = FALSE)
- Implement special quantity calculation rules for specific discount groups
Note: Unlike price group quantity calculation, this does not filter by customer price group,
as discount groups are independent of customer price group assignments.
If IsHandled is set to TRUE, the standard quantity summation loop will be skipped.
OnGetTotalItemQtyOnAfterSetFilterServiceLine(Record Service Line, Record Service Line, Decimal, Boolean) :#
Summary: Integration event that allows customization of total quantity calculation for specific items.
[IntegrationEvent(false, false)]
local procedure OnGetTotalItemQtyOnAfterSetFilterServiceLine(CurrentServiceLine: Record "Service Line"; var ServiceLine: Record "Service Line"; var TotalQty: Decimal; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServicePriceCalcLib", 'OnGetTotalItemQtyOnAfterSetFilterServiceLine', '', false, false)]
local procedure DoSomethingOnGetTotalItemQtyOnAfterSetFilterServiceLine(CurrentServiceLine: Record "Service Line"; var ServiceLine: Record "Service Line"; var TotalQty: Decimal; var IsHandled: Boolean)
begin
end;
Parameters:
CurrentServiceLine: Current Service Line for which total is being calculated.ServiceLine: Filtered Service Line recordset; subscribers can modify filters.TotalQty: Total quantity calculated; subscribers can modify this value.IsHandled: Set to TRUE to skip standard quantity summation logic.
Remarks: This event fires in GetTotalItemQty after filters have been set but before summing quantities across service lines with the same item. Standard filters applied include: - Same item number and variant code (if variant pricing is not blocked) - Same customer price group - Same unit of measure and quantity per unit of measure - Lines eligible for quantity summing (via FilterServLineToSumUpQty)
Subscribers can:
- Add additional filters to ServiceLine
- Calculate TotalQty using custom logic and set IsHandled = TRUE
- Modify TotalQty after standard calculation (if IsHandled = FALSE)
- Implement special quantity calculation rules for specific items or scenarios
- Add logging or validation
This is the most specific quantity calculation (item-level) compared to price group or discount
group calculations. It's used when prices are based on total quantity of a specific item/variant
combination ordered in the document.
If IsHandled is set to TRUE, the standard quantity summation loop will be skipped.
OnAfterFilterServLineToSumUpQty(Record Service Line, Record Service Line) :#
Summary: Integration event that allows additional filtering after standard quantity summing filters are applied.
[IntegrationEvent(false, false)]
local procedure OnAfterFilterServLineToSumUpQty(CurrentServiceLine: Record "Service Line"; var ServiceLine: Record "Service Line"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServicePriceCalcLib", 'OnAfterFilterServLineToSumUpQty', '', false, false)]
local procedure DoSomethingOnAfterFilterServLineToSumUpQty(CurrentServiceLine: Record "Service Line"; var ServiceLine: Record "Service Line")
begin
end;
Parameters:
CurrentServiceLine: Current Service Line providing context for filtering.ServiceLine: Service Line recordset with filters; subscribers can add more filters.
Remarks: This event fires in FilterServLineToSumUpQty after setting filters specific to the current service line. Standard filters already applied include: - Same unit of measure code - Same quantity per unit of measure - Base filters from FilterServLineToSumUpQty2 (shipment status, not billable, warranty, etc.)
Subscribers can add custom filters such as:
- Additional custom fields that should match
- Location or bin filters
- Customer-specific requirements
- Date range restrictions
This event provides more context than OnAfterSetFilterServiceLineToSumUpQty2 because it includes
the CurrentServiceLine parameter, allowing filters based on current line's specific values.
The filtered recordset is used in GetTotalItemQty, GetTotalItemPriceGrpQty, and GetTotalItemDiscGrpQty
to determine which lines' quantities should be summed for graduated pricing calculations.
SetFilterInAddItemToPriceCalcBuffer(Record KVSKBASalesPurchPriceCalcBuf, Record Service Line, Record Service Header) :#
Summary: Integration event that allows additional filtering when checking for existing buffer entries.
[IntegrationEvent(false, false)]
local procedure SetFilterInAddItemToPriceCalcBuffer(var TempKVSKBASalesPurchPriceCalcBuf: Record "KVSKBASalesPurchPriceCalcBuf" temporary; ServiceLine: Record "Service Line"; ServiceHeader: Record "Service Header"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServicePriceCalcLib", 'SetFilterInAddItemToPriceCalcBuffer', '', false, false)]
local procedure DoSomethingSetFilterInAddItemToPriceCalcBuffer(var TempKVSKBASalesPurchPriceCalcBuf: Record "KVSKBASalesPurchPriceCalcBuf" temporary; ServiceLine: Record "Service Line"; ServiceHeader: Record "Service Header")
begin
end;
Parameters:
TempKVSKBASalesPurchPriceCalcBuf: Temporary buffer recordset; subscribers can add filters.ServiceLine: Service Line being added to the buffer.ServiceHeader: Service Header for the document.
Remarks: This event fires in AddItemToPriceCalcBuffer after standard filters have been set to check if an equivalent buffer entry already exists. Standard filters include: - Same item number and variant code (if variant pricing is not blocked) - Same customer price group - Same unit of measure and quantity per unit of measure
Subscribers can add custom filters to make the uniqueness check more or less strict:
- Add filters for custom fields that should be part of the unique key
- Implement special grouping logic
- Add location or other dimension filters
If no matching entry is found after filtering, a new buffer entry will be created.
If a match is found, no new entry is created (preventing duplicate processing).
This affects which item configurations are considered unique and need separate price updates
in price calculation operations.