Merged last changes from stable.
[fa-stable.git] / includes / db / inventory_db.inc
index 288434d50a133217e8896db499201448f0d12390..c65cacb2c665a93a2072ecf23e98b921f71449c4 100644 (file)
@@ -141,9 +141,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 
@@ -181,14 +181,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];
        
@@ -235,7 +235,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)
@@ -384,6 +384,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))
     {
@@ -425,8 +426,3 @@ function get_location_name($loc_code)
 
        display_db_error("could not retreive the location name for $loc_code", $sql, true);
 }
-
-//--------------------------------------------------------------------------------------------------
-
-
-?>