if ($ward_info =& $ward_obj->getWardInfo($ward_nr)) {
     $room_obj =& $ward_obj->getRoomInfo($ward_nr, $ward_info['room_nr_start'], $ward_info['room_nr_end']);
     $all_info = $ward_obj->getAll_WardInfo($doclist);
     if (is_object($room_obj)) {
         $room_ok = true;
     } else {
         $room_ok = false;
     }
     # GEt the number of beds
     $nr_beds = $ward_obj->countBeds($ward_nr);
     //echo $ward_obj->getLastQuery();
     //echo $ward_obj->LastRecordCount();
     $ward_ok = true;
     # Create the waiting inpatients' list
     $wnr = isset($w_waitlist) && $w_waitlist ? 0 : $ward_nr;
     $waitlist = $ward_obj->createWaitingInpatientList($wnr);
     $waitlist_count = $ward_obj->LastRecordCount();
     # Get the doctor's on duty information
     #### Start of routine to fetch doctors on duty
     $elem = 'duty_1_pnr';
     if (SHOW_DOC_2) {
         $elem .= ',duty_2_pnr';
     }
     # Create personnel object
     include_once $root_path . 'include/care_api_classes/class_personell.php';
     $pers_obj = new Personell();
     if ($result = $pers_obj->getDOCDutyplan($ward_info['dept_nr'], $pyear, $pmonth, $elem)) {
         $duty1 =& unserialize($result['duty_1_pnr']);
         if (SHOW_DOC_2) {
             $duty2 =& unserialize($result['duty_2_pnr']);
         }