2 require_once(__DIR__."/forms.inc");
4 //function called to set the global session variable for encounter number
5 function setencounter($enc)
8 // Escape $enc by forcing it to an integer to protect from sql injection
14 global $attendant_type;
16 $attendant_id = $attendant_type == 'pid' ? $pid : $_SESSION['therapy_group'];
19 if (getFormByEncounter($attendant_id, $enc)) {
20 //there is an encounter enterred for today
22 //addForm($enc, "New Patient Encounter", 0, $pid, 1);
27 $_SESSION['encounter']=$enc;
31 //returns 1 on successful global set, or 0 if there was no
32 //current encounter, signifying that the interface should load
33 //the screen for a new encounter
38 //fetches encounter pc_catid by encounter number
39 function fetchCategoryIdByEncounter($encounter)
41 global $attendant_type;
42 $table = $attendant_type == 'pid' ? 'form_encounter' : 'form_groups_encounter';
43 $sql = "SELECT pc_catid FROM " . escape_table_name($table) . " WHERE encounter = ? limit 1";
44 $result = sqlQuery($sql, array($encounter));
45 return $result['pc_catid'];
52 function fetchDateService($encounter)
54 $sql = "select date from form_encounter where encounter = ?";
55 $result = sqlQuery($sql, [$encounter]);
56 $result = explode(" ", $result['date']);