Topic: Inventory Valuation

FA release 2.3.19 produces the following wrong result:

1. Create an inventory item called "unit cost test" (or any name you want)
2. Post an inventory adjustment of 1 unit at a cost of $2 to this new item.
3. Check the inventory valuation report - it will show, as expected, 1 unit at $2 each = Total value of $2
4. Post another inventory adjustment to the new item of 1 unit at $8.
5. Check the inventory valuation report - it will show, as expected, 2 units at $5 each = Total value of $10
6. Now void the second inventory adjustment.
7. Check the inventory valuation report - it will show 1 unit at a cost of minus $237.6784 = Total value of minus$237.6784
8. I would expect to see 1 unit at $2 each = Total value of $2.

Why is this?  I'm not a programmer. I can't go into the code to fix it.
Can this be corrected?

I tried the same thing as above but using supplier invoices instead of inventory journals.  It works correctly.

Re: Inventory Valuation

Seems to be some problems during voiding. Will have a look at this.

/Joe

Re: Inventory Valuation

This has now been fixed. The HG repository has been updated and the fix will go to next minor release.

You can download a fixed file here .

/Joe

Re: Inventory Valuation

thanks Joe. Appreciated.

Re: Inventory Valuation

The fix worked, tx !!!
Although it is not in the 2.3.21 version. Any plan to update ? tx again

6 (edited by ichtus 09/20/2018 12:23:39 pm)

Re: Inventory Valuation

found same problem in FA 2.4.4
step to reproduce
1. add item a with purchase value 1.8million idr(po,inv, price calculate before tax)
FA show correct qty 1 with correct standard price
2. sell items as we have input wrong selling price, a price 13million (so, invoice)
3. credit this from the invoice pages
FA show correct qty as item refund,
qty show 1 price 13million
standard price correct (in the item status)
4. Inventory valuation report show
Qty in 2 out 1
Value -5.6million

It should show valuation price 1.8 million, how we can fix this as in the items status show no any value minus 5.6million.

Re: Inventory Valuation

@joe: does this need a fix in FA 2.4.4?

Re: Inventory Valuation

Hello guys,

We have been working on this Inventory Valuation for I don't know how long.
Please try to help me locate the issue, if any.

Joe

9 (edited by ichtus 09/21/2018 08:42:24 am)

Re: Inventory Valuation

Hi Joe,

I have troubleshooting rep301.php

function get_domestic_price($myrow, $stock_id)
{
        if ($myrow['type'] == ST_SUPPRECEIVE || $myrow['type'] == ST_SUPPCREDIT)
        {
                #below using standard_cost, change price to standard_cost
                $price = $myrow['price'];
                #$price = $myrow['standard_cost'];
                if ($myrow['person_id'] > 0)
                {
                        // Do we have foreign currency?
                        $supp = get_supplier($myrow['person_id']);
                        $currency = $supp['curr_code'];
                        $ex_rate = get_exchange_rate_to_home_currency($currency, sql2date($myrow['tran_date']));
                        $price /= $ex_rate;
                }
        }
        else
                $price = $myrow['standard_cost']; // Item Adjustments just have the real cost
        return $price;
}

sql query adding for currency type

SELECT move.*, move.type, debtor.curr_code, supplier.supplier_id, supplier.curr_code FROM 23_stock_moves move LEFT JOIN 23_supp_trans credit ON credit.trans_no=move.trans_no AND credit.type=move.type LEFT JOIN 23_grn_batch grn ON grn.id=move.trans_no AND 25=move.type LEFT JOIN 23_suppliers supplier ON IFNULL(grn.supplier_id, credit.supplier_id)=supplier.supplier_id LEFT JOIN 23_debtor_trans cust_trans ON cust_trans.trans_no=move.trans_no AND cust_trans.type=move.type LEFT JOIN 23_debtors_master debtor ON cust_trans.debtor_no=debtor.debtor_no WHERE stock_id=8996969010247;
+----------+----------+---------------+------+----------+------------+--------+-----------+-----+-----------------+------+-----------+-------------+-----------+
| trans_id | trans_no | stock_id      | type | loc_code | tran_date  | price  | reference | qty | standard_cost   | type | curr_code | supplier_id | curr_code |
+----------+----------+---------------+------+----------+------------+--------+-----------+-----+-----------------+------+-----------+-------------+-----------+
|      287 |       63 | 8996969010247 |   25 | SUB      | 2016-10-11 | 260000 |           |  10 |          260000 |   25 | NULL      |          17 | IDR       |
|      317 |        2 | 8996969010247 |   17 | SUB      | 2016-10-10 |      0 | 2         |   5 |          380000 |   17 | NULL      |        NULL | NULL      |
|      328 |       61 | 8996969010247 |   13 | SUB      | 2016-10-18 | 315000 | auto      | -10 |          300000 |   13 | IDR       |        NULL | NULL      |
|      765 |      191 | 8996969010247 |   25 | SUB      | 2017-01-23 | 210000 |           |  10 |          240000 |   25 | NULL      |          17 | IDR       |
|      774 |      135 | 8996969010247 |   13 | SUB      | 2017-01-31 | 215250 | auto      | -10 |          240000 |   13 | IDR       |        NULL | NULL      |
|     1317 |      384 | 8996969010247 |   25 | SUB      | 2017-05-23 |     17 |           |   1 |          225000 |   25 | NULL      |          17 | IDR       |
|     1334 |      245 | 8996969010247 |   13 | SUB      | 2017-05-26 | 153750 | auto      |  -1 |          225000 |   13 | IDR       |        NULL | NULL      |
|     1495 |      439 | 8996969010247 |   25 | SUB      | 2017-07-11 |     17 |           |  10 | 171666.66666667 |   25 | NULL      |          17 | IDR       |
|     1520 |      284 | 8996969010247 |   13 | SUB      | 2017-07-20 | 148625 | auto      | -10 | 171666.66666667 |   13 | IDR       |        NULL | NULL      |
+----------+----------+---------------+------+----------+------------+--------+-----------+-----+-----------------+------+-----------+-------------+-----------+
9 rows in set, 219 warnings (0.01 sec)

as in the line 4th, the result for

$price = get_domestic_price($row, $stock_id);
return $price

it show 210000, as it is strange as the currency still in IDR, it should 240000, debugging it catch by

        if ($myrow['type'] == ST_SUPPRECEIVE || $myrow['type'] == ST_SUPPCREDIT)

but as this home currency, the price shown in line 36

$price = $myrow['price'];

questions why line 4 is calculate as different currency?

Re: Inventory Valuation

I am also getting similar bug. Let me try this by checking update_average_material_cost.

Subscription service based on FA
HRM CRM POS batch Themes

Re: Inventory Valuation

checked, and try to set  $use_costed_values is set to 0 (before is 1),
not shown the last value in standard_cost 171666.66666667

actually this raise questions:
1. why this line having price 17? 
<code>
1317 |      384 | 8996969010247 |   25 | SUB      | 2017-05-23 |     17 |           |   1 |          225000 |   25 | NULL      |          17 | IDR       |
1495 |      439 | 8996969010247 |   25 | SUB      | 2017-07-11 |     17 |           |  10 | 171666.66666667 |   25 | NULL      |          17 | IDR       |
</code>

as check it item transactions number is IDR (as home currency also)?