#### Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Options

# Unit Cost Calculation

Member Posts: 142
edited 2014-09-23
Hello Experts,
I will like to know if the unit cost calculated on the item card included Routing information (i.e cost of machine centers capacities)

Thanks

• Options
Member Posts: 17
Good afternoon,

I trust Nav does use the available routing info (or appropriate routing version) when one performs the following:
Item Card: Item => Manufa&cturing => Calc. Stan&dard Cost
User selects: Single Level OR All Levels
Then the calculation takes place: it's rather a boring reading, just in case you're really interested, you can have a look at the "OnPush" code => CU 5812 Calculate Standard Cost => CU 5836 Cost Calculation Management

Kind regards,
Pav.

==========================
```<Control123> - OnPush()
CLEAR(CalculateStdCost);
CalculateStdCost.CalcItem("No.",FALSE);
```
==========================

CU 5812 Calculate Standard Cost

CalcItem(ItemNo : Code[20];NewUseAssemblyList : Boolean)
```CASE STRMENU(Text001) OF
0:
EXIT;
1:
NewCalcMultiLevel := FALSE;
2:
NewCalcMultiLevel := TRUE;
END;

SetProperties(WORKDATE,NewCalcMultiLevel,NewUseAssemblyList,FALSE,'',FALSE);

IF NewUseAssemblyList THEN
CalcAssemblyItem(ItemNo,Item,0)
ELSE
CalcMfgItem(ItemNo,Item,0);

IF TempItem.FIND('-') THEN
REPEAT
UNTIL TempItem.NEXT = 0;
```

```CalcMfgItem(ItemNo : Code[20];VAR Item : Record Item;Level : Integer)
IF Level > MaxLevel THEN
ERROR(Text000,MaxLevel);

IF GetItem(ItemNo,Item) THEN
EXIT;

IF NOT CalcMultiLevel AND (Level <> 0) THEN
EXIT;

WITH Item DO BEGIN
LotSize := 1;

IF IsMfgItem THEN BEGIN
IF "Lot Size" <> 0 THEN
LotSize := "Lot Size";
CalcRtngCost("Routing No.",MfgItemQtyBase,SLCap,SLSub,SLCapOvhd);
CalcProdBOMCost(
Item,"Production BOM No.","Routing No.",
MfgItemQtyBase,TRUE,Level,SLMat,RUMat,RUCap,RUSub,RUCapOvhd,RUMfgOvhd);
SLMfgOvhd :=
CostCalcMgt.CalcOvhdCost(
SLMat + SLCap + SLSub + SLCapOvhd,
"Last Unit Cost Calc. Date" := CalculationDate;
END ELSE BEGIN
SLMat := "Unit Cost";
RUMat := "Unit Cost";
END;

"Single-Level Material Cost" := CalcCostPerUnit(SLMat,LotSize);
"Single-Level Capacity Cost" := CalcCostPerUnit(SLCap,LotSize);
"Single-Level Subcontrd. Cost" := CalcCostPerUnit(SLSub,LotSize);
"Single-Level Cap. Ovhd Cost" := CalcCostPerUnit(SLCapOvhd,LotSize);
"Single-Level Mfg. Ovhd Cost" := CalcCostPerUnit(SLMfgOvhd,LotSize);
"Rolled-up Material Cost" := CalcCostPerUnit(RUMat,LotSize);
"Rolled-up Capacity Cost" := CalcCostPerUnit(RUCap + SLCap,LotSize);
"Rolled-up Subcontracted Cost" := CalcCostPerUnit(RUSub + SLSub,LotSize);
"Rolled-up Cap. Overhead Cost" := CalcCostPerUnit(RUCapOvhd + SLCapOvhd,LotSize);
"Rolled-up Mfg. Ovhd Cost" := CalcCostPerUnit(RUMfgOvhd + SLMfgOvhd,LotSize);
"Standard Cost" :=
"Single-Level Material Cost" +
"Single-Level Capacity Cost" +
"Single-Level Subcontrd. Cost" +
"Single-Level Cap. Ovhd Cost" +
"Single-Level Mfg. Ovhd Cost";
END;

TempItem := Item;
TempItem.INSERT;
```

```CalcRtngCost(RtngHeaderNo : Code[20];MfgItemQtyBase : Decimal;VAR SLCap : Decimal;VAR SLSub : Decimal;VAR SLCapOvhd : Decimal)
EXIT;

RtngVersionCode :=

WITH RtngLine DO BEGIN
SETRANGE("Version Code",RtngVersionCode);
IF FIND('-') THEN
REPEAT
IF (Type = Type::"Work Center") AND
("No." <> '')
THEN
WorkCenter.GET("No.")
ELSE
CLEAR(WorkCenter);
UnitCost := "Unit Cost per";
CalcRtngCostPerUnit(Type,"No.",DirUnitCost,IndirCostPct,OvhdRate,UnitCost,UnitCostCalculation);
CostTime :=
CostCalcMgt.CalcCostTime(
MfgItemQtyBase,
"Setup Time","Setup Time Unit of Meas. Code",
"Run Time","Run Time Unit of Meas. Code","Lot Size",
"Scrap Factor % (Accumulated)","Fixed Scrap Qty. (Accum.)",
"Work Center No.",UnitCostCalculation,MfgSetup."Cost Incl. Setup",
"Concurrent Capacities");
IF (Type = Type::"Work Center") AND
(WorkCenter."Subcontractor No." <> '')
THEN
IncrCost(SLSub,DirUnitCost,CostTime)
ELSE
IncrCost(SLCap,DirUnitCost,CostTime);
IncrCost(SLCapOvhd,CostCalcMgt.CalcOvhdCost(DirUnitCost,IndirCostPct,OvhdRate,1),CostTime);
UNTIL NEXT = 0;
END;
```

```CalcRtngCostPerUnit(Type : 'Work Center,Machine Center, ';No : Code[20];VAR DirUnitCost : Decimal;VAR IndirCostPct : Decimal;VAR OvhdRa
CASE Type OF
Type::"Work Center":
GetWorkCenter(No,WorkCenter);
Type::"Machine Center":
GetMachineCenter(No,MachineCenter);
END;
CostCalcMgt.RoutingCostPerUnit2(Type,DirUnitCost,IndirCostPct,OvhdRate,UnitCost,UnitCostCalculation,WorkCenter,MachineCenter);
```

CU 5836 Cost Calculation Management

```RoutingCostPerUnit(Type : 'Work Center,Machine Center, ';No : Code[20];VAR DirUnitCost : Decimal;VAR IndirCostPct : Decimal;VAR OvhdRat
CASE Type OF
Type::"Work Center":
WorkCenter.GET(No);
Type::"Machine Center":
MachineCenter.GET(No);
END;
RoutingCostPerUnit2(Type,DirUnitCost,IndirCostPct,OvhdRate,UnitCost,UnitCostCalculation,WorkCenter,MachineCenter);
```

```RoutingCostPerUnit2(Type : 'Work Center,Machine Center, ';VAR DirUnitCost : Decimal;VAR IndirCostPct : Decimal;VAR OvhdRate : Decimal;V
UnitCostCalculation := UnitCostCalculation::Time;
CASE Type OF
Type::"Work Center":
BEGIN
UnitCostCalculation := WorkCenter."Unit Cost Calculation";
IndirCostPct := WorkCenter."Indirect Cost %";
IF WorkCenter."Specific Unit Cost" THEN BEGIN
DirUnitCost := CalcDirUnitCost(UnitCost,OvhdRate,IndirCostPct);
END ELSE BEGIN
DirUnitCost := WorkCenter."Direct Unit Cost";
UnitCost := WorkCenter."Unit Cost";
END;
END;
Type::"Machine Center":
BEGIN
MachineCenter.TESTFIELD("Work Center No.");
DirUnitCost := MachineCenter."Direct Unit Cost";