$sFamNameBuffer = '';
 $sNameBuffer = '';
 if ($patients_ok) {
     if (isset($patient[$i][$j])) {
     } else {
         #continue;
         $is_patient = false;
         $bed = NULL;
     }
 }
 # set room nr change flag , toggle row color
 if ($cflag != $i) {
     $toggle = !$toggle;
     $cflag = $i;
 }
 $retn = $mini_obj->GetEncounterFromPid($bed['pid']);
 if ($genInfo['encounter_nr'] != $retn) {
     continue;
 }
 # set row color/class
 if ($toggle) {
     $smarty->assign('bToggleRowClass', TRUE);
 } else {
     $smarty->assign('bToggleRowClass', FALSE);
 }
 # Check if bed is locked
 if (stristr($room_info['closed_beds'], $j . '/')) {
     $bed_locked = true;
     $lock_beds++;
     # Consider locked bed as occupied so increase occupied bed counter
     $occ_bed++;