KVSFCYCalcStandardUnitCost#
Procedures#
CalcItems(Record Item, Boolean, Boolean, Boolean) :#
Summary: Calculates standard unit costs for a collection of items with comprehensive cost analysis. This is the main calculation procedure that processes multiple items to determine their standard costs including material, capacity, overhead, and additional charges. The procedure handles both single-level and multi-level BOM calculations, applies calculation parameters based on date ranges, and manages cost roll-up calculations throughout the entire BOM structure. It generates detailed calculation worksheets and tracks calculation errors for quality assurance. The procedure supports both manufactured and purchased items with flexible calculation conditions and parameter management.
procedure CalcItems(var itemVar: Record "Item"; showDialogPar: Boolean; var rolledUpVar: Boolean; var errorInsertedVar: Boolean):
Parameters:
itemVar: Item record collection passed by reference - items to calculate standard costs forshowDialogPar: Whether to display progress dialog during calculation processrolledUpVar: Returns true if rolled-up calculations were performed across BOM structureserrorInsertedVar: Returns true if any calculation errors were encountered and logged during the process
SetProperties(Date, Text[80], Boolean) :#
Summary: Sets the basic properties for standard unit cost calculations. This is a simplified overload that configures the essential calculation parameters without specifying a calculation worksheet name. The procedure sets up the calculation date, batch description, and parameter filtering options that will be used throughout the cost calculation process. This overload automatically uses an empty calculation worksheet name by calling the full SetProperties procedure with default values.
procedure SetProperties(calcDate: Date; calcBatchDescription: Text[80]; onlyDefault: Boolean):
Parameters:
calcDate: The date to use for calculation parameter filtering and cost calculationscalcBatchDescription: Description text for the calculation batch to identify the calculation runonlyDefault: Whether to use only default calculation parameters (true) or include all valid parameters (false)
SetProperties(Date, Text[80], Boolean, Code[10]) :#
Summary: Sets comprehensive properties for standard unit cost calculations with full configuration options. This is the main configuration procedure that establishes all calculation parameters including calculation date for parameter validity checks, batch description for identification, parameter filtering options, and optional calculation worksheet name for planning scenarios. The procedure initializes the General Ledger Setup for rounding precision and other financial settings that will be used throughout the calculation process. This comprehensive setup ensures proper calculation context for complex manufacturing cost scenarios.
procedure SetProperties(calcDatePar: Date; calculationBatchDescriptionPar: Text[80]; onlyDefaultPar: Boolean; calculationWkshNamePlanPar: Code[10]):
Parameters:
calcDatePar: The calculation date used for filtering calculation parameters by validity periodcalculationBatchDescriptionPar: Descriptive text for the calculation batch to identify and document the calculation runonlyDefaultPar: Whether to restrict calculations to only default parameters (true) or include all valid parameters within date range (false)calculationWkshNamePlanPar: Optional calculation worksheet name for planning scenarios - leave empty for standard calculations
Events#
OnBeforeRoutingErrorCheckRuntime(Record Routing Line, Decimal, Boolean, Boolean) :#
Summary: This event is triggered before checking routing runtime errors during standard cost calculation
[IntegrationEvent(false, false)]
local procedure OnBeforeRoutingErrorCheckRuntime(var routingLinePar: Record "Routing Line"; var quantityPar: Decimal; var ErrorInserted: Boolean; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSFCYCalcStandardUnitCost", 'OnBeforeRoutingErrorCheckRuntime', '', false, false)]
local procedure DoSomethingOnBeforeRoutingErrorCheckRuntime(var routingLinePar: Record "Routing Line"; var quantityPar: Decimal; var ErrorInserted: Boolean; var IsHandled: Boolean)
begin
end;
Parameters:
routingLinePar: The routing line being validated for runtime errorsquantityPar: The quantity parameter used for runtime validationErrorInserted: Indicates whether an error was found and inserted into the error logIsHandled: Set to true to skip the default runtime error checking logic
OnBeforeRoutingErrorCheckUnitCost(Record Routing Line, Record Work Center, Record Machine Center, Decimal, Boolean, Boolean) :#
Summary: This event is triggered before checking routing unit cost errors during standard cost calculation
[IntegrationEvent(false, false)]
local procedure OnBeforeRoutingErrorCheckUnitCost(var routingLinePar: Record "Routing Line"; var workCenterPar: Record "Work Center"; var machineCenterPar: Record "Machine Center"; var quantityPar: Decimal; var ErrorInserted: Boolean; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSFCYCalcStandardUnitCost", 'OnBeforeRoutingErrorCheckUnitCost', '', false, false)]
local procedure DoSomethingOnBeforeRoutingErrorCheckUnitCost(var routingLinePar: Record "Routing Line"; var workCenterPar: Record "Work Center"; var machineCenterPar: Record "Machine Center"; var quantityPar: Decimal; var ErrorInserted: Boolean; var IsHandled: Boolean)
begin
end;
Parameters:
routingLinePar: The routing line being validated for unit cost errorsworkCenterPar: The work center record containing cost informationmachineCenterPar: The machine center record containing cost informationquantityPar: The quantity parameter used for cost validationErrorInserted: Indicates whether an error was found and inserted into the error logIsHandled: Set to true to skip the default unit cost error checking logic
OnBeforeCalcValueForRouting(Record KVSFCYCalculationParameter, Record Routing Line, Record Work Center, Record Machine Center, Decimal, Integer, Integer, Decimal, Decimal) :#
Summary: This event is triggered before calculating values for routing during standard cost calculation
[IntegrationEvent(false, false)]
local procedure OnBeforeCalcValueForRouting(var CalculationParameter: Record "KVSFCYCalculationParameter"; var RoutingLine: Record "Routing Line"; WorkCenter: Record "Work Center"; MachineCenter: Record "Machine Center"; var Quantity: Decimal; Level: Integer; StructureBOMEntryNo: Integer; LotSizeHigherLevel: Decimal; QtyBaseHigherLevel: Decimal):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSFCYCalcStandardUnitCost", 'OnBeforeCalcValueForRouting', '', false, false)]
local procedure DoSomethingOnBeforeCalcValueForRouting(var CalculationParameter: Record "KVSFCYCalculationParameter"; var RoutingLine: Record "Routing Line"; WorkCenter: Record "Work Center"; MachineCenter: Record "Machine Center"; var Quantity: Decimal; Level: Integer; StructureBOMEntryNo: Integer; LotSizeHigherLevel: Decimal; QtyBaseHigherLevel: Decimal)
begin
end;
Parameters:
CalculationParameter: The calculation parameter record containing calculation settingsRoutingLine: The routing line record being processed for calculationWorkCenter: The work center record containing capacity informationMachineCenter: The machine center record containing capacity informationQuantity: The quantity to be calculatedLevel: The BOM level in the structure hierarchyStructureBOMEntryNo: The structure BOM entry number for trackingLotSizeHigherLevel: The lot size from the higher level in the BOM structureQtyBaseHigherLevel: The base quantity from the higher level in the BOM structure
OnBeforeInitCalcValues(Record KVSFCYCalculationValue, Record Routing Line, Boolean, Boolean) :#
Summary: This event is triggered before initializing calculation values during routing cost calculation
[IntegrationEvent(false, false)]
local procedure OnBeforeInitCalcValues(CalculationValue: Record "KVSFCYCalculationValue"; RoutingLine: Record "Routing Line"; Overhead: Boolean; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSFCYCalcStandardUnitCost", 'OnBeforeInitCalcValues', '', false, false)]
local procedure DoSomethingOnBeforeInitCalcValues(CalculationValue: Record "KVSFCYCalculationValue"; RoutingLine: Record "Routing Line"; Overhead: Boolean; var IsHandled: Boolean)
begin
end;
Parameters:
CalculationValue: The calculation value record being initializedRoutingLine: The routing line record providing the source dataOverhead: Indicates whether this is an overhead cost calculation (true) or direct cost (false)IsHandled: Set to true to skip the default initialization logic
OnBeforeSetExpectedCalcQtbBase(Record KVSFCYCalculationValue, Decimal, Record KVSFCYCalculationParameter, Record Routing Line, Record Work Center, Record Machine Center, Record KVSFCYCalculationValue, Record KVSFCYCalculationPart, Boolean) :#
Summary: This event is triggered before setting the expected calculation quantity base during routing cost calculation
[IntegrationEvent(false, false)]
local procedure OnBeforeSetExpectedCalcQtbBase(var CalculationValue: Record "KVSFCYCalculationValue"; var Quantity: Decimal; CalculationParameter: Record "KVSFCYCalculationParameter"; RoutingLine: Record "Routing Line"; var WorkCenter: Record "Work Center"; var MachineCenter: Record "Machine Center"; var SumLineCalculationValue: Record "KVSFCYCalculationValue"; var CalculationPart: Record "KVSFCYCalculationPart"; Overhead: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSFCYCalcStandardUnitCost", 'OnBeforeSetExpectedCalcQtbBase', '', false, false)]
local procedure DoSomethingOnBeforeSetExpectedCalcQtbBase(var CalculationValue: Record "KVSFCYCalculationValue"; var Quantity: Decimal; CalculationParameter: Record "KVSFCYCalculationParameter"; RoutingLine: Record "Routing Line"; var WorkCenter: Record "Work Center"; var MachineCenter: Record "Machine Center"; var SumLineCalculationValue: Record "KVSFCYCalculationValue"; var CalculationPart: Record "KVSFCYCalculationPart"; Overhead: Boolean)
begin
end;
Parameters:
CalculationValue: The calculation value record where the expected quantity will be setQuantity: The quantity value to be assigned as expected calculation quantity baseCalculationParameter: The calculation parameter record containing calculation settingsRoutingLine: The routing line record providing routing informationWorkCenter: The work center record containing capacity informationMachineCenter: The machine center record containing capacity informationSumLineCalculationValue: The sum line calculation value record for totalingCalculationPart: The calculation part record defining cost categorizationOverhead: Indicates whether this is an overhead cost calculation (true) or direct cost (false)