Bug 5460: Inventory valuation report does not discard zero quantity items for items...
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 16 Jun 2021 07:41:04 +0000 (09:41 +0200)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 16 Jun 2021 07:41:04 +0000 (09:41 +0200)
reporting/rep301.php

index 16e96191c34b243031e0e23681ec24ea53b1e54a..5d04754bc85286030f305c890bbfbdd0dadbfadb 100644 (file)
@@ -97,24 +97,27 @@ function getTransactions($category, $location, $date)
                        item.units,
                        item.description, item.inactive,
                        move.loc_code,
+                       units.decimals,
                        SUM(move.qty) AS QtyOnHand, 
                        item.material_cost AS UnitCost,
                        SUM(move.qty) * item.material_cost AS ItemTotal 
                        FROM "
                        .TB_PREF."stock_master item,"
                        .TB_PREF."stock_category category,"
-                       .TB_PREF."stock_moves move
+                       .TB_PREF."stock_moves move,"
+                       .TB_PREF."item_units units
                WHERE item.stock_id=move.stock_id
                AND item.category_id=category.category_id
                AND item.mb_flag<>'D' AND mb_flag <> 'F' 
                AND move.tran_date <= '$date'
+               AND item.units=units.abbr
                GROUP BY item.category_id,
                        category.description, ";
                if ($location != 'all')
                        $sql .= "move.loc_code, ";
                $sql .= "item.stock_id,
                        item.description
-               HAVING SUM(move.qty) != 0";
+               HAVING ROUND(SUM(move.qty), units.decimals) != 0";
                if ($category != 0)
                        $sql .= " AND item.category_id = ".db_escape($category);
                if ($location != 'all')