Item Card Replenishment Rounding Precision

I have searched, cannot find the answer, and need help.

We use backflushing for packaging materials using a routing link code. The BOM is set up to consume 1 box for every 1,500 pounds output of item A. So the components are 1 Qty per item A and 0.00067 boxes per. The problem we are having is that the majority of the time, they post over 1,500 pounds of item A. NAV then backflushes 2 boxes for every lot number output of item A. How do I force NAV to round to the nearest instead of always rounding up?? I have tried changing the code on table 5407 so that the GetNeededQty section no longer defines the direction to round, but that didn’t change the problem:

IF IncludePreviousPosting THEN BEGIN
IF Status IN [Status::Released,Status::Finished] THEN
CALCFIELDS(“Act. Consumption (Qty)”);
EXIT(
ROUND(
((CompQtyBase - “Act. Consumption (Qty)”) / “Qty. per Unit of Measure”),
Item.“Rounding Precision”)) // removed the sign
END ELSE
EXIT(ROUND(CompQtyBase / “Qty. per Unit of Measure”,Item.“Rounding Precision”)); // removed the sign
END ELSE
EXIT(ROUND(“Remaining Quantity”,Item.“Rounding Precision”));

What else can I do?? I am not a develpoer, but do have some idea how to navigate through the code.

The rounding precision on the box item card is set to 1.

We are using NAV 6.0 SP1

Any help would be greatly appreciated! Thanks.

Hi Brian,

Welcome to the Dynamics User Group.

You will need to change the rounding on the line after the GetNeededQty

IF NewStatus = NewStatus::Released THEN
QtyToPost := GetNeededQty(1,FALSE)
ELSE
QtyToPost := GetNeededQty(0,FALSE);
QtyToPost := ROUND(QtyToPost,Item.“Rounding Precision”,’>’);

A word of caution - if you are not a developer then you will need to test extensively to make sure this does no cause errors elsewhere.

Thank you Dave! I really appreciate your reply. Unfortunately, What I changed did not fix the problem.

This is the way our live database is set up :

GetNeededQty(CalcBasedOn : ‘Actual Output,Expected Output’;IncludePreviousPosting : Boolean) : Decimal
Item.GET(“Item No.”);
IF Item.“Rounding Precision” = 0 THEN
Item.“Rounding Precision” := 0.00001;

IF CalcBasedOn = CalcBasedOn::“Actual Output” THEN BEGIN
ProdOrderLine.GET(Status,“Prod. Order No.”,“Prod. Order Line No.”);

ProdOrderRtngLine.SETRANGE(Status,Status);
ProdOrderRtngLine.SETRANGE(“Prod. Order No.”,“Prod. Order No.”);
ProdOrderRtngLine.SETRANGE(“Routing No.”,ProdOrderLine.“Routing No.”);
ProdOrderRtngLine.SETRANGE(“Routing Reference No.”,ProdOrderLine.“Routing Reference No.”);
ProdOrderRtngLine.SETRANGE(“Routing Link Code”,“Routing Link Code”);
IF NOT ProdOrderRtngLine.FIND(’-’) OR (“Routing Link Code” = ‘’) THEN BEGIN
ProdOrderRtngLine.SETRANGE(“Routing Link Code”);
ProdOrderRtngLine.SETFILTER(“Next Operation No.”,’%1’,’’);
IF NOT ProdOrderRtngLine.FIND(’-’) THEN
ProdOrderRtngLine.“Operation No.” := ‘’;
END;
IF Status IN [Status::Released,Status::Finished] THEN BEGIN
CapLedgEntry.SETCURRENTKEY(“Prod. Order No.”,“Prod. Order Line No.”);
CapLedgEntry.SETRANGE(“Prod. Order No.”,“Prod. Order No.”);
CapLedgEntry.SETRANGE(“Prod. Order Line No.”,“Prod. Order Line No.”);
CapLedgEntry.SETRANGE(“Operation No.”,ProdOrderRtngLine.“Operation No.”);
IF CapLedgEntry.FIND(’-’) THEN
REPEAT
OutputQtyBase := OutputQtyBase + CapLedgEntry.“Output Quantity” + CapLedgEntry.“Scrap Quantity”;
UNTIL CapLedgEntry.NEXT = 0;
END;

CompQtyBase := CostCalcMgt.CalcActNeededQtyBase(ProdOrderLine,Rec,OutputQtyBase);

IF IncludePreviousPosting THEN BEGIN
IF Status IN [Status::Released,Status::Finished] THEN
CALCFIELDS(“Act. Consumption (Qty)”);
EXIT(
ROUND(
((CompQtyBase - “Act. Consumption (Qty)”) / “Qty. per Unit of Measure”),
Item.“Rounding Precision”,’>’))
END ELSE
EXIT(ROUND(CompQtyBase / “Qty. per Unit of Measure”,Item.“Rounding Precision”,’>’));
END ELSE
EXIT(ROUND(“Remaining Quantity”,Item.“Rounding Precision”));

When I post 1,550 pounds, NAV consumes 2 boxes instead of one as I need.

In our test company, I tried changing the code to the way I posted in the first post, which excluded the ‘>’, and that did not work. I also changed the sign to ‘<’ and NAV still consumed 2 boxes. I am stumped. Am I just missing what the code is doing or do I need to add the section of code you included?

Hi Brian,

Did you change the line in the calling function above?

If this doesn’t work - did you try using the debugger to see what is setting the value?

Old post, but seems wasn’t a solution.

On the Item card in Replenishment Tab check the Rounding Precision field. If the value is 1, system will round up to next integer. To disable any rounding you can put in 0. Or you can put 0.00001 so you get the precise amount of used item qty.

If you want to round down, then your current modifications will be needed.