3 function get_wo_requirements($woid)
5 $sql = "SELECT ".TB_PREF."wo_requirements.*, ".TB_PREF."stock_master.description,
6 ".TB_PREF."stock_master.mb_flag,
7 ".TB_PREF."locations.location_name,
8 ".TB_PREF."workcentres.name AS WorkCentreDescription FROM
9 (".TB_PREF."wo_requirements, ".TB_PREF."locations, ".TB_PREF."workcentres) INNER JOIN ".TB_PREF."stock_master ON
10 ".TB_PREF."wo_requirements.stock_id = ".TB_PREF."stock_master.stock_id
11 WHERE workorder_id=$woid
12 AND ".TB_PREF."locations.loc_code = ".TB_PREF."wo_requirements.loc_code
13 AND ".TB_PREF."workcentres.id=workcentre";
15 return db_query($sql, "The work order requirements could not be retrieved");
18 //--------------------------------------------------------------------------------------
20 function create_wo_requirements($woid, $stock_id)
22 // create Work Order Requirements based on the bom
23 $result = get_bom($stock_id);
25 while ($myrow = db_fetch($result))
28 $sql = "INSERT INTO ".TB_PREF."wo_requirements (workorder_id, stock_id, workcentre, units_req, loc_code)
30 $myrow["component"] . "', '" .
31 $myrow["workcentre_added"] . "', '" .
32 $myrow["quantity"] . "', '" .
33 $myrow["loc_code"] . "')";
35 db_query($sql, "The work order requirements could not be added");
39 //--------------------------------------------------------------------------------------
41 function delete_wo_requirements($woid)
43 $sql="DELETE FROM ".TB_PREF."wo_requirements WHERE workorder_id=$woid";
44 db_query($sql,"The work order requirements could not be deleted");
48 //--------------------------------------------------------------------------------------
50 function update_wo_requirement_issued($woReqID, $quantity)
52 $sql = "UPDATE ".TB_PREF."wo_requirements SET units_issued = units_issued + $quantity
53 WHERE id = '$woReqID'";
55 db_query($sql, "The work requirements issued quantity couldn't be updated");
58 //--------------------------------------------------------------------------------------
60 function void_wo_requirements($woid)
62 $sql = "UPDATE ".TB_PREF."wo_requirements SET units_issued = 0 WHERE workorder_id = $woid";
64 db_query($sql, "The work requirements issued quantity couldn't be voided");
67 //--------------------------------------------------------------------------------------