[0005223] Fixed Asset Purchase, Direct Supplier Invoice: fixed invalid cost handling...
[fa-stable.git] / inventory / includes / db / items_trans_db.inc
index 84ba75ae43db78de6c211572de1f318d3f8cf729..dfbc5eebeb9eab3b9f47cc12bd16511f11dda9ce 100644 (file)
@@ -31,8 +31,8 @@ function stock_cost_update($stock_id, $material_cost, $labour_cost, $overhead_co
        begin_transaction();
 
        $sql = "UPDATE ".TB_PREF."stock_master SET material_cost=".db_escape($material_cost).", 
-               labour_cost=".db_escape($labour_cost).", 
-               overhead_cost=".db_escape($overhead_cost)."
+               labour_cost=".db_escape($labour_cost).",
+               overhead_cost=".db_escape($overhead_cost)."
                WHERE stock_id=".db_escape($stock_id);
        db_query($sql,"The cost details for the inventory item could not be updated");
 
@@ -70,7 +70,6 @@ function stock_cost_update($stock_id, $material_cost, $labour_cost, $overhead_co
                        $cart->add_gl_item($stock_gl_code["inventory_account"], 0, 0, $value_of_change);
 
                        write_journal_entries($cart);
-                       change_stock_moves_std_cost($stock_id, $date_, $new_cost - $last_cost); 
                }
        }
 
@@ -80,13 +79,3 @@ function stock_cost_update($stock_id, $material_cost, $labour_cost, $overhead_co
 
        return $update_no;
 }
-
-//-------------------------------------------------------------------------------------------------------------
-
-function change_stock_moves_std_cost($stock_id, $date, $diff_cost)
-{
-       $date = date2sql($date);
-       $sql = "UPDATE ".TB_PREF."stock_moves SET standard_cost = standard_cost + ".db_escape($diff_cost). " WHERE stock_id = "
-                       .db_escape($stock_id)." AND tran_date <= '$date' AND qty <> 0 AND standard_cost > 0.001 AND type <> ".ST_LOCTRANSFER;
-       db_query($sql,"The stock moves cost details for the inventory item could not be updated");
-}