X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fsales_db.inc;h=2177d2e7afbc70b239fb6d389bbc9d3a94008748;hb=615c63fbc4aea4d0e136e868993e71190aacadd2;hp=1698e40a2d88ff2c1a603f28e4e195fbdc08bf22;hpb=f2343f51b0ed0d9abd2ec98b64f202beb9716d37;p=fa-stable.git diff --git a/sales/includes/sales_db.inc b/sales/includes/sales_db.inc index 1698e40a..2177d2e7 100644 --- a/sales/includes/sales_db.inc +++ b/sales/includes/sales_db.inc @@ -47,7 +47,7 @@ function add_gl_trans_customer($type, $type_no, $date_, $account, $dimension, $d function get_calculated_price($stock_id, $add_pct) { - $avg = get_standard_cost($stock_id); + $avg = get_unit_cost($stock_id); if ($avg == 0) return 0; return round2($avg * (1 + $add_pct / 100), user_price_dec()); @@ -117,20 +117,6 @@ function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=nu { $price = $prices[$base_id][$home_curr] * $factor / $rate; } -/* - if (isset($prices[$sales_type_id][$home_curr])) - { - $price = $prices[$sales_type_id][$home_curr] / $rate; - } - elseif (isset($prices[$base_id][$currency])) - { - $price = $prices[$base_id][$currency] * $factor; - } - elseif (isset($prices[$base_id][$home_curr])) - { - $price = $prices[$base_id][$home_curr] * $factor / $rate; - } -*/ elseif ($num_rows == 0 && $add_pct != -1) { $price = get_calculated_price($stock_id, $add_pct); @@ -189,7 +175,6 @@ function update_parent_line($doc_type, $line_id, $qty_dispatched, $auto=false) $qty_dispatched = (float)$qty_dispatched; -// echo "update line: $line_id, $doc_type, $qty_dispatched"; if ($doc_type == 0) return false; else { @@ -215,14 +200,15 @@ function update_parent_line($doc_type, $line_id, $qty_dispatched, $auto=false) // function get_location(&$cart) { - $sql = "SELECT ".TB_PREF."locations.* FROM ".TB_PREF."stock_moves," - .TB_PREF."locations". + $sql = "SELECT location.* + FROM ".TB_PREF."stock_moves move," + .TB_PREF."locations location". " WHERE type=".db_escape($cart->trans_type). " AND trans_no=".key($cart->trans_no). " AND qty!=0 ". - " AND ".TB_PREF."locations.loc_code=".TB_PREF."stock_moves.loc_code"; - $result = db_query($sql, 'Retreiving inventory location'); + " AND location.loc_code=move.loc_code"; + $result = db_query($sql, 'Retreiving inventory location'); if (db_num_rows($result)) { return db_fetch($result); @@ -237,7 +223,7 @@ function get_location(&$cart) function read_sales_trans($doc_type, $trans_no, &$cart) { if (!is_array($trans_no) && $trans_no) - $trans_no = array($trans_no); + $trans_no = array($trans_no); $cart->trans_type = $doc_type; if (!$trans_no) { // new document