Exemple #1
0
//echo "<pre>";
//$token = $_REQUEST['tok'];
if (!isset($_REQUEST['yf']) || !isset($_REQUEST['mf']) || !isset($_REQUEST['df']) || !isset($_REQUEST['yt']) || !isset($_REQUEST['dt']) || !isset($_REQUEST['mt']) || !isset($_REQUEST['category_code'])) {
    echo -2;
    return;
}
$date_from = $_REQUEST['yf'] . "-" . $_REQUEST['mf'] . "-" . $_REQUEST['df'];
$date_to = $_REQUEST['yt'] . "-" . $_REQUEST['mt'] . "-" . $_REQUEST['dt'];
$cat_code = $_REQUEST['category_code'];
//$result = API::get_prev_rates($test_type_id, $date_from, $date_to);
if ($_SESSION['level'] < 2 || $_SESSION['level'] > 4) {
    $user = get_user_by_id($_SESSION['user_id']);
    $lab_config_id = $user->labConfigId;
}
if ($lab_config_id == null) {
    $lab_config_id = get_lab_config_id_admin($_SESSION['user_id']);
}
$lab_config = LabConfig::getById($lab_config_id);
$selected_test_ids = $lab_config->getTestTypeIds();
if ($cat_code != 0) {
    # Fetch all tests belonging to this category (aka lab section)
    $cat_test_types = TestType::getByCategory($cat_code);
    $cat_test_ids = array();
    foreach ($cat_test_types as $test_type) {
        $cat_test_ids[] = $test_type->testTypeId;
    }
    $matched_test_ids = array_intersect($cat_test_ids, $selected_test_ids);
    $selected_test_ids = array_values($matched_test_ids);
}
# Fetch TestType objects using selected test_type_ids.
$selected_test_types = array();
Exemple #2
0
 $_SESSION['user_actualname'] = $user->actualName;
 $_SESSION['user_level'] = $user->level;
 $_SESSION['locale'] = $user->langId;
 if ($user->level == 17) {
     $combinedString = $_SESSION['doctorConfig'] = $user->rwoptions;
     $rwopts = '2,3,4,6,7';
     $rwoptsarr = explode(" ", $rwopts);
     $_SESSION['rwoptionsarray'] = $rwoptsarr;
 } else {
     $rwopts = $user->rwoptions;
     $rwoptsarr = explode(" ", $rwopts);
     $_SESSION['rwoptionsarray'] = $rwoptsarr;
 }
 //if($user->isAdmin())
 if (is_admin($user)) {
     $lab_id = get_lab_config_id_admin($user->userId);
     $_SESSION['lab_config_id'] = -1;
     // $lab_id;
     $_SESSION['db_name'] = "blis_" . $lab_id;
     $_SESSION['dformat'] = $DEFAULT_DATE_FORMAT;
     $_SESSION['country'] = $user->country;
 } else {
     $_SESSION['lab_config_id'] = $user->labConfigId;
     echo $user->labConfigId;
     $_SESSION['country'] = $user->country;
     $lab_config = get_lab_config_by_id($user->labConfigId);
     $_SESSION['db_name'] = $lab_config->dbName;
     $_SESSION['dformat'] = $lab_config->dateFormat;
     $_SESSION['dnum_reset'] = $lab_config->dailyNumReset;
     $_SESSION['pnamehide'] = $lab_config->hidePatientName;
     # Config values for registration fields
Exemple #3
0
 public function get_test_cost($tid)
 {
     if ($_SESSION['level'] < 2 || $_SESSION['level'] > 4) {
         $user = get_user_by_id($_SESSION['user_id']);
         $lid = $user->labConfigId;
     }
     if ($lid == null) {
         $lid = get_lab_config_id_admin($_SESSION['user_id']);
     }
     //$stocks_list = Inventory::getStocksList($lid, $r_id);
     $lab_config_id = $lid;
     $saved_db = DbUtil::switchToLabConfig($lab_config_id);
     $query_string = "SELECT * from test_type_costs WHERE test_type_id = {$tid} ORDER BY earliest_date_valid DESC LIMIT 1";
     $record = query_associative_one($query_string);
     DbUtil::switchRestore($saved_db);
     if ($record != null) {
         $ret = $record['amount'];
     } else {
         $ret = -1;
     }
     return $ret;
 }