Conversion of Quantites

Rene70Rene70 Member Posts: 25
Hi all together,

I do have the following problem:

There is an item with two units
Unit 1: PCH
Unit 2: KG

In real life 1 PCH weighs 35g.

So the item units of measure would be
PCH 1
KG 28,5714286
(because Navision only calculates with a max. of 5 digits KG will be saved as 28,57143)

I'm making a pos. adjustment of 3040 PCH of this item.

If we want to sell 106,4 KG (that means 3040 PCH) the system wants to sell 3040,00015 PCH and an error occures because neg. inventory is not allowed (special programming in our database) :x

The error is easy to explain because of the 5 digits.

POSSIBLE SOLUTION: :idea:
What I realized was that even only 5 digits will be displayed it is possible to save more than 5 digits (up to 14) if you put them into the database by a report and a calculation.
For example:

"Item Unit of Measure"."Qty. per Unit of Measure" := 1/0.035;
"Item Unit of Measure".modify;

Then more than 5 digits are saved (can be controlled by setting a filter via F7 of the specific field of the specific recordset).

Afterwards everything works fine. All calculation are well done. :)

Now my question:´ :-k
I only did this in our test-database. Before installing this in our real db I want to know, if this is a good solution or if there are any traps I didn't realize so far. :?: :?: :?:

Thank for your comment.

Rene

Comments

  • jreynoldsjreynolds Member Posts: 175
    Our add-on does this and there have not been any problems for years and with many customers.
  • kinekine Member Posts: 12,562
    Yes, these "two units systems" (e.g. when you are selling meat - one piece has different weight each time, and you want exactly how much pieces you have and quantity in weight too...) are in most cases solved with some add-ons. It is not so easy to create solution for that.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Rene70Rene70 Member Posts: 25
    Thanks for your replies.

    Do your add-ons do it the way I described or is the problem much more complicated and I have to program some workarounds in several codeunits?
  • jreynoldsjreynolds Member Posts: 175
    Just let the Qty. per Unit of Measure field in the Item Unit of Measure table be stored with the maximum possible precision. This field will be copied to other tables (e.g. Sales Line, Item Journal Line) with the maximum precision. This is OK; in fact, it is what you want because you will then be using the greater precision on those tables when calculating base quantities. It is absolutely essential, however, that all quantities on document lines and journal lines be rounded to 5 decimal places. Fortunately, this rounding is already taking place (see, for example, the CalcBaseQty function in the Sales Line table).
Sign In or Register to comment.