# Set default breakfile
/* Create ward object */
require_once $root_path . 'include/care_api_classes/class_ward.php';
$ward_obj = new Ward();
# Load date formatter
require_once $root_path . 'include/inc_date_format_functions.php';
if ($mode == '' || $mode == 'fresh') {
    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']);
        if (is_object($room_obj)) {
            $room_ok = true;
        } else {
            $room_ok = false;
        }
        # GEt the number of beds
        $nr_beds = $ward_obj->countBeds($ward_nr);
        # Get ward patients
        if ($is_today) {
            $patients_obj =& $ward_obj->getDayWardOccupants($ward_nr);
        } else {
            $patients_obj =& $ward_obj->getDayWardOccupants($ward_nr, $s_date);
        }
        if (is_object($patients_obj)) {
            # Prepare patients data into array matrix
            while ($buf = $patients_obj->FetchRow()) {
                $patient[$buf['room_nr']][$buf['bed_nr']] = $buf;
            }
            $patients_ok = true;
        } else {
            $patients_ok = false;
        }