1 (edited by apmuthu 11/20/2012 05:22:53 pm)

Topic: &$dec deprecated - report 301 bad dec

FA v2.3.13 Mer 3109

File: reporting/rep301.php lines 148 to 158 place the individual detail entries for the Inventory Valuation Report. The decimal formatting is not respected as the deprecated

&$dec

is used.

Lines 310 - 312 of includes/current_user.inc:

function price_decimal_format($number, &$dec)
{
    $dec = user_price_dec();

clearly do not take in the $dec from the function parameter.

This results in the kind of multi-decimal output in the report snapshot attached.

Post's attachments

Inventory Valuation Report Decimals.png 17.9 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

2 (edited by apmuthu 11/20/2012 05:34:14 pm)

Re: &$dec deprecated - report 301 bad dec

Attempting to fix includes/current_user.inc by replacing Line 310:

function price_decimal_format($number, &$dec)

with

function price_decimal_format($number, $dec)

by omitting the pass by reference, the Unit Cost column now has no decimals.

Even any forced value of $dec in Line 312 does not provide any decimals at all in the above attempted fix.

Post's attachments

Inventory Valuation Report Fixed.png 10.8 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: &$dec deprecated - report 301 bad dec

I am not at my work station at present. The decimals in the cost price is very important due to exactly calculation.

I am not sure what this is about. Will have a look at this later.

Joe

Re: &$dec deprecated - report 301 bad dec

No, No, the function price_decimal_format gets the $dec parameter updated from the decimals in the $number variable.

Everything is at it should be. price_decimal_format returns the formatted amount with de newly found decimals.

The decimal values returned in the $dec parameter can be used later for other things.

/Joe

Re: &$dec deprecated - report 301 bad dec

Yes I figured that out and filed Bug 1906 since the prices_dec field in the #_users table was not being respected for displaying the Unit Cost in the Inventory Valuation Report (rep301.php) as seen from the attachement in the first post in this topic for one item that has 10 decimals in it's Unit Cost.

Re: &$dec deprecated - report 301 bad dec

The cost prices can be entered  with more than user_price_dec decimals. This was implemented a couple of years ago, to compensate for huge rounding problems.
If you buy items from your supplier, you maybe buy in boxes with 100 or more items.
But you sell in 1 items. If you use user_price_dec decimals for your own price you may end up in huge differences in GL inventory.

If this is a problem, you can correct this in Items and Inventory tab, Cost Update. Just enter the cost with user_price_dec decimals for the items that has more than user_price_dec decimals.

I am not sure if this is wikied.

Joe

Re: &$dec deprecated - report 301 bad dec

Yes, it was wikied.

/Joe:

Re: &$dec deprecated - report 301 bad dec

Thanks Joe.

Setting 2 dec places in Items and Inventory -> Standard Costs did the job. Wikied it.