$person1 =& $pers_obj->getPersonellInfo($pnr1);
        }
        if (SHOW_DOC_2 && ($pnr2 = $duty2['hr' . $offset_day])) {
            $person2 =& $pers_obj->getPersonellInfo($pnr2);
        }
        #### End of routine to fetch doctors on duty
    } else {
        $ward_ok = false;
    }
} elseif ($mode == 'newdata') {
    if ($pn == 'lock' || $pn == 'unlock') {
        //$db->debug=true;
        if ($pn == 'lock') {
            $ward_obj->closeBed($ward_nr, $rm, $bd);
        } else {
            $ward_obj->openBed($ward_nr, $rm, $bd);
        }
        //header("location:nursing-station.php".URL_REDIRECT_APPEND."&edit=1&mode=&pday=$pday&pmonth=$pmonth&pyear=$pyear&station=$station&ward_nr=$ward_nr");
        //exit;
    } else {
        if ($ward_obj->AdmitInWard($pn, $ward_nr, $rm, $bd)) {
            //echo "ok";
            $ward_obj->setAdmittedInWard($pn, $ward_nr, $rm, $bd);
        }
        //header("location:nursing-station.php".URL_REDIRECT_APPEND."&edit=1&mode=&pday=$pday&pmonth=$pmonth&pyear=$pyear&station=$station&ward_nr=$ward_nr");
        //exit;
    }
    header("location:nursing-station.php" . URL_REDIRECT_APPEND . "&edit=1&mode=&pday={$pday}&pmonth={$pmonth}&pyear={$pyear}&station={$station}&ward_nr={$ward_nr}");
    exit;
}
# Start Smarty templating here