X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fsales_db.inc;h=465002303887c7ca2659ea5ec8aa9b34865e360c;hb=ca4b0e00f434d0180fe3e3ec9fa3d31a278a9fef;hp=d5c0e487d2ba9a9203c9b4313bc7e92909f07bff;hpb=a9d55e1c13cbd6a6305b9322ec8621a06516f9f3;p=fa-stable.git diff --git a/sales/includes/sales_db.inc b/sales/includes/sales_db.inc index d5c0e487..46500230 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()); @@ -200,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); @@ -278,7 +279,7 @@ function read_sales_trans($doc_type, $trans_no, &$cart) @$myrow["src_id"]); } } - $cart->prepayments = get_payments_for($trans_no, $doc_type); + $cart->prepayments = get_payments_for($trans_no, $doc_type, $myrow["debtor_no"]); } // !newdoc