$specimen_list[] = $specimen_typeid; } } # Add test type record //function add_test_type($test_name, $test_descr, $clinical_data, $cat_code, $is_panel, $specimen_list=array(), $lab_config_id, $hide_patient_name) $test_type_id = ""; if (count($specimen_list) != 0) { # Add entries to 'specimen_test' map table $test_type_id = add_test_type($test_name, $test_descr, $test_clinical_data, $cat_code, $is_panel, $lab_config_id, $hide_patient_name, $prevalenceThreshold, $targetTat, $specimen_list); } else { # No specimens selected. Add test anyway $test_type_id = add_test_type($test_name, $test_descr, $test_clinical_data, $cat_code, $is_panel, $lab_config_id, $hide_patient_name, $prevalenceThreshold, $targetTat); } if ($newCostToPatient > 0 && is_billing_enabled($_SESSION['lab_config_id'])) { // If the cost is greater than 0, we go ahead and add the cost. If not, there's no reason to make another sql call here. It'll be done elsewhere. instantiate_new_cost_of_test_type($newCostToPatient, $test_type_id); } enable_new_test($_SESSION['lab_config_id'], $test_type_id); # Merge added_measure_list and added_submeasures_list $add_measr = $added_measures_list; $merged_list = array_merge($added_measures_list, $added_submeasures_list); sort($merged_list); /* echo "<br>"; print_r($added_measures_list); echo "<br>"; print_r($added_submeasures_list); echo "<br>"; print_r($merged_list); echo "<br>"; */
function get_cost_of_test_type_for_closest_date($date, $test_type_id) { instantiate_new_cost_of_test_type(0.0, $test_type_id); $date = date("Y-m-d H:i:s", strtotime($date)); $lab_config_id = $_SESSION['lab_config_id']; $saved_db = DbUtil::switchToLabConfig($lab_config_id); $query_string = "SELECT amount, earliest_date_valid FROM test_type_costs WHERE test_type_id={$test_type_id} AND earliest_date_valid<='{$date}' ORDER BY earliest_date_valid DESC LIMIT 1"; $result = query_associative_one($query_string); DbUtil::switchRestore($saved_db); return $result; }