Global variabel, $def_print_destination, config.php can be set to 0 or 1
[fa-stable.git] / purchasing / includes / db / invoice_db.inc
index ef60a9380ac5312197fffc39e4b67e9b8538531f..de1e353206f23a925fd3e7b00864ec3d7fc26529 100644 (file)
@@ -98,18 +98,6 @@ function update_supp_received_items_for_invoice($id, $po_detail_item, $qty_invoi
        return array($ret, $date, $unit_price);
 }
 
-function get_deliveries_between($stock_id, $from, $to)
-{
-       $from = date2sql($from);
-       $to = date2sql($to);
-       $sql = "SELECT SUM(-qty), SUM(-qty*standard_cost) FROM ".TB_PREF."stock_moves
-               WHERE type=".ST_CUSTDELIVERY." AND stock_id=".db_escape($stock_id)." AND
-                       tran_date>='$from' AND tran_date<='$to' GROUP BY stock_id";
-
-       $result = db_query($sql, "The deliveries could not be updated");
-       return db_fetch_row($result);
-}
-
 function get_diff_in_home_currency($supplier, $old_date, $date, $amount1, $amount2)
 {
        $dec = user_price_dec();
@@ -117,7 +105,7 @@ function get_diff_in_home_currency($supplier, $old_date, $date, $amount1, $amoun
        $currency = get_supplier_currency($supplier);
        $ex_rate = get_exchange_rate_to_home_currency($currency, $old_date);
        $amount1 = $amount1 / $ex_rate;
-       $ex_rate = get_exchange_rate_to_home_currency($currency, $date_);
+       $ex_rate = get_exchange_rate_to_home_currency($currency, $date);
        $amount2 = $amount2 / $ex_rate;
        $diff = $amount2 - $amount1;
        return round2($diff, $dec);