3 require_once(__DIR__ . "/forms.inc");
5 use OpenEMR\Common\Session\SessionUtil;
7 //function called to set the global session variable for encounter number
8 function setencounter($enc)
11 // Escape $enc by forcing it to an integer to protect from sql injection
17 global $attendant_type;
19 $attendant_id = $attendant_type == 'pid' ? $pid : $_SESSION['therapy_group'];
22 if (getFormByEncounter($attendant_id, $enc)) {
23 //there is an encounter entered for today
25 //addForm($enc, "New Patient Encounter", 0, $pid, 1);
30 SessionUtil::setSession('encounter', $enc);
33 //returns 1 on successful global set, or 0 if there was no
34 //current encounter, signifying that the interface should load
35 //the screen for a new encounter
40 //fetches encounter pc_catid by encounter number
41 function fetchCategoryIdByEncounter($encounter)
43 global $attendant_type;
44 $table = $attendant_type == 'pid' ? 'form_encounter' : 'form_groups_encounter';
45 $sql = "SELECT pc_catid FROM " . escape_table_name($table) . " WHERE encounter = ? limit 1";
46 $result = sqlQuery($sql, array($encounter));
47 return $result['pc_catid'];
54 function fetchDateService($encounter)
56 $sql = "select date from form_encounter where encounter = ?";
57 $result = sqlQuery($sql, [$encounter]);
58 $result = explode(" ", $result['date']);