Changes in db scheme: gl_trans.type_no optimized to int, changed lock_stock.reorder_l...
[fa-stable.git] / includes / db / inventory_db.inc
index 96d7b8acfca864eb85efee533b1092ca03c507b6..225499d4bfc3d0371590abffc4ad136b35278ce5 100644 (file)
@@ -172,9 +172,9 @@ function last_negative_stock_trans_id($stock_id, $to)
                        $negative_trans_id = $myrow['trans_id'];
                }
                if ($qty >= 0)
-                       $flag = 0;      
+                       $flag = 0;
        }
-               
+
        if ($flag == 1)
                return $negative_trans_id;
        else 
@@ -212,14 +212,14 @@ function get_deliveries_from_trans($stock_id, $from)
             ." AND trans_id ='$from'";
     $result = db_query($sql, "The deliveries could not be updated");
     $cost = db_fetch_row($result);
-       
+
        // Adjusting QOH valuation 
        $sql = "SELECT SUM(qty) FROM ".TB_PREF."stock_moves
                WHERE stock_id=".db_escape($stock_id)." AND
                        trans_id<'$from' GROUP BY stock_id";
        $result = db_query($sql, "The deliveries could not be updated");
        $qoh = db_fetch_row($result);
-       
+
        $qty = $row[0] - $qoh[0]; //QOH prior to -ve stock is subtracted
        $final_cost = $row[1] - $qoh[0]*$cost[0];
        
@@ -266,7 +266,7 @@ function adjust_deliveries($stock_id, $material_cost, $to)
                $new_purchase_cost = $row[0] * $material_cost;
                $purchase_diff = $new_purchase_cost - $old_purchase_cost;
        }
-       
+
        $diff =  $sales_diff - $purchase_diff;
        
        if ($diff != 0)
@@ -381,16 +381,6 @@ function update_stock_move($type, $trans_no, $stock_id, $cost)
        db_query($sql, "The stock movement standard_cost cannot be updated");
 }
 
-function update_stock_move_pid($type, $type_no, $stock_id, $pid, $cost)
-{
-       $sql = "UPDATE ".TB_PREF."stock_moves SET standard_cost=".db_escape($cost)
-               ." WHERE type=".db_escape($type)
-               ."      AND trans_no=".db_escape($type_no)
-               ."      AND stock_id=".db_escape($stock_id)
-               ."  AND person_id = ".db_escape($pid);
-       db_query($sql, "The stock movement standard_cost cannot be updated");
-}
-
 //--------------------------------------------------------------------------------------------------
 
 function get_stock_moves($type, $type_no, $visible=false)
@@ -415,6 +405,7 @@ function get_stock_moves($type, $type_no, $visible=false)
 function void_stock_move($type, $type_no)
 {
     $sql = "SELECT * from ".TB_PREF."stock_moves WHERE type=".db_escape($type)." AND trans_no=".db_escape($type_no);
+
     $result = db_query($sql, "Could not void stock moves");
     while ($row = db_fetch($result))
     {
@@ -456,8 +447,3 @@ function get_location_name($loc_code)
 
        display_db_error("could not retreive the location name for $loc_code", $sql, true);
 }
-
-//--------------------------------------------------------------------------------------------------
-
-
-?>