3 function add_item_price($stock_id, $sales_type_id, $curr_abrev, $price)
5 $sql = "INSERT INTO ".TB_PREF."prices (stock_id, sales_type_id, curr_abrev, price)
6 VALUES ('$stock_id', $sales_type_id, '$curr_abrev', $price)";
8 db_query($sql,"an item price could not be added");
11 function update_item_price($price_id, $sales_type_id, $curr_abrev, $price)
13 $sql = "UPDATE ".TB_PREF."prices SET sales_type_id=$sales_type_id,
14 curr_abrev='$curr_abrev',
18 db_query($sql,"an item price could not be updated");
21 function delete_item_price($price_id)
23 $sql="DELETE FROM ".TB_PREF."prices WHERE id= $price_id";
24 db_query($sql,"an item price could not be deleted");
27 function get_prices($stock_id)
29 $sql = "SELECT ".TB_PREF."sales_types.sales_type, ".TB_PREF."prices.*
30 FROM ".TB_PREF."prices, ".TB_PREF."sales_types
31 WHERE ".TB_PREF."prices.sales_type_id = ".TB_PREF."sales_types.id
32 AND stock_id='$stock_id' ORDER BY curr_abrev, sales_type_id";
34 return db_query($sql,"item prices could not be retreived");
37 function get_stock_price($price_id)
39 $sql = "SELECT * FROM ".TB_PREF."prices WHERE id=$price_id";
41 $result = db_query($sql,"price could not be retreived");
43 return db_fetch($result);