fix for attendance form
[openemr.git] / library / encounter.inc
blobc024f33dc093373bf762b359de3ab7722e64b2b1
1 <?php
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) {
7         
8         $return_val = 1;
9         global $encounter;
10         global $pid;
11         global $attendant_type;
13         $attendant_id = $attendant_type == 'pid' ? $pid : $_SESSION['therapy_group'];
14         if ($enc == "" ) {
15                 $enc = date("Ymd");
16                 if (getFormByEncounter($attendant_id,$enc)) {
17                         //there is an encounter enterred for today
18                 } else {
19                         //addForm($enc, "New Patient Encounter", 0, $pid, 1);
20                         $return_val = 0;
21                 }
22         }
23         
24         $_SESSION['encounter']=$enc;
25         $encounter=$enc;
26         
27         
28         //returns 1 on successful global set, or 0 if there was no
29         //current encounter, signifying that the interface should load
30         //the screen for a new encounter
31         return $return_val;