2 include_once("../../globals.php");
3 include_once("$srcdir/forms.inc");
5 //function called to set the global session variable for encounter number
6 function setencounter($enc)
9 // Escape $enc by forcing it to an integer to protect from sql injection
15 global $attendant_type;
17 $attendant_id = $attendant_type == 'pid' ? $pid : $_SESSION['therapy_group'];
20 if (getFormByEncounter($attendant_id, $enc)) {
21 //there is an encounter enterred for today
23 //addForm($enc, "New Patient Encounter", 0, $pid, 1);
28 $_SESSION['encounter']=$enc;
32 //returns 1 on successful global set, or 0 if there was no
33 //current encounter, signifying that the interface should load
34 //the screen for a new encounter
39 //fetches encounter pc_catid by encounter number
40 function fetchCategoryIdByEncounter($encounter)
42 global $attendant_type;
43 $table = $attendant_type == 'pid' ? 'form_encounter' : 'form_groups_encounter';
44 $sql = "select pc_catid from $table where encounter=? limit 1";
45 $result = sqlQuery($sql, array($encounter));
46 return $result['pc_catid'];