KVSKBAPurchPriceCalcLib#
Procedures#
CollectOtherItemsOfPurchDoc(Record Purchase Header, Record Purchase Line, Boolean, Record KVSKBASalesPurchPriceCalcBuf, Boolean) :#
Summary: Collects other associated purchase lines of the purchase document.
procedure CollectOtherItemsOfPurchDoc(PurchaseHeader: Record "Purchase Header"; CurrentPurchaseLine: Record "Purchase Line"; IncludeCurrentPurchaseLine: Boolean; var TempSalesPurchPriceCalcBuf: Record "KVSKBASalesPurchPriceCalcBuf" temporary; DeleteAllBufferRecords: Boolean):
Parameters:
PurchaseHeader
: The purchase header record.CurrentPurchaseLine
: The current purchase line record.IncludeCurrentPurchaseLine
: Indicates whether to include the current purchase line.TempSalesPurchPriceCalcBuf
: The temporary sales purchase price calculation buffer.DeleteAllBufferRecords
: Indicates whether to delete all buffer records.
Remarks: This procedure collects combinations of item number, variant code, unit of measure code, etc. for purchase lines with different item numbers but the same "KVSKBAItemPriceGroup" as the current purchase line. Only purchase lines that are not excluded from summing up quantity in finding direct unit cost or line discount % are considered.
UpdateItemPurchLinesDirectUnitCost(Record KVSKBASalesPurchPriceCalcBuf, Record Purchase Header) :#
Summary: Updates "Direct Unit Cost" and "Line Discount %" of all item purchase document lines not excluded from summing up quantity in finding direct unit cost or line discount %.
procedure UpdateItemPurchLinesDirectUnitCost(SalesPurchPriceCalcBuf: Record "KVSKBASalesPurchPriceCalcBuf"; PurchaseHeader: Record "Purchase Header"):
Parameters:
SalesPurchPriceCalcBuf
: The sales purchase price calculation buffer record.PurchaseHeader
: The purchase header record.
Remarks: This procedure updates the "Direct Unit Cost" and "Line Discount %" for all item purchase document lines that are not excluded from summing up quantity in finding direct unit cost or line discount %. It first retrieves the first purchase line that matches the criteria, then recalculates the "Direct Unit Cost" and "Line Discount %", and finally copies these values to all other purchase lines of the same item, variant code, unit of measure code, etc.
UpdatePurchDocLinesDirectUnitCost(Record Purchase Header, Boolean, Boolean) : Boolean#
Summary: Updates "Direct Unit Cost" and "Line Discount %" of all item purchase document lines not excluded from summing up quantity in finding direct unit cost or line discount %.
procedure UpdatePurchDocLinesDirectUnitCost(PurchaseHeader: Record "Purchase Header"; WithConfirm: Boolean; ShowMessage: Boolean): Boolean
Parameters:
PurchaseHeader
: The purchase header record.WithConfirm
: Indicates whether to show a confirmation dialog before updating.ShowMessage
: Indicates whether to show a message if no lines are updated.
Returns: Returns TRUE if lines have been updated, otherwise FALSE.
Remarks: This procedure updates the "Direct Unit Cost" and "Line Discount %" for all item purchase document lines not excluded from summing up quantity in finding direct unit cost or line discount %.
Events#
OnBeforeOnIsDirectUnitCostUpdateOfOtherLinesRequiredOnCompareVariantCode(Boolean, Code[10], Code[10], Code[20]) :#
Summary: Triggered before checking if direct unit cost update of other lines is required on compare variant code.
[IntegrationEvent(false, false)]
local procedure OnBeforeOnIsDirectUnitCostUpdateOfOtherLinesRequiredOnCompareVariantCode(var ChangedVariantCode: Boolean; OldVariantCode: Code[10]; NewVariantCode: Code[10]; ItemNo: Code[20]):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPurchPriceCalcLib", 'OnBeforeOnIsDirectUnitCostUpdateOfOtherLinesRequiredOnCompareVariantCode', '', false, false)]
local procedure DoSomethingOnBeforeOnIsDirectUnitCostUpdateOfOtherLinesRequiredOnCompareVariantCode(var ChangedVariantCode: Boolean; OldVariantCode: Code[10]; NewVariantCode: Code[10]; ItemNo: Code[20])
begin
end;
Parameters:
ChangedVariantCode
: Indicates if the variant code has changed.OldVariantCode
: The old variant code.NewVariantCode
: The new variant code.ItemNo
: The item number.
Remarks: This event allows customization of the logic that determines if a direct unit cost update is required based on changes in the variant code. It can be used to modify the behavior of the direct unit cost update process when the variant code changes.
OnBeforeOnCollectOtherItemsOfPurchDocOnCompareVariantCode(Boolean, Code[10], Code[10], Code[20]) :#
Summary: Triggered before collecting other items of a purchase document on compare variant code.
[IntegrationEvent(false, false)]
local procedure OnBeforeOnCollectOtherItemsOfPurchDocOnCompareVariantCode(var ChangedVariantCode: Boolean; OldVariantCode: Code[10]; NewVariantCode: Code[10]; ItemNo: Code[20]):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPurchPriceCalcLib", 'OnBeforeOnCollectOtherItemsOfPurchDocOnCompareVariantCode', '', false, false)]
local procedure DoSomethingOnBeforeOnCollectOtherItemsOfPurchDocOnCompareVariantCode(var ChangedVariantCode: Boolean; OldVariantCode: Code[10]; NewVariantCode: Code[10]; ItemNo: Code[20])
begin
end;
Parameters:
ChangedVariantCode
: Indicates if the variant code has changed.OldVariantCode
: The old variant code.NewVariantCode
: The new variant code.ItemNo
: The item number.
Remarks: This event allows customization of the logic that determines if other item lines of a purchase document should be collected based on changes in the variant code.
OnBeforeOnPurchLinesDirectUnitCostOnCompareVariantCode(Boolean, Code[10], Code[10], Code[20]) :#
Summary: Triggered before comparing variant codes in purchase lines direct unit cost calculation.
[IntegrationEvent(false, false)]
local procedure OnBeforeOnPurchLinesDirectUnitCostOnCompareVariantCode(var ChangedVariantCode: Boolean; OldVariantCode: Code[10]; NewVariantCode: Code[10]; ItemNo: Code[20]):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPurchPriceCalcLib", 'OnBeforeOnPurchLinesDirectUnitCostOnCompareVariantCode', '', false, false)]
local procedure DoSomethingOnBeforeOnPurchLinesDirectUnitCostOnCompareVariantCode(var ChangedVariantCode: Boolean; OldVariantCode: Code[10]; NewVariantCode: Code[10]; ItemNo: Code[20])
begin
end;
Parameters:
ChangedVariantCode
: Indicates if the variant code has changed.OldVariantCode
: The old variant code.NewVariantCode
: The new variant code.ItemNo
: The item number.
Remarks: This event allows customization of the logic that determines if the variant code comparison should be modified when calculating direct unit cost in purchase lines. It can be used to change the behavior of the direct unit cost calculation process based on variant code changes.
OnIsPriceOrDiscMinQtyPerLineOnBeforeExitFalse(Record Purchase Header, Record Purchase Line, Boolean, Boolean) :#
Summary: Triggered before exiting the IsPriceOrDiscMinQtyPerLine function when it returns false.
[IntegrationEvent(false, false)]
local procedure OnIsPriceOrDiscMinQtyPerLineOnBeforeExitFalse(PurchaseHeader: Record "Purchase Header"; PurchaseLine: Record "Purchase Line"; var MinQtyIsPerLine: Boolean; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPurchPriceCalcLib", 'OnIsPriceOrDiscMinQtyPerLineOnBeforeExitFalse', '', false, false)]
local procedure DoSomethingOnIsPriceOrDiscMinQtyPerLineOnBeforeExitFalse(PurchaseHeader: Record "Purchase Header"; PurchaseLine: Record "Purchase Line"; var MinQtyIsPerLine: Boolean; var IsHandled: Boolean)
begin
end;
Parameters:
PurchaseHeader
: The purchase header record.PurchaseLine
: The purchase line record.MinQtyIsPerLine
: Indicates if the minimum quantity is per line.IsHandled
: Indicates if the event has been handled.
Remarks: This event allows customization of the logic that determines if a purchase line is excluded from summing up quantity in finding direct unit cost or line discount %. It can be used to modify the behavior of the IsPriceOrDiscMinQtyPerLine function when it returns false.
OnBeforeSetFilterPurchLineToSumUpQty(Record Purchase Line, Record Purchase Line) :#
Summary: Triggered before setting a filter on purchase lines to sum up quantity.
[IntegrationEvent(false, false)]
local procedure OnBeforeSetFilterPurchLineToSumUpQty(CurrentPurchaseLine: Record "Purchase Line"; var PurchaseLine: Record "Purchase Line"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPurchPriceCalcLib", 'OnBeforeSetFilterPurchLineToSumUpQty', '', false, false)]
local procedure DoSomethingOnBeforeSetFilterPurchLineToSumUpQty(CurrentPurchaseLine: Record "Purchase Line"; var PurchaseLine: Record "Purchase Line")
begin
end;
Parameters:
CurrentPurchaseLine
: The current purchase line record.PurchaseLine
: The purchase line record to which the filter is applied.
Remarks: This event allows customization of the filter logic applied to purchase lines when summing up quantities. It can be used to modify the criteria for selecting purchase lines based on the current purchase line.
OnCopyDirectUnitCostAndLineDiscToOtherLineOnBeforeModifyLine(Record Purchase Line, Record Purchase Line, Boolean) :#
Summary: Triggered before modifying a purchase line when copying direct unit cost and line discount to another line.
[IntegrationEvent(false, false)]
local procedure OnCopyDirectUnitCostAndLineDiscToOtherLineOnBeforeModifyLine(FromPurchaseLine: Record "Purchase Line"; var ToPurchaseLine: Record "Purchase Line"; var ModifyLine: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAPurchPriceCalcLib", 'OnCopyDirectUnitCostAndLineDiscToOtherLineOnBeforeModifyLine', '', false, false)]
local procedure DoSomethingOnCopyDirectUnitCostAndLineDiscToOtherLineOnBeforeModifyLine(FromPurchaseLine: Record "Purchase Line"; var ToPurchaseLine: Record "Purchase Line"; var ModifyLine: Boolean)
begin
end;
Parameters:
FromPurchaseLine
: The purchase line from which values are copied.ToPurchaseLine
: The purchase line to which values are copied.ModifyLine
: Indicates if the line should be modified.
Remarks: This event allows customization of the logic that determines if a purchase line should be modified when copying direct unit cost and line discount from one purchase line to another. It can be used to add additional conditions or logic before the modification occurs.