getAll($sql); $return_results = array(); foreach($results AS $result) { $return_results[$result['id']] = array("id" => $result['id'], "name" => $result['name']); } return $return_results; } public function get_all_trackings_departments() { global $database; $sql = " SELECT id, department_name AS name FROM production_departments "; $results = $database->getAll($sql); $return_results = array(); foreach($results AS $result) { $return_results[$result['id']] = array("id" => $result['id'], "name" => $result['name']); } return $return_results; } public function get_quote_departments($quote_id) { global $database; $sql = " SELECT * FROM quotes_production_time WHERE quote_id = '$quote_id' "; $results = $database->getAll($sql); $return_results = array(); $return_results['11'] = array("quote_id" => $quote_id,"production_departments_id " => 11,"hours" => 0,"status" => 1); $return_results['12'] = array("quote_id" => $quote_id,"production_departments_id " => 12,"hours" => 0,"status" => 1); $return_results['13'] = array("quote_id" => $quote_id,"production_departments_id " => 13,"hours" => 0,"status" => 1); foreach($results AS $result) { $return_results[$result['production_departments_id']] = $result; } return $return_results; } public function get_departments() { global $database; $sql = " SELECT * FROM production_departments "; $results = $database->getAll($sql); $return_results = array(); foreach($results AS $result) { $return_results[$result['id']] = $result; } return $return_results; } public function get_active_departments() { global $database; $sql = " SELECT * FROM production_departments WHERE status=1 "; $results = $database->getAll($sql); return $results; } public function get_active_subdepartments($id) { global $database; $sql = " SELECT * FROM production_departments_sub WHERE production_departments_id='$id' AND status=1 "; $results = $database->getAll($sql); return $results; } public function get_department_colors( ) { global $database; $sql = " SELECT * FROM production_departments "; $results = $database->getAll($sql); return $results; } public function get_single_department_colors($id ) { global $database; $sql = " SELECT * FROM production_departments WHERE id='$id' "; $results = $database->getRow($sql); return $results; } public function update_department_colors($POST) { global $database; $department_name = $POST['department_name']; $id = $POST['id']; $color = "#".$POST['color']; $textcolor = "#".$POST['textcolor']; $submitter = $_SESSION['user']['id']; $current_date_time = date('Y-m-d G:i:s'); $save_color = " UPDATE production_departments SET `color`='$color',`textcolor`='$textcolor',`submitter`='$submitter',`date_submitted`='$current_date_time' WHERE id = '$id' "; $results = $database->query($save_color); return $results; } } ?>