Bug 4817: g/l account inquiry can timeout due to slow sql. @Braath Waate.
[fa-stable.git] / reporting / rep304.php
index a3a87daefbdd25d584b11c98c19662c8704fbade..971c7e20553c246bd79625f6e9724f27e23f9125 100644 (file)
@@ -45,7 +45,7 @@ function getTransactions($category, $location, $fromcust, $from, $to, $show_serv
                        move.tran_date,
                        SUM(-move.qty) AS qty,
                        SUM(-move.qty*move.price) AS amt,
-                       SUM(-IF(move.standard_cost <> 0, move.qty * move.standard_cost, move.qty *(item.material_cost + item.labour_cost + item.overhead_cost))) AS cost
+                       SUM(-IF(move.standard_cost <> 0, move.qty * move.standard_cost, move.qty *item.material_cost)) AS cost
                FROM ".TB_PREF."stock_master item,
                        ".TB_PREF."stock_category category,
                        ".TB_PREF."debtor_trans trans,
@@ -62,7 +62,8 @@ function getTransactions($category, $location, $fromcust, $from, $to, $show_serv
 
        if (!$show_service)
                $sql .= " AND (item.mb_flag='B' OR item.mb_flag='M')";
-
+       else
+               $sql .= " AND item.mb_flag<>'F'";
        if ($category != 0)
                $sql .= " AND item.category_id = ".db_escape($category);