Merging version 2.1 RC to main trunk.
[fa-stable.git] / includes / db / inventory_db.inc
index 46a16b41706de5cfecbe43c15f52f1f6af9c733a..4fcc7a411d1e87a0434a9c3f8929c1fe9669df71 100644 (file)
@@ -1,5 +1,14 @@
 <?php
-
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
 function get_qoh_on_date($stock_id, $location=null, $date_=null, $exclude=0)
 {
        if ($date_ == null)
@@ -37,8 +46,10 @@ function get_qoh_on_date($stock_id, $location=null, $date_=null, $exclude=0)
 
 function get_item_edit_info($stock_id)
 {
-       $sql = "SELECT material_cost + labour_cost + overhead_cost AS standard_cost, units
-               FROM ".TB_PREF."stock_master WHERE stock_id='$stock_id'";
+       $sql = "SELECT material_cost + labour_cost + overhead_cost AS standard_cost, units, decimals
+               FROM ".TB_PREF."stock_master,".TB_PREF."item_units
+               WHERE stock_id='$stock_id'
+               AND ".TB_PREF."stock_master.units=".TB_PREF."item_units.abbr";
        $result = db_query($sql, "The standard cost cannot be retrieved");
 
        return db_fetch($result);