Codeunit ItemCostManagement

ID 5804
Namespace: Microsoft.Inventory.Costing

Properties

Name Value
Permissions TableData Item = rm, TableData "Stockkeeping Unit" = rm, TableData "Value Entry" = r

Methods

IsItemUnitCostUpdated

procedure IsItemUnitCostUpdated(): Boolean

Returns

Type Description
Boolean

UpdateUnitCost

procedure UpdateUnitCost(var Item: Record Item, LocationCode: Code[10], VariantCode: Code[10], LastDirectCost: Decimal, NewStdCost: Decimal, UpdateSKU: Boolean, FilterSKU: Boolean, RecalcStdCost: Boolean, CalledByFieldNo: Integer)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
LocationCode Code[10]
VariantCode Code[10]
LastDirectCost Decimal
NewStdCost Decimal
UpdateSKU Boolean
FilterSKU Boolean
RecalcStdCost Boolean
CalledByFieldNo Integer

UpdateStdCostShares

procedure UpdateStdCostShares(FromItem: Record Item)

Parameters

Name Type Description
FromItem Table Microsoft.Inventory.Item.Item

UpdateStdCostSharesForSKU

procedure UpdateStdCostSharesForSKU(FromSKU: Record "Stockkeeping Unit")

Parameters

Name Type Description
FromSKU Table Microsoft.Inventory.Location."Stockkeeping Unit"

UpdateUnitCostSKU

procedure UpdateUnitCostSKU(Item: Record Item, var SKU: Record "Stockkeeping Unit", LastDirectCost: Decimal, NewStdCost: Decimal, MatchSKU: Boolean, CalledByFieldNo: Integer)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
SKU Table Microsoft.Inventory.Location."Stockkeeping Unit"
LastDirectCost Decimal
NewStdCost Decimal
MatchSKU Boolean
CalledByFieldNo Integer

CalculateAverageCost

procedure CalculateAverageCost(var Item: Record Item, var AverageCost: Decimal, var AverageCostACY: Decimal): Boolean

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
AverageCost Decimal
AverageCostACY Decimal

Returns

Type Description
Boolean

SetFilters

procedure SetFilters(var ValueEntry: Record "Value Entry", var Item: Record Item)

Parameters

Name Type Description
ValueEntry Table Microsoft.Inventory.Ledger."Value Entry"
Item Table Microsoft.Inventory.Item.Item

SetProperties

procedure SetProperties(NewCalledFromAdjustment: Boolean, NewInvoicedQty: Decimal)

Parameters

Name Type Description
NewCalledFromAdjustment Boolean
NewInvoicedQty Decimal

FindUpdateUnitCostSKU

procedure FindUpdateUnitCostSKU(Item: Record Item, LocationCode: Code[10], VariantCode: Code[10], FilterSKU: Boolean, LastDirectCost: Decimal)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
LocationCode Code[10]
VariantCode Code[10]
FilterSKU Boolean
LastDirectCost Decimal

Events

OnAfterCalculateQuantity

[IntegrationEvent(False,False)]
local procedure OnAfterCalculateQuantity(var ValueEntry: Record "Value Entry", var Item: Record Item, var CalcQty: Decimal)

Parameters

Name Type Description
ValueEntry Table Microsoft.Inventory.Ledger."Value Entry"
Item Table Microsoft.Inventory.Item.Item
CalcQty Decimal

OnAfterGetGLSetup

[IntegrationEvent(False,False)]
local procedure OnAfterGetGLSetup(var GeneralLedgerSetup: Record "General Ledger Setup")

Parameters

Name Type Description
GeneralLedgerSetup Table Microsoft.Finance.GeneralLedger.Setup."General Ledger Setup"

OnAfterExcludeOpenOutbndCosts

[IntegrationEvent(False,False)]
local procedure OnAfterExcludeOpenOutbndCosts(var Item: Record Item, var CostAmt: Decimal, var CostAmtACY: Decimal, var Quantity: Decimal)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
CostAmt Decimal
CostAmtACY Decimal
Quantity Decimal

OnAfterRecalcStdCostItem

[IntegrationEvent(False,False)]
local procedure OnAfterRecalcStdCostItem(var Item: Record Item)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item

OnAfterSetFilters

[IntegrationEvent(False,False)]
local procedure OnAfterSetFilters(var ValueEntry: Record "Value Entry", var Item: Record Item)

Parameters

Name Type Description
ValueEntry Table Microsoft.Inventory.Ledger."Value Entry"
Item Table Microsoft.Inventory.Item.Item

OnAfterUpdateUnitCostSKU

[IntegrationEvent(False,False)]
local procedure OnAfterUpdateUnitCostSKU(Item: Record Item, var StockkeepingUnit: Record "Stockkeeping Unit")

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
StockkeepingUnit Table Microsoft.Inventory.Location."Stockkeeping Unit"

OnBeforeCalcLastAdjEntryAvgCost

[IntegrationEvent(False,False)]
local procedure OnBeforeCalcLastAdjEntryAvgCost(var Item: Record Item, var AverageCost: Decimal, var AverageCostACY: Decimal, var AvgCostCalculated: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
AverageCost Decimal
AverageCostACY Decimal
AvgCostCalculated Boolean

OnBeforeCalculateCostAmount

[IntegrationEvent(False,False)]
local procedure OnBeforeCalculateCostAmount(var Item: Record Item, Actual: Boolean, var CostAmount: Decimal, var IsHandled: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
Actual Boolean
CostAmount Decimal
IsHandled Boolean

OnBeforeCalculateAverageCost

[IntegrationEvent(False,False)]
local procedure OnBeforeCalculateAverageCost(var Item: Record Item, var AverageCost: Decimal, var AverageCostACY: Decimal, var AvgCostCalculated: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
AverageCost Decimal
AverageCostACY Decimal
AvgCostCalculated Boolean

OnBeforeCalcUnitCostFromAverageCost

[IntegrationEvent(False,False)]
local procedure OnBeforeCalcUnitCostFromAverageCost(var Item: Record Item, var CostCalcMgt: Codeunit "Cost Calculation Management", GLSetup: Record "General Ledger Setup", var IsHandled: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
CostCalcMgt Codeunit Microsoft.Inventory.Costing."Cost Calculation Management"
GLSetup Table Microsoft.Finance.GeneralLedger.Setup."General Ledger Setup"
IsHandled Boolean

OnBeforeCheckUpdateLastDirectCost

[IntegrationEvent(False,False)]
local procedure OnBeforeCheckUpdateLastDirectCost(var Item: Record Item, LastDirectCost: Decimal, var IsHandled: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
LastDirectCost Decimal
IsHandled Boolean

OnBeforeUpdateUnitCost

[IntegrationEvent(False,False)]
local procedure OnBeforeUpdateUnitCost(var Item: Record Item, LocationCode: Code[10], VariantCode: Code[10], LastDirectCost: Decimal, NewStdCost: Decimal, UpdateSKU: Boolean, FilterSKU: Boolean, RecalcStdCost: Boolean, CalledByFieldNo: Integer, var UnitCostUpdated: Boolean, var CalledFromAdjustment: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
LocationCode Code[10]
VariantCode Code[10]
LastDirectCost Decimal
NewStdCost Decimal
UpdateSKU Boolean
FilterSKU Boolean
RecalcStdCost Boolean
CalledByFieldNo Integer
UnitCostUpdated Boolean
CalledFromAdjustment Boolean

OnBeforeUpdateUnitCostSKU

[IntegrationEvent(False,False)]
local procedure OnBeforeUpdateUnitCostSKU(Item: Record Item, var SKU: Record "Stockkeeping Unit", LastDirectCost: Decimal, NewStdCost: Decimal, MatchSKU: Boolean, CalledByFieldNo: Integer, var UnitCostUpdated: Boolean, var CalledFromAdjustment: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
SKU Table Microsoft.Inventory.Location."Stockkeeping Unit"
LastDirectCost Decimal
NewStdCost Decimal
MatchSKU Boolean
CalledByFieldNo Integer
UnitCostUpdated Boolean
CalledFromAdjustment Boolean

OnBeforeUpdateStdCostShares

[IntegrationEvent(False,False)]
local procedure OnBeforeUpdateStdCostShares(var Item: Record Item, var IsHandled: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
IsHandled Boolean

OnBeforeUpdateUnitCostFromLastDirectCost

[IntegrationEvent(False,False)]
local procedure OnBeforeUpdateUnitCostFromLastDirectCost(var Item: Record Item, LastDirectCost: Decimal, InvoicedQty: Decimal, var IsHandled: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
LastDirectCost Decimal
InvoicedQty Decimal
IsHandled Boolean

OnCalcLastAdjEntryAvgCostOnAfterCalcAverageCost

[IntegrationEvent(False,False)]
local procedure OnCalcLastAdjEntryAvgCostOnAfterCalcAverageCost(ItemLedgEntry: Record "Item Ledger Entry", ValueEntry: Record "Value Entry", var Item: Record Item, var AverageCost: Decimal, var AverageCostACY: Decimal)

Parameters

Name Type Description
ItemLedgEntry Table Microsoft.Inventory.Ledger."Item Ledger Entry"
ValueEntry Table Microsoft.Inventory.Ledger."Value Entry"
Item Table Microsoft.Inventory.Item.Item
AverageCost Decimal
AverageCostACY Decimal

OnCalculateAverageCostOnAfterCalcAverageQty

[IntegrationEvent(False,False)]
local procedure OnCalculateAverageCostOnAfterCalcAverageQty(var Item: Record Item, var AverageCost: Decimal, var AverageCostACY: Decimal, var AverageQty: Decimal)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
AverageCost Decimal
AverageCostACY Decimal
AverageQty Decimal

OnExcludeOpenOutbndCostsOnAfterOpenItemLedgEntrySetFilters

[IntegrationEvent(False,False)]
local procedure OnExcludeOpenOutbndCostsOnAfterOpenItemLedgEntrySetFilters(var OpenItemLedgEntry: Record "Item Ledger Entry", var Item: Record Item)

Parameters

Name Type Description
OpenItemLedgEntry Table Microsoft.Inventory.Ledger."Item Ledger Entry"
Item Table Microsoft.Inventory.Item.Item

OnUpdateUnitCostOnAfterCalcRunOnModifyTrigger

[IntegrationEvent(False,False)]
local procedure OnUpdateUnitCostOnAfterCalcRunOnModifyTrigger(var Item: Record Item, var RunOnModifyTrigger: Boolean, CalledByFieldNo: Integer)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
RunOnModifyTrigger Boolean
CalledByFieldNo Integer

OnUpdateUnitCostOnBeforeNetInvoiceQtyCheck

[IntegrationEvent(False,False)]
local procedure OnUpdateUnitCostOnBeforeNetInvoiceQtyCheck(Item: Record Item, var IsHandled: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
IsHandled Boolean

OnUpdateUnitCostOnBeforeUpdateSKU

[IntegrationEvent(False,False)]
local procedure OnUpdateUnitCostOnBeforeUpdateSKU(var Item: Record Item, var UpdateSKU: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
UpdateSKU Boolean

OnUpdateUnitCostOnBeforeValidatePriceProfitCalculation

[IntegrationEvent(False,False)]
local procedure OnUpdateUnitCostOnBeforeValidatePriceProfitCalculation(var Item: Record Item, var IsHandled: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
IsHandled Boolean

OnUpdateUnitCostSKUOnBeforeMatchSKU

[IntegrationEvent(False,False)]
local procedure OnUpdateUnitCostSKUOnBeforeMatchSKU(var StockkeepingUnit: Record "Stockkeeping Unit", Item: Record Item)

Parameters

Name Type Description
StockkeepingUnit Table Microsoft.Inventory.Location."Stockkeeping Unit"
Item Table Microsoft.Inventory.Item.Item

OnUpdateStdCostSharesOnAfterCopyCosts

[IntegrationEvent(False,False)]
local procedure OnUpdateStdCostSharesOnAfterCopyCosts(var Item: Record Item, FromItem: Record Item)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
FromItem Table Microsoft.Inventory.Item.Item

OnAfterUpdateUnitCost

[IntegrationEvent(False,False)]
local procedure OnAfterUpdateUnitCost(var Item: Record Item, CalledByFieldNo: Integer)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
CalledByFieldNo Integer

OnUpdateUnitCostSKUOnBeforeCalcNonItemAvgCostCalcType

[IntegrationEvent(False,False)]
local procedure OnUpdateUnitCostSKUOnBeforeCalcNonItemAvgCostCalcType(Item: Record Item, var SKU: Record "Stockkeeping Unit", CalledFromAdjustment: Boolean, var IsHandled: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
SKU Table Microsoft.Inventory.Location."Stockkeeping Unit"
CalledFromAdjustment Boolean
IsHandled Boolean

OnFindUpdateUnitCostSKUOnBeforeLoopUpdateUnitCostSKU

[IntegrationEvent(False,False)]
local procedure OnFindUpdateUnitCostSKUOnBeforeLoopUpdateUnitCostSKU(var SKU: Record "Stockkeeping Unit", FilterSKU: Boolean)

Parameters

Name Type Description
SKU Table Microsoft.Inventory.Location."Stockkeeping Unit"
FilterSKU Boolean

OnUpdateUnitCostSKUOnAfterSetSKUUnitCosts

[IntegrationEvent(False,False)]
local procedure OnUpdateUnitCostSKUOnAfterSetSKUUnitCosts(var SKU: Record "Stockkeeping Unit", var Item: Record Item, var InvoicedQty: Decimal, var LastDirectCost: Decimal)

Parameters

Name Type Description
SKU Table Microsoft.Inventory.Location."Stockkeeping Unit"
Item Table Microsoft.Inventory.Item.Item
InvoicedQty Decimal
LastDirectCost Decimal

OnCalculateAverageCostOnAfterCalculateAverage

[IntegrationEvent(False,False)]
local procedure OnCalculateAverageCostOnAfterCalculateAverage(var Item: Record Item, var AverageCost: Decimal, var AverageCostACY: Decimal, var IsHandled: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
AverageCost Decimal
AverageCostACY Decimal
IsHandled Boolean

OnCalculatePreciseCostAmountsOnAfterFilterOpenInboundItemLedgerEntry

[IntegrationEvent(False,False)]
local procedure OnCalculatePreciseCostAmountsOnAfterFilterOpenInboundItemLedgerEntry(OpenInbndItemLedgerEntry: Record "Item Ledger Entry", var Item: Record Item)

Parameters

Name Type Description
OpenInbndItemLedgerEntry Table Microsoft.Inventory.Ledger."Item Ledger Entry"
Item Table Microsoft.Inventory.Item.Item

OnUpdateUnitCostSKUOnBeforeCheckNegCost

[IntegrationEvent(False,False)]
local procedure OnUpdateUnitCostSKUOnBeforeCheckNegCost(var AverageCost: Decimal, var IsHandled: Boolean)

Parameters

Name Type Description
AverageCost Decimal
IsHandled Boolean

OnCalcLastAdjEntryAvgCostOnBeforeSetFilters

[IntegrationEvent(False,False)]
local procedure OnCalcLastAdjEntryAvgCostOnBeforeSetFilters(var ValueEntry: Record "Value Entry", var Item: Record Item, var AverageCost: Decimal, var AverageCostACY: Decimal, var AvgCostCalculated: Boolean)

Parameters

Name Type Description
ValueEntry Table Microsoft.Inventory.Ledger."Value Entry"
Item Table Microsoft.Inventory.Item.Item
AverageCost Decimal
AverageCostACY Decimal
AvgCostCalculated Boolean

OnCalculatePreciseCostAmountsOnBeforeProcessOpenOutboundItemLedgerEntry

[IntegrationEvent(False,False)]
local procedure OnCalculatePreciseCostAmountsOnBeforeProcessOpenOutboundItemLedgerEntry(var Item: Record Item, var OpenInboundItemLedgEntry: Record "Item Ledger Entry", var OpenOutboundItemLedgEntry: Record "Item Ledger Entry", var TempItemLedgerEntry: Record "Item Ledger Entry" temporary, var IsHandled: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
OpenInboundItemLedgEntry Table Microsoft.Inventory.Ledger."Item Ledger Entry"
OpenOutboundItemLedgEntry Table Microsoft.Inventory.Ledger."Item Ledger Entry"
TempItemLedgerEntry Table Microsoft.Inventory.Ledger."Item Ledger Entry"
IsHandled Boolean

OnCalculatePreciseCostAmountsOnOnBeforeProcessTempItemLedgerEntry

[IntegrationEvent(False,False)]
local procedure OnCalculatePreciseCostAmountsOnOnBeforeProcessTempItemLedgerEntry(var TempItemLedgerEntry: Record "Item Ledger Entry" temporary, var PreciseAmt: Decimal, var IsHandled: Boolean)

Parameters

Name Type Description
TempItemLedgerEntry Table Microsoft.Inventory.Ledger."Item Ledger Entry"
PreciseAmt Decimal
IsHandled Boolean

OnBeforeCalculatePreciseCostAmounts

[IntegrationEvent(False,False)]
local procedure OnBeforeCalculatePreciseCostAmounts(var Item: Record Item, NeedCalcPreciseAmt: Boolean, NeedCalcPreciseAmtACY: Boolean, var PreciseAmt: Decimal, var PreciseAmtACY: Decimal, var IsHandled: Boolean)

Parameters

Name Type Description
Item Table Microsoft.Inventory.Item.Item
NeedCalcPreciseAmt Boolean
NeedCalcPreciseAmtACY Boolean
PreciseAmt Decimal
PreciseAmtACY Decimal
IsHandled Boolean

See also