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());
//
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);