3 function get_mb_flag($stock_id)
5 $sql = "SELECT mb_flag FROM ".TB_PREF."stock_master WHERE stock_id = '" . $stock_id . "'";
6 $result = db_query($sql, "retreive mb_flag from item");
8 if (db_num_rows($result) == 0)
11 $myrow = db_fetch_row($result);
15 //--------------------------------------------------------------------------------------
17 function get_bom($item)
19 $sql = "SELECT ".TB_PREF."bom.*, ".TB_PREF."locations.location_name, ".TB_PREF."workcentres.name AS WorkCentreDescription,
20 ".TB_PREF."stock_master.description, ".TB_PREF."stock_master.mb_flag AS ResourceType,
21 ".TB_PREF."stock_master.material_cost+ ".TB_PREF."stock_master.labour_cost+".TB_PREF."stock_master.overhead_cost AS standard_cost, units,
22 ".TB_PREF."bom.quantity * (".TB_PREF."stock_master.material_cost+ ".TB_PREF."stock_master.labour_cost+ ".TB_PREF."stock_master.overhead_cost) AS ComponentCost
23 FROM (".TB_PREF."workcentres, ".TB_PREF."locations, ".TB_PREF."bom) INNER JOIN ".TB_PREF."stock_master ON ".TB_PREF."bom.component = ".TB_PREF."stock_master.stock_id
24 WHERE ".TB_PREF."bom.parent = '" . $item . "'
25 AND ".TB_PREF."workcentres.id=".TB_PREF."bom.workcentre_added
26 AND ".TB_PREF."bom.loc_code = ".TB_PREF."locations.loc_code ORDER BY ".TB_PREF."bom.id";
28 return db_query($sql, "The bill of material could not be retrieved");
31 //--------------------------------------------------------------------------------------
33 function has_bom($item)
35 $result = get_bom($item);
37 return (db_num_rows($result) != 0);
40 //--------------------------------------------------------------------------------------