<?php include 'init.php'; if (!logged_in()) { header('Location: index.php'); exit; } if (!isset($_GET["pid"]) || empty($_GET["pid"]) || checkPID($_GET["pid"]) === false || checkForAdmit($_GET["pid"], $_GET["rid"]) === true) { header("Location: pagenotfound.php"); exit; } $pid = $_GET["pid"]; $rid = $_GET["rid"]; $adm = getAdmissionDet($pid, $rid); if (empty($adm)) { header("Location: pagenotfound.php"); exit; } else { foreach ($adm as $ad) { $aid = $ad["aid"]; $getdatead = date('Y-m-d', strtotime($ad["dateadmitted"])); $service = $ad["service"]; $roomno = $ad["roomno"]; $dayadmitted = date('d', strtotime($ad["dateadmitted"])); $dateadmitted = date('F d, Y', strtotime($ad["dateadmitted"])); $timeadmitted = date('h:m a', strtotime($ad["dateadmitted"])); } } $ptInfo = getPtInfo($pid); if (empty($ptInfo)) { header("Location: pagenotfound.php");
if (empty($roomtype)) { $error[] = "Please select the type of room where the patient will be admitted."; } if (empty($bednum)) { $error[] = "Please select a bed where the patient will be admitted."; } if (empty($docid)) { $error[] = "Select the Admitting Doctor"; } else { if (checkPID($pid) === false) { $error[] = "The patient does not exist. Please try again."; } if (checkRecord($pid, $rid) === false) { $error[] = "The record that you've passed is not available. Please try again"; } if (checkForAdmit($pid, $rid) === false) { $error[] = "The patient is not for admission."; } } if (!empty($errors)) { foreach ($errors as $error) { $return['error'] = true; $return['msg'][] = $error . "\n"; } } else { if ($curr_doc == $docid) { admitPatientCurDoc($pid, $rid, $docid, $bednum, $service, $roomtype); } else { admitPatient($pid, $rid, $docid, $bednum, $service, $roomtype); } $return['error'] = false;