Inventory valuation report. 301 unit decimal -1 issue. Fixed.
authorJoe <joe.hunt.consulting@gmail.com>
Fri, 23 Dec 2022 08:38:00 +0000 (09:38 +0100)
committerJoe <joe.hunt.consulting@gmail.com>
Fri, 23 Dec 2022 08:38:00 +0000 (09:38 +0100)
reporting/rep301.php

index 5d04754bc85286030f305c890bbfbdd0dadbfadb..57350d8c31793bf021643af01d983d92ee69ff5f 100644 (file)
@@ -91,6 +91,7 @@ function getTransactions($category, $location, $date)
 {
        $date = date2sql($date);
 
+       $dec = user_qty_dec();
        $sql = "SELECT item.category_id,
                        category.description AS cat_description,
                        item.stock_id,
@@ -117,7 +118,7 @@ function getTransactions($category, $location, $date)
                        $sql .= "move.loc_code, ";
                $sql .= "item.stock_id,
                        item.description
-               HAVING ROUND(SUM(move.qty), units.decimals) != 0";
+               HAVING ROUND(SUM(move.qty), IF(units.decimals <> -1, units.decimals, $dec)) != 0";
                if ($category != 0)
                        $sql .= " AND item.category_id = ".db_escape($category);
                if ($location != 'all')