├── README.txt ├── create_db.php ├── css ├── style.css ├── style01.css └── style02.css ├── error.php ├── images ├── del.gif ├── index.jpg ├── mod.gif └── search_button.gif ├── include └── dbinfo.php ├── index.php ├── insert_db.php └── login.php /README.txt: -------------------------------------------------------------------------------- 1 | This Repository has The "Database Management Application for Hospital Management System". Database is capable of maintaining a 2 | patient’s record, doctor’s record, record of other staff members and medical report and final payment for each patient. 3 | 4 | Technologies used: PHP and MySQL. 5 | 6 | 7 | Follow these steps to use the application: 8 | 9 | 1. Please run the file named “create_db.php” in your localhost to create the 10 | database tables. 11 | By doing this an admin “Username” and “Password” will be inserted in the 12 | database. 13 | 14 | Admin USERNAME: IT-1 15 | PASSWORD: IT-1 16 | Now use index.php file to login. 17 | If an error occurs that “Multiple logins not allowed” then run error.php and 18 | try again. 19 | 20 | 2. Now you will see the Account Details of Admin. 21 | 22 | 3. Following options are available in the interface: 23 | Home: 24 | o My account: To view the account details of the user who has logged in. 25 | o Logout: To logout from the current user. 26 | Patients: 27 | o View Details: To search patient details using Name or Patient ID and an advanced search option can also be used to search via Age,Blood Group, Gender or Accompanies’ Name. 28 | o Accompanies: To search Accompanying person of a patient using Patient Name or Patient ID. 29 | o Modify Details: To modify Patient Details using Patient ID. 30 | o Delete Details: To delete Patient Details using Patient ID. 31 | o Add new Details: To Add Details of a new Patient. Patient ID will be automatically generated starting from “P”. 32 | o Add Accompanies: To Add Details of Accompanying Person of a Patient. 33 | o Allot Doctor to a Patient: To Assign Doctor to a Patient entering Patient ID, Doctor ID and Date. 34 | Employee: 35 | o Doctors: To view details of all the Doctors in the Hospital. 36 | o Medical Staff: To view details of entire Medical Staff of the Hospital. 37 | o Administration: To view details of Administrative Staff of the Hospital. 38 | o Modify Details: To modify Employee Details using Employee ID. 39 | o Delete Details: To modify Employee Details using Employee ID. 40 | Add New Details: To Add Details of new Employee.Department-wise new Employee IDs will be generated. 41 | Medical Report (Billing): 42 | o Create Report: Create a new Medical Report of Patient of a particular Department. New Report ID will be generated starting from “R”. 43 | o View Report: To search Report using Report ID. 44 | o Modify Report: To Modify existing Report using Report ID. 45 | o Add Closing Date: To Add Closing date of a Report using Report ID. 46 | o Delete Report: To delete an existing Report using Report ID or Patient Name. 47 | Diagnosis: 48 | o View Tests: To view Tests done on a particular Report using Report ID. 49 | o Add Tests: To Add a new Test to an existing Report. 50 | o Add Result: To Add Result to an existing Test. 51 | o Delete Test: To delete a Test under particular Report using Report ID. 52 | Departments: 53 | o View Departments: To view Details of all existing Departments. 54 | o Add Department: To Add a new Department Details. 55 | o Modify Department: To modify Department Details using Department No. 56 | o Delete Department: To Delete a Department using Department No. 57 | Vehicle Details: 58 | o Search a Vehicle: To search a Vehicle using Type or Registration No. 59 | o Add a Vehicle: To Add details of a new Vehicle. Vehicle Number will be generated starting from “V”. 60 | o Discard a Vehicle: To discard a vehicle using Vehicle Registration No. 61 | o Allot a vehicle: To allot a Vehicle to a Patient. 62 | o Allotment Details: To view Allotment Details of a Vehicle using Registration No. or Type.o Un-allot a Vehicle: To un-allot a Vehicle from a patient using Registration No. 63 | Room Details: 64 | o Search Room: To search details of room using Type or Room ID. 65 | o Add Room: To add a new Room to Database. Room ID will be generated starting from “Z”. 66 | o Discard Room: To Discard a room from Database using Room No. or Type. 67 | o Allot a Room: To Allot a room to particular Patient. 68 | o Allotment Details: To view Allotment Details of rooms using Type or Room ID. 69 | o Allot Medical Staff Duties: To Allot duties to medical staff for a particular Room. 70 | o View Medical Staff Duties: To view details Medical Staff Duties using Room no. 71 | o Un-allot a Room: To un-allot a room using Room ID. 72 | -------------------------------------------------------------------------------- /create_db.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /css/style.css: -------------------------------------------------------------------------------- 1 | article, aside, details, figcaption, figure, 2 | footer, header, hgroup, menu, nav, section { 3 | display: block; 4 | } 5 | 6 | body { 7 | line-height: 1; 8 | } 9 | 10 | ol, ul { 11 | list-style: none; 12 | } 13 | 14 | blockquote, q { 15 | quotes: none; 16 | } 17 | 18 | blockquote:before, blockquote:after, 19 | q:before, q:after { 20 | content: ''; 21 | content: none; 22 | } 23 | 24 | table { 25 | border-collapse: collapse; 26 | border-spacing: 0; 27 | } 28 | 29 | body { 30 | font: 13px/20px Warnock,"Lucida Grande", Tahoma, Verdana, sans-serif; 31 | } 32 | 33 | .container { 34 | margin: 80px auto; 35 | width: 640px; 36 | } 37 | 38 | .login { 39 | position: relative; 40 | margin: 0 auto; 41 | padding: 20px 20px 20px; 42 | width: 310px; 43 | background: white; 44 | border-radius: 3px; 45 | -webkit-box-shadow: 0 0 200px rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3); 46 | box-shadow: 0 0 200px rgba(255, 255, 255, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3); 47 | } 48 | .login:before { 49 | content: ''; 50 | position: absolute; 51 | top: -8px; 52 | right: -8px; 53 | bottom: -8px; 54 | left: -8px; 55 | z-index: -1; 56 | background: rgba(0, 0, 0, 0.08); 57 | border-radius: 4px; 58 | } 59 | .login h1 { 60 | margin: -20px -20px 21px; 61 | line-height: 40px; 62 | font-size: 15px; 63 | font-weight: bold; 64 | color: #555; 65 | text-align: center; 66 | text-shadow: 0 1px white; 67 | background: #f3f3f8; 68 | border-bottom: 1px solid #cfcfcf; 69 | border-radius: 3px 3px 0 0; 70 | background-image: -webkit-linear-gradient(top, whiteffd, #eef2f5); 71 | background-image: -moz-linear-gradient(top, whiteffd, #eef2f5); 72 | background-image: -o-linear-gradient(top, whiteffd, #eef2f5); 73 | background-image: linear-gradient(to bottom, whiteffd, #eef2f5); 74 | -webkit-box-shadow: 0 1px whitesmoke; 75 | box-shadow: 0 1px whitesmoke; 76 | } 77 | .login p { 78 | margin: 20px 0 0; 79 | } 80 | .login p:first-child { 81 | margin-top: 0; 82 | } 83 | .login input[type=text], .login input[type=password] { 84 | width: 278px; 85 | } 86 | .login p.remember_me { 87 | float: left; 88 | line-height: 31px; 89 | } 90 | .login p.remember_me label { 91 | font-size: 12px; 92 | color: #777; 93 | cursor: pointer; 94 | } 95 | .login p.remember_me input { 96 | position: relative; 97 | bottom: 1px; 98 | margin-right: 4px; 99 | vertical-align: middle; 100 | } 101 | .login p.submit { 102 | text-align: right; 103 | } 104 | 105 | .login-help { 106 | margin: 20px 0; 107 | font-size: 11px; 108 | text-align: center; 109 | text-shadow: 0 1px #2a85a1; 110 | } 111 | .login-help a { 112 | color: #000000; 113 | text-decoration: none; 114 | } 115 | .login-help a:hover { 116 | text-decoration: underline; 117 | } 118 | 119 | :-moz-placeholder { 120 | color: #c9c9c9 !important; 121 | font-size: 13px; 122 | } 123 | 124 | ::-webkit-input-placeholder { 125 | color: #ccc; 126 | font-size: 13px; 127 | } 128 | 129 | input { 130 | font-family: "Lucida Grande", Tahoma, Verdana, sans-serif; 131 | font-size: 14px; 132 | } 133 | 134 | input[type=text], input[type=password] { 135 | margin: 5px; 136 | padding: 0 10px; 137 | width: 200px; 138 | height: 34px; 139 | color: #404040; 140 | background: white; 141 | border: 1px solid; 142 | border-color: #c4c4c4 #d1d1d1 #d4d4d4; 143 | border-radius: 2px; 144 | outline: 5px solid #eff4f7; 145 | -moz-outline-radius: 3px; 146 | -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12); 147 | box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12); 148 | } 149 | input[type=text]:focus, input[type=password]:focus { 150 | border-color: #7dc9e2; 151 | outline-color: #dceefc; 152 | outline-offset: 0; 153 | } 154 | 155 | input[type=submit] { 156 | padding: 0 18px; 157 | height: 29px; 158 | font-size: 12px; 159 | font-weight: bold; 160 | color: #527881; 161 | text-shadow: 0 1px #e3f1f1; 162 | background: #cde5ef; 163 | border: 1px solid; 164 | border-color: #b4ccce #b3c0c8 #9eb9c2; 165 | border-radius: 16px; 166 | outline: 0; 167 | -webkit-box-sizing: content-box; 168 | -moz-box-sizing: content-box; 169 | box-sizing: content-box; 170 | background-image: -webkit-linear-gradient(top, #edf5f8, #cde5ef); 171 | background-image: -moz-linear-gradient(top, #edf5f8, #cde5ef); 172 | background-image: -o-linear-gradient(top, #edf5f8, #cde5ef); 173 | background-image: linear-gradient(to bottom, #edf5f8, #cde5ef); 174 | -webkit-box-shadow: inset 0 1px white, 0 1px 2px rgba(0, 0, 0, 0.15); 175 | box-shadow: inset 0 1px white, 0 1px 2px rgba(0, 0, 0, 0.15); 176 | } 177 | input[type=submit]:active { 178 | background: #cde5ef; 179 | border-color: #9eb9c2 #b3c0c8 #b4ccce; 180 | -webkit-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.2); 181 | box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.2); 182 | } 183 | 184 | .lt-ie9 input[type=text], .lt-ie9 input[type=password] { 185 | line-height: 34px; 186 | } 187 | 188 | -------------------------------------------------------------------------------- /css/style01.css: -------------------------------------------------------------------------------- 1 | table { 2 | border-collapse: collapse; 3 | } 4 | td { 5 | border-bottom: 0.5px solid #CCCCCC; 6 | padding-right: 1em; 7 | text-align: left; 8 | } 9 | td 10 | { 11 | padding: 6px 4px; 12 | } -------------------------------------------------------------------------------- /css/style02.css: -------------------------------------------------------------------------------- 1 | .button { 2 | font: bold 11px Arial; 3 | text-decoration: none; 4 | background-color: #EEEEEE; 5 | color: #333333; 6 | padding: 2px 6px 2px 6px; 7 | border-top: 1px solid #CCCCCC; 8 | border-right: 1px solid #333333; 9 | border-bottom: 1px solid #333333; 10 | border-left: 1px solid #CCCCCC; 11 | } -------------------------------------------------------------------------------- /error.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/del.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prateeksinghal/Hospital-Management-System/a8452606cd4c3f88dd6265a71686fdab962e3d39/images/del.gif -------------------------------------------------------------------------------- /images/index.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prateeksinghal/Hospital-Management-System/a8452606cd4c3f88dd6265a71686fdab962e3d39/images/index.jpg -------------------------------------------------------------------------------- /images/mod.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prateeksinghal/Hospital-Management-System/a8452606cd4c3f88dd6265a71686fdab962e3d39/images/mod.gif -------------------------------------------------------------------------------- /images/search_button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prateeksinghal/Hospital-Management-System/a8452606cd4c3f88dd6265a71686fdab962e3d39/images/search_button.gif -------------------------------------------------------------------------------- /include/dbinfo.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Login | Hospital Management 10 | 11 | 12 | 13 | 14 | alert(\"Multiple logins not allowed. Access Denied.\")"; 32 | } 33 | else 34 | { 35 | session_start(); 36 | $sessionid=$_COOKIE['PHPSESSID']; 37 | $_SESSION['username']=$username; 38 | mysql_query("insert into session value ('$username','$sessionid')"); 39 | setcookie("username",$_POST['login'],time()+3600); 40 | header('Location: login.php'); 41 | } 42 | } 43 | else echo ""; 44 | } 45 | else echo ""; 46 | } 47 | ?> 48 |
49 |

Hospital Management System

50 |
51 |
52 |

Login

53 |
54 |

55 |

56 |

57 | 61 |

62 |

63 |
64 |
65 | 66 |
67 | 68 |
69 |
70 | 71 | 72 | -------------------------------------------------------------------------------- /insert_db.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /login.php: -------------------------------------------------------------------------------- 1 | 2 | 8 | Hospital Management System 9 | 10 | 16 | 17 | 18 | 19 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 |
139 |
140 |

Hospital Management System


141 |
142 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | "; 237 | $username=$_COOKIE['username']; 238 | $sessionid=$_COOKIE['PHPSESSID']; 239 | $row=mysql_query("select * from session where username='$username' and id='$sessionid'"); 240 | if(!empty($row)&&(mysql_num_rows($row))) 241 | { 242 | $result=mysql_query("select * from employee where Employee_ID='$username'"); 243 | if($row=mysql_fetch_array($result)) 244 | { 245 | $name=$row['Name']; 246 | $eid=$row['Employee_ID']; 247 | $dept=$row['Dept_No']; 248 | $gender=$row['Gender']; 249 | $contact=$row['Contact']; 250 | $dob=$row['DOB']; 251 | $add=$row['Address']; 252 | echo "

Personal Details

"; 253 | echo ""; 254 | echo ""; 255 | echo ""; 256 | echo ""; 257 | echo ""; 258 | echo ""; 259 | echo ""; 260 | echo ""; 261 | echo "
Name: $name
Employee ID: $eid
Date of Birth: $dob
Department: $dept
Contact: $contact
Gender: $gender
Address: $add
"; 262 | } 263 | } 264 | echo "
"; 265 | } 266 | else if(isset($_GET['pid'])&&((strcmp($_GET['pid'],"view_doctors")==0))) 267 | { 268 | $result=mysql_query("select * from employee where category=\"Doctor\" "); 269 | $count=mysql_num_rows($result); 270 | echo "
"; 271 | echo "

Doctors

"; 272 | $result=mysql_query("select * from employee where category=\"Doctor\" "); 273 | while($count) 274 | { 275 | $row=mysql_fetch_array($result); 276 | $name=$row['Name']; 277 | $id=$row['Employee_ID']; 278 | $contact=$row['Contact']; 279 | $dept=$row['Dept_No']; 280 | $add=$row['Address']; 281 | $result1=mysql_query("select * from doctors where Employee_ID=\"$id\" "); 282 | //echo "l"; 283 | //echo "select * from doctors where Employee_ID=\"$id\" "; 284 | $row=mysql_fetch_array($result1); 285 | $batch=$row['Batch_No']; 286 | echo "

Dr. $name

Employee-ID: $id
Batch No.: $batch
Dept-No.: $dept
Address: $add
Contact: $contact

"; 287 | $count=$count-1; 288 | } 289 | echo "
"; 290 | } 291 | else if(isset($_GET['pid'])&&((strcmp($_GET['pid'],"view_admin")==0))) 292 | { 293 | $result=mysql_query("select * from employee where category=\"Adminstration\" "); 294 | $count=mysql_num_rows($result); 295 | echo "
"; 296 | echo "

Adminstration

"; 297 | while($count) 298 | { 299 | $row=mysql_fetch_array($result); 300 | $name=$row['Name']; 301 | $id=$row['Employee_ID']; 302 | $contact=$row['Contact']; 303 | $dept=$row['Dept_No']; 304 | $add=$row['Address']; 305 | echo "

$name

Employee-ID: $id
Dept-No.: $dept
Address: $add
Contact: $contact

"; 306 | $count=$count-1; 307 | } 308 | echo "
"; 309 | } 310 | else if(isset($_GET['pid'])&&((strcmp($_GET['pid'],"view_staff")==0))) 311 | { 312 | $result=mysql_query("select * from employee where category=\"Medical Staff\" "); 313 | $count=mysql_num_rows($result); 314 | echo "
"; 315 | echo "

Medical Staff

"; 316 | while($count) 317 | { 318 | $row=mysql_fetch_array($result); 319 | $name=$row['Name']; 320 | $id=$row['Employee_ID']; 321 | $contact=$row['Contact']; 322 | $dept=$row['Dept_No']; 323 | $add=$row['Address']; 324 | echo "

$name

Employee-ID: $id
Dept-No.: $dept
Address: $add
Contact: $contact

"; 325 | $count=$count-1; 326 | } 327 | echo "
"; 328 | } 329 | else if(isset($_GET['pid'])&&((strcmp($_GET['pid'],"add_emp")==0))) 330 | { 331 | if(isset($_GET['option'])&&(strcmp($_GET['option'],"insert")==0)) 332 | { 333 | $dept=$_POST['dept_no']; 334 | $result=mysql_query("select max(Employee_ID) count from employee where Dept_No=\"$dept\";"); 335 | $row=mysql_fetch_array($result); 336 | $count=$row['count']; 337 | if($count>=0) 338 | { 339 | $ptr=stripos($dept,"-"); 340 | $Dept=substr($dept,0,$ptr); 341 | $ptr=stripos($count,"-"); 342 | $count=substr($count,$ptr+1); 343 | echo "$count"; 344 | $Emp_ID=$Dept.'-'.("$count"+1); 345 | //$dept_no_temp=substr($dept,$ptr+1); 346 | //$dept_no=$Dept.'-'.("$dept_no_temp"+1); 347 | //echo "$Emp_ID"; 348 | } 349 | $name=$_POST['name']; 350 | $address=$_POST['address']; 351 | $dob=$_POST['dob']; 352 | if(isset($_POST['contact'])) 353 | $contact=$_POST['contact']; 354 | else $contact="NULL"; 355 | $type=$_POST['category']; 356 | $gender=$_POST['gender']; 357 | //$bg=$_POST['BG']; 358 | $salary=$_POST['salary']; 359 | if(strcmp($type,"Doctor")==0) 360 | { 361 | if(isset($_POST['batch'])) 362 | $batch=$_POST['batch']; 363 | else 364 | { 365 | echo ""; 366 | header('Location: ?pid=add_emp'); 367 | } 368 | } 369 | mysql_query("insert into employee values (\"$Emp_ID\", \"$name\", \"$address\", \"$dob\", \"$contact\", \"$gender\", \"$salary\",\"$type\",\"$dept\" )"); 370 | $result=mysql_query("select * from Deparments where Dept_No=\"$dept\";"); 371 | $row=mysql_fetch_array($result); 372 | $noe=$row['noe']+1; 373 | mysql_query("UPDATE Departments SET noe=$noe"); 374 | if(strcmp($type,"Doctor")==0) 375 | mysql_query("insert into doctors values (\"$batch\",\"$Emp_ID\")"); 376 | if(strcmp($type,"Doctor")==0) 377 | header('Location: ?pid=view_doctors'); 378 | else if(strcmp($type,"Adminstration")==0) 379 | header('Location: ?pid=view_admin'); 380 | else header('Location: ?pid=view_staff'); 381 | } 382 | else 383 | { 384 | echo "

Registeration

"; 385 | echo ""; 386 | echo ""; 387 | echo ""; 388 | echo ""; 389 | echo ""; 390 | echo ""; 391 | echo ""; 392 | echo ""; 393 | echo ""; 394 | echo ""; 406 | /*echo "";*/ 407 | echo ""; 408 | echo "

Name:

Address:

Date of Brith:

Contact:

Gender:

Category:

Batch Number:

Salary:

Dept. No:

Room Type:

"; 409 | echo "
"; 410 | } 411 | } 412 | else if(isset($_GET['pid'])&&((strcmp($_GET['pid'],"del_emp")==0))) 413 | { 414 | if(isset($_GET['option'])&&(strcmp($_GET['option'],"delete")==0)) 415 | { 416 | $id=$_POST['id']; 417 | if(isset($id)) 418 | mysql_query("delete from employee where Employee_ID='$id'; "); 419 | header('Location: ?pid=del_emp'); 420 | } 421 | else 422 | { 423 | echo "
"; 424 | echo ""; 425 | echo ""; 426 | echo "
"; 427 | } 428 | } 429 | else if(isset($_GET['pid'])&&((strcmp($_GET['pid'],"add_patient")==0))) 430 | { 431 | if(isset($_GET['option'])&&(strcmp($_GET['option'],"insert")==0)) 432 | { 433 | $result=mysql_query("select max(Patient_ID) count from patients;"); 434 | $name=$_POST['name']; 435 | $address=$_POST['address']; 436 | $dob=$_POST['dob']; 437 | if(isset($_POST['contact'])) 438 | $contact=$_POST['contact']; 439 | else $contact="NULL"; 440 | $gender=$_POST['gender']; 441 | $bg=$_POST['BG']; 442 | $row=mysql_fetch_array($result); 443 | $id=$row['count']; 444 | /*if(strlen($id)>=9) 445 | $id="P0".($id+1); 446 | else if(strlen($id)<9) 447 | $id="P00".($id+1);*/ 448 | $id="P".(substr($id,1)+1); 449 | mysql_query("insert into patients values (\"$id\", \"$name\", \"$address\", \"$dob\", \"$contact\", \"$gender\", \"$bg\")"); 450 | header('Location: ?pid=view_patient'); 451 | } 452 | else 453 | { 454 | echo "

Registeration

"; 455 | echo ""; 456 | echo ""; 457 | echo ""; 458 | echo ""; 459 | echo ""; 460 | echo ""; 461 | echo ""; 462 | /*echo "";*/ 463 | echo ""; 464 | echo "

Name:

Address:

Date of Brith:

Contact:

Blood Group:

Gender:

Room Type:

"; 465 | echo "
"; 466 | } 467 | } 468 | else if(isset($_GET['pid'])&&((strcmp($_GET['pid'],"del_patient")==0))) 469 | { 470 | if(isset($_GET['option'])&&(strcmp($_GET['option'],"delete")==0)) 471 | { 472 | $id=$_POST['id']; 473 | if(isset($id)) 474 | mysql_query("delete from patients where Patient_ID='$id'; "); 475 | header('Location: ?pid=view_patient'); 476 | } 477 | else 478 | { 479 | echo "
"; 480 | echo ""; 481 | echo ""; 482 | echo "
"; 483 | } 484 | } 485 | else if(isset($_GET['pid'])&&((strcmp($_GET['pid'],"mod_emp")==0))) 486 | { 487 | if(isset($_GET['option'])&&(strcmp($_GET['option'],"mod_insert")==0)) 488 | { 489 | $id=$_GET['id']; 490 | $name=$_POST['name']; 491 | $address=$_POST['address']; 492 | $dob=$_POST['dob']; 493 | if(isset($contact)) 494 | $contact=$_POST['contact']; 495 | else $contact="NULL"; 496 | $gender=$_POST['gender']; 497 | $salary=$_POST['salary']; 498 | //echo "update Patients SET Name=\"$name\", Address=\"$address\", DOB=\"$dob\", Contact=\"$contact\", Gender=\"$gender\", Blood_Group=\"$bg\" where Patient_ID=$id;"; 499 | mysql_query("update Employee SET Name=\"$name\", Address=\"$address\", DOB=\"$dob\", Contact=\"$contact\", Gender=\"$gender\", Salary=\"$salary\" where Employee_ID=\"$id\" "); 500 | header('Location: ?pid=mod_emp'); 501 | } 502 | else if(isset($_GET['option'])&&(strcmp($_GET['option'],"mod_form")==0)) 503 | { 504 | $id=$_POST['id']; 505 | if(isset($id)) 506 | { 507 | $result=mysql_query("select * from employee where Employee_ID='$id'; "); 508 | if(isset($result)) 509 | { 510 | $row=mysql_fetch_array($result); 511 | $name=$row['Name']; 512 | $address=$row['Address']; 513 | $dob=$row['DOB']; 514 | $contact=$row['Contact']; 515 | $gender=$row['Gender']; 516 | $salary=$row['Salary']; 517 | echo "

Modify

"; 518 | echo ""; 519 | echo ""; 520 | echo ""; 521 | echo ""; 522 | echo ""; 523 | echo ""; 524 | echo ""; 525 | if(strcmp($gender,"Male")==0) 526 | echo ""; 527 | else echo ""; 528 | /*echo "";*/ 529 | echo ""; 530 | echo "

Name:

Address:

Date of Brith:

Contact:

Salary:

Gender:

Gender:

Room Type:

"; 531 | echo "
"; 532 | } 533 | } 534 | } 535 | else 536 | { 537 | echo "
"; 538 | echo ""; 539 | echo ""; 540 | echo "
"; 541 | } 542 | } 543 | else if(isset($_GET['pid'])&&((strcmp($_GET['pid'],"mod_patient")==0))) 544 | { 545 | if(isset($_GET['option'])&&(strcmp($_GET['option'],"mod_insert")==0)) 546 | { 547 | $id=$_GET['id']; 548 | $name=$_POST['name']; 549 | $address=$_POST['address']; 550 | $dob=$_POST['dob']; 551 | if(isset($contact)) 552 | $contact=$_POST['contact']; 553 | else $contact="NULL"; 554 | $gender=$_POST['gender']; 555 | $bg=$_POST['BG']; 556 | //echo "update Patients SET Name=\"$name\", Address=\"$address\", DOB=\"$dob\", Contact=\"$contact\", Gender=\"$gender\", Blood_Group=\"$bg\" where Patient_ID=$id;"; 557 | mysql_query("update Patients SET Name=\"$name\", Address=\"$address\", DOB=\"$dob\", Contact=\"$contact\", Gender=\"$gender\", Blood_Group=\"$bg\" where Patient_ID=\"$id\" "); 558 | header('Location: ?pid=view_patient'); 559 | } 560 | else if(isset($_GET['option'])&&(strcmp($_GET['option'],"mod_form")==0)) 561 | { 562 | $id=$_POST['id']; 563 | if(isset($id)) 564 | { 565 | $result=mysql_query("select * from patients where Patient_ID='$id'; "); 566 | if(isset($result)) 567 | { 568 | $row=mysql_fetch_array($result); 569 | $name=$row['Name']; 570 | $address=$row['Address']; 571 | $dob=$row['DOB']; 572 | $contact=$row['Contact']; 573 | $gender=$row['Gender']; 574 | $bg=$row['Blood_Group']; 575 | echo "

Modify

"; 576 | echo ""; 577 | echo ""; 578 | echo ""; 579 | echo ""; 580 | echo ""; 581 | echo ""; 582 | echo ""; 583 | if(strcmp($gender,"Male")==0) 584 | echo ""; 585 | else echo ""; 586 | /*echo "";*/ 587 | echo ""; 588 | echo "

Name:

Address:

Date of Brith:

Contact:

Blood Group:

Gender:

Gender:

Room Type:

"; 589 | echo "
"; 590 | } 591 | } 592 | } 593 | else 594 | { 595 | echo "
"; 596 | echo ""; 597 | echo ""; 598 | echo "
"; 599 | } 600 | } 601 | else if(isset($_GET['option'])&&isset($_GET['pid'])&&((strcmp($_GET['pid'],"view_patient")==0))&&((strcmp($_GET['option'],"search_tools")==0))) 602 | { 603 | echo ""; 604 | echo ""; 605 | echo ""; 606 | echo "
"; 607 | echo "
 Advanced Search
"; 608 | echo ""; 609 | echo ""; 610 | echo "
Filters:
"; 611 | } 612 | else if(isset($_GET['pid'])&&((strcmp($_GET['pid'],"view_patient")==0)||(strcmp($_GET['pid'],"patient_details")==0))) 613 | { 614 | echo "
"; 615 | echo ""; 616 | echo ""; 617 | echo "
 Advanced Search
"; 618 | if((strcmp($_GET['pid'],"patient_details")==0)) 619 | { 620 | $searchby=$_GET['id']; 621 | $result=mysql_query("select * from patients where Patient_ID='$searchby'"); 622 | echo "
"; 623 | $row=mysql_fetch_array($result); 624 | $name=$row['Name']; 625 | $eid=$row['Patient_ID']; 626 | //$dept=$row['Dept_No']; 627 | $gender=$row['Gender']; 628 | $contact=$row['Contact']; 629 | $dob=$row['DOB']; 630 | $add=$row['Address']; 631 | $bg=$row['Blood_Group']; 632 | echo "

Patient Details

"; 633 | echo ""; 634 | echo ""; 635 | echo ""; 636 | echo ""; 637 | echo ""; 638 | echo ""; 639 | echo ""; 640 | echo ""; 641 | echo ""; 642 | echo "
Name: $name
Patient ID: $eid
Date of Birth: $dob
Department:
Contact: $contact
Gender: $gender
Address: $add
Blood Group: $bg
"; 643 | $flag=1; 644 | } 645 | else if(isset($_GET['option'])&&strcmp($_GET['option'],"search_val")==0) 646 | { 647 | if(!empty($_POST['search_patient'])) 648 | $searchby=$_POST['search_patient']; 649 | else $searchby='%'; 650 | if(!empty($_POST['age'])) 651 | $searchbyage=$_POST['age']; 652 | if(!empty($_POST['gender'])&&(strcmp($_POST['gender'],"All"))) 653 | $searchbysex=$_POST['gender']; 654 | if(!empty($_POST['BG'])&&(strcmp($_POST['BG'],"BG"))) 655 | $searchbybg=$_POST['BG']; 656 | if(!empty($_POST['aname'])) 657 | $searchbyaname=$_POST['aname']; 658 | $flag=0; 659 | if(!empty($searchby)&&(($searchby[0]=='P')||($searchby[0]=='p'))) 660 | { 661 | if(empty($searchbyaname)) 662 | $result=mysql_query("select * from patients where Patient_ID='$searchby'"); 663 | else $result=mysql_query("select * from patients p, accompanies a where p.Patient_ID='$searchby' and p.Patient_ID=a.Patient_ID and a.Name LIKE '%$searchbyaname%'"); 664 | if(!empty($result) && mysql_num_rows($result)==1) 665 | { 666 | echo "
"; 667 | $row=mysql_fetch_array($result); 668 | $name=$row['Name']; 669 | $eid=$row['Patient_ID']; 670 | //$dept=$row['Dept_No']; 671 | $gender=$row['Gender']; 672 | $contact=$row['Contact']; 673 | $dob=$row['DOB']; 674 | $add=$row['Address']; 675 | $bg=$row['Blood_Group']; 676 | echo "

Patient Details

"; 677 | echo ""; 678 | echo ""; 679 | echo ""; 680 | echo ""; 681 | echo ""; 682 | echo ""; 683 | echo ""; 684 | echo ""; 685 | echo ""; 686 | echo "
Name: $name
Patient ID: $eid
Date of Birth: $dob
Department:
Contact: $contact
Gender: $gender
Address: $add
Blood Group: $bg
"; 687 | $flag=1; 688 | } 689 | } 690 | if(!empty($searchby)&&($flag==0)) 691 | { 692 | if(!empty($searchbysex)&&!empty($searchbyage)&&!empty($searchbyaname)&&!empty($searchbybg)) 693 | $result=mysql_query("select p.Name,p.Patient_ID,p.Gender,p.Contact,p.DOB,p.Address,p.Blood_Group from patients p, accompanies a where p.Name LIKE '%$searchby%' and p.Patient_ID=a.Patient_ID and a.Name LIKE '%$searchbyaname%' and p.Gender LIKE '$searchbysex' and floor(DATEDIFF(CURDATE(),p.DOB)/365)=$searchbyage and p.Blood_Group LIKE '$searchbybg'"); 694 | else if(!empty($searchbysex)&&!empty($searchbyage)&&!empty($searchbyaname)) 695 | $result=mysql_query("select p.Name,p.Patient_ID,p.Gender,p.Contact,p.DOB,p.Address,p.Blood_Group from patients p, accompanies a where p.Name LIKE '%$searchby%' and p.Patient_ID=a.Patient_ID and a.Name LIKE '%$searchbyaname%' and p.Gender LIKE '$searchbysex' and floor(DATEDIFF(CURDATE(),p.DOB)/365)=$searchbyage"); 696 | else if(!empty($searchbysex)&&!empty($searchbybg)&&!empty($searchbyaname)) 697 | $result=mysql_query("select p.Name,p.Patient_ID,p.Gender,p.Contact,p.DOB,p.Address,p.Blood_Group from patients p, accompanies a where p.Name LIKE '%$searchby%' and p.Patient_ID=a.Patient_ID and a.Name LIKE '%$searchbyaname%' and p.Gender LIKE '$searchbysex' and p.Blood_Group LIKE '$searchbybg'"); 698 | else if(!empty($searchbysex)&&!empty($searchbyage)&&!empty($searchbybg)) 699 | $result=mysql_query("select * from patients where Name LIKE '%$searchby%' and Gender LIKE '$searchbysex' and floor(DATEDIFF(CURDATE(),p.DOB)/365)=$searchbyage and Blood_Group LIKE '$searchbybg'"); 700 | else if(!empty($searchbyaname)&&!empty($searchbyage)&&!empty($searchbybg)) 701 | $result=mysql_query("select p.Name,p.Patient_ID,p.Gender,p.Contact,p.DOB,p.Address,p.Blood_Group from patients p, accompanies a where p.Name LIKE '%$searchby%' and p.Patient_ID=a.Patient_ID and a.Name LIKE '%$searchbyaname%' and floor(DATEDIFF(CURDATE(),p.DOB)/365)=$searchbyage and p.Blood_Group LIKE '$searchbybg'"); 702 | else if(!empty($searchbysex)&&!empty($searchbybg)) 703 | $result=mysql_query("select * from patients where Name LIKE '%$searchby%' and Gender LIKE '$searchbysex' and Blood_Group LIKE '$searchbybg' "); 704 | else if(!empty($searchbysex)&&!empty($searchbyage)) 705 | $result=mysql_query("select * from patients where Name LIKE '%$searchby%' and Gender LIKE '$searchbysex' and floor(DATEDIFF(CURDATE(),DOB)/365)=$searchbyage"); 706 | else if(!empty($searchbybg)&&!empty($searchbyage)) 707 | $result=mysql_query("select * from patients where Name LIKE '%$searchby%' and Blood_Group LIKE '$searchbybg' and floor(DATEDIFF(CURDATE(),DOB)/365)=$searchbyage"); 708 | else if(!empty($searchbysex)&&!empty($searchbyaname)) 709 | $result=mysql_query("select p.Name,p.Patient_ID,p.Gender,p.Contact,p.DOB,p.Address,p.Blood_Group from patients p, accompanies a where p.Name LIKE '%$searchby%' and p.Patient_ID=a.Patient_ID and a.Name LIKE '%$searchbyaname%' and p.Gender LIKE '$searchbysex' "); 710 | else if(!empty($searchbyage)&&!empty($searchbyaname)) 711 | $result=mysql_query("select p.Name,p.Patient_ID,p.Gender,p.Contact,p.DOB,p.Address,p.Blood_Group from patients p, accompanies a where p.Name LIKE '%$searchby%' and p.Patient_ID=a.Patient_ID and a.Name LIKE '%$searchbyaname%' and floor(DATEDIFF(CURDATE(),p.DOB)/365)=$searchbyage"); 712 | else if(!empty($searchbyaname)&&!empty($searchbybg)) 713 | $result=mysql_query("select p.Name,p.Patient_ID,p.Gender,p.Contact,p.DOB,p.Address,p.Blood_Group from patients p, accompanies a where p.Name LIKE '%$searchby%' and p.Patient_ID=a.Patient_ID and a.Name LIKE '%$searchbyaname%' and p.Blood_Group LIKE '$searchbybg'"); 714 | else if(!empty($searchbysex)) 715 | $result=mysql_query("select * from patients where Name LIKE '%$searchby%' and Gender LIKE '$searchbysex' "); 716 | else if(!empty($searchbybg)) 717 | $result=mysql_query("select * from patients where Name LIKE '%$searchby%' and Blood_Group LIKE '$searchbybg' "); 718 | else if(!empty($searchbyage)) 719 | $result=mysql_query("select * from patients where Name LIKE '%$searchby%' and floor(DATEDIFF(CURDATE(),DOB)/365)=$searchbyage"); 720 | else if(!empty($searchbyaname)) 721 | $result=mysql_query("select p.Name,p.Patient_ID,p.Gender,p.Contact,p.DOB,p.Address,p.Blood_Group from patients p, accompanies a where p.Name LIKE '%$searchby%' and p.Patient_ID=a.Patient_ID and a.Name LIKE '%$searchbyaname%'"); 722 | else $result=mysql_query("select * from patients where Name LIKE '%$searchby%'"); 723 | if(!empty($result) && mysql_num_rows($result)==1) 724 | { 725 | echo "
"; 726 | $row=mysql_fetch_array($result); 727 | $name=$row['Name']; 728 | $eid=$row['Patient_ID']; 729 | //$dept=$row['Dept_No']; 730 | $gender=$row['Gender']; 731 | $contact=$row['Contact']; 732 | $dob=$row['DOB']; 733 | $add=$row['Address']; 734 | $bg=$row['Blood_Group']; 735 | echo "

Patient Details

"; 736 | echo ""; 737 | echo ""; 738 | echo ""; 739 | echo ""; 740 | //echo ""; 741 | echo ""; 742 | echo ""; 743 | echo ""; 744 | echo ""; 745 | echo "
Name: $name
Patient ID: $eid
Date of Birth: $dob
Department:
Contact: $contact
Gender: $gender
Address: $add
Blood Group: $bg
"; 746 | $flag=1; 747 | } 748 | else if(!empty($result) && mysql_num_rows($result)>1) 749 | { 750 | echo "
"; 751 | echo "
"; 752 | for($i=0;$i"; 759 | echo "

$name

"; 760 | echo "

Patient ID: $eid
Date of Birth: $dob

"; 761 | echo "
"; 762 | } 763 | echo "
"; 764 | $flag=1; 765 | } 766 | } 767 | if($flag==0) 768 | echo "No match found."; 769 | } 770 | } 771 | else if(isset($_GET['pid'])&&((strcmp($_GET['pid'],"view_accompanies")==0)||(strcmp($_GET['pid'],"accompany_details")==0))) 772 | { 773 | echo "
"; 774 | echo ""; 775 | echo ""; 776 | echo "
"; 777 | if((strcmp($_GET['pid'],"accompany_details")==0)) 778 | { 779 | $id=$_GET['id']; 780 | $name=$_GET['name']; 781 | $result=mysql_query("select * from accompanies where Patient_ID='$id' && Name='$name' "); 782 | if(!empty($result) && mysql_num_rows($result)==1) 783 | { 784 | echo "
"; 785 | $row=mysql_fetch_array($result); 786 | $name=$row['Name']; 787 | $eid=$row['Patient_ID']; 788 | //$dept=$row['Dept_No']; 789 | $gender=$row['Gender']; 790 | $contact=$row['Contact']; 791 | $dob=$row['DOB']; 792 | $add=$row['Address']; 793 | $rel=$row['Relationship']; 794 | echo "

Accompany's Details

"; 795 | echo ""; 796 | echo ""; 797 | echo ""; 798 | echo ""; 799 | echo ""; 800 | echo ""; 801 | echo ""; 802 | echo ""; 803 | echo "
Name: $name
Patient ID: $eid
Date of Birth: $dob
Contact: $contact
Gender: $gender
Address: $add
Relation: $rel
"; 804 | $flag=1; 805 | } 806 | } 807 | if((isset($_GET['option']))&&(strcmp($_GET['option'],"search_val")==0)) 808 | { 809 | if(!empty($_POST['search_accompany'])) 810 | $searchby=$_POST['search_accompany']; 811 | else $searchby='%'; 812 | $flag=0; 813 | if(!empty($searchby)&&(($searchby[0]=='P')||($searchby[0]=='p'))) 814 | { 815 | $result=mysql_query("select * from accompanies where Patient_ID='$searchby'"); 816 | if(!empty($result) && mysql_num_rows($result)==1) 817 | { 818 | echo "
"; 819 | $row=mysql_fetch_array($result); 820 | $name=$row['Name']; 821 | $eid=$row['Patient_ID']; 822 | //$dept=$row['Dept_No']; 823 | $gender=$row['Gender']; 824 | $contact=$row['Contact']; 825 | $dob=$row['DOB']; 826 | $add=$row['Address']; 827 | $rel=$row['Relationship']; 828 | echo "

Accompany's Details

"; 829 | echo ""; 830 | echo ""; 831 | echo ""; 832 | echo ""; 833 | echo ""; 834 | echo ""; 835 | echo ""; 836 | echo ""; 837 | echo "
Name: $name
Patient ID: $eid
Date of Birth: $dob
Contact: $contact
Gender: $gender
Address: $add
Relation: $rel
"; 838 | $flag=1; 839 | } 840 | else if(!empty($result) && mysql_num_rows($result)>1) 841 | { 842 | echo "
"; 843 | echo "
"; 844 | for($i=0;$i"; 851 | echo "

$name

"; 852 | echo "

Patient ID: $eid
Realtion: $rel

"; 853 | echo "
"; 854 | } 855 | echo "
"; 856 | $flag=1; 857 | } 858 | } 859 | if(!empty($searchby)&&($flag==0)) 860 | { 861 | $result=mysql_query("select * from patients p,accompanies a where p.Patient_ID=a.Patient_ID and p.Name LIKE '%$searchby%'"); 862 | if(!empty($result) && mysql_num_rows($result)==1) 863 | { 864 | echo "
"; 865 | $row=mysql_fetch_array($result); 866 | $name=$row['Name']; 867 | $eid=$row['Patient_ID']; 868 | //$dept=$row['Dept_No']; 869 | $gender=$row['Gender']; 870 | $contact=$row['Contact']; 871 | $dob=$row['DOB']; 872 | $add=$row['Address']; 873 | $rel=$row['Relationship']; 874 | echo "

Accompany's Details

"; 875 | echo ""; 876 | echo ""; 877 | echo ""; 878 | echo ""; 879 | echo ""; 880 | echo ""; 881 | echo ""; 882 | echo ""; 883 | echo "
Name: $name
Patient ID: $eid
Date of Birth: $dob
Contact: $contact
Gender: $gender
Address: $add
Relation: $rel
"; 884 | $flag=1; 885 | } 886 | else if(!empty($result) && mysql_num_rows($result)>1) 887 | { 888 | echo "
"; 889 | echo "
"; 890 | for($i=0;$i"; 897 | echo "

$name

"; 898 | echo "

Patient ID: $eid
Realtion: $rel

"; 899 | echo "
"; 900 | } 901 | echo "
"; 902 | $flag=1; 903 | } 904 | if($flag==0) 905 | echo "No match found."; 906 | } 907 | } 908 | } 909 | else if(isset($_GET['pid'])&&(strcmp($_GET['pid'],"logout")==0)) 910 | { 911 | $username=$_COOKIE['username']; 912 | $sessionid=$_COOKIE['PHPSESSID']; 913 | if(mysql_query("select * from session where username='$username' and id='$sessionid'")) 914 | { 915 | $result=mysql_query("delete from session where username='$username'and id='$sessionid'"); 916 | setcookie("username",$_POST['username'],time()-3600); 917 | unset($_SESSION['PHPSESSID']); 918 | header('Location: index.php'); 919 | } 920 | echo "
"; 921 | } 922 | else if(isset($_GET['pid'])&&((strcmp($_GET['pid'],"view_dept")==0)||(strcmp($_GET['pid'],"dept_details")==0)||(strcmp($_GET['pid'],"emp_details")==0))) 923 | { 924 | if((strcmp($_GET['pid'],"view_dept")==0)) 925 | { 926 | $result=mysql_query("select * from departments"); 927 | echo "
"; 928 | echo "
"; 929 | for($i=0;$i"; 935 | echo "

$name

"; 936 | echo "

Department No.: $d_id

"; 937 | echo "
"; 938 | } 939 | echo "
"; 940 | } 941 | else if((strcmp($_GET['pid'],"dept_details")==0)) 942 | { 943 | $searchby=$_GET['id']; 944 | $result=mysql_query("select * from departments where Dept_No='$searchby'"); 945 | echo "
"; 946 | $row=mysql_fetch_array($result); 947 | $name=$row['Name']; 948 | $d_id=$row['Dept_No']; 949 | $loc=$row['Location']; 950 | $nem=$row['NOE']; 951 | echo "

Department Details

"; 952 | echo ""; 953 | echo ""; 954 | echo ""; 955 | echo ""; 956 | //echo ""; 957 | echo "
Name: $name
Deparment No.: $d_id
Location: $loc
Number of employees: $nem
"; 958 | echo "

Employee Names:

"; 959 | $result2=mysql_query("select * from employee where Dept_No='$d_id'"); 960 | echo "
"; 961 | echo "
"; 962 | if(!empty($result2)) 963 | for($i=0;$i"; 970 | echo "

$j.)$name      Employee ID: $eid

"; 971 | echo "
"; 972 | } 973 | echo "
"; 974 | } 975 | else if((strcmp($_GET['pid'],"emp_details")==0)) 976 | { 977 | $searchby=$_GET['id']; 978 | $result=mysql_query("select * from employee where Employee_ID='$searchby'"); 979 | echo "
"; 980 | $row=mysql_fetch_array($result); 981 | $name=$row['Name']; 982 | $eid=$row['Employee_ID']; 983 | $add=$row['Address']; 984 | $dob=$row['DOB']; 985 | $con=$row['Contact']; 986 | $sex=$row['Gender']; 987 | $dept=$row['Dept_No']; 988 | $dept1=mysql_query("select * from Departments where Dept_No='$dept'"); 989 | $row1=mysql_fetch_array($dept1); 990 | $dept_n=$row1['Name']; 991 | echo "

Employee Details

"; 992 | echo ""; 993 | echo ""; 994 | echo ""; 995 | echo ""; 996 | echo ""; 997 | echo ""; 998 | echo ""; 999 | echo ""; 1000 | echo "
Name: $name
Employee ID: $eid
Address: $add
DOB: $dob
Contact: $con
Gender: $sex
Department Name: $dept_n      $dept
"; 1001 | } 1002 | } 1003 | else if(isset($_GET['pid'])&&(strcmp($_GET['pid'],"del_dept")==0)) 1004 | { 1005 | echo "
"; 1006 | echo ""; 1007 | echo ""; 1008 | echo "
"; 1009 | if(isset($_GET['option'])&&strcmp($_GET['option'],"del_id")==0) 1010 | { 1011 | if(!empty($_POST['dept_id'])) 1012 | $d_id=$_POST['dept_id']; 1013 | $res=mysql_query("select * from departments where Dept_No='$d_id';"); 1014 | if(mysql_num_rows($res)!=0) 1015 | { 1016 | mysql_query("delete from departments where Dept_No='$d_id';"); 1017 | header('Location: login.php?pid=view_dept'); 1018 | } 1019 | else 1020 | echo ""; 1021 | } 1022 | } 1023 | else if(isset($_GET['pid'])&&(strcmp($_GET['pid'],"add_dept")==0)) 1024 | { 1025 | $flag=0; 1026 | echo("

New Department

"); 1027 | echo("
"); 1028 | echo(""); 1029 | echo(""); 1030 | echo(""); 1031 | echo(""); 1032 | echo("

Name      


Department Number      


Location      

"); 1033 | 1034 | if((!empty($_POST["nm"]))&&(!empty($_POST["id"]))&&(!empty($_POST["loc"]))) 1035 | { 1036 | $n=$_POST["nm"]; 1037 | $i=$_POST["id"]; 1038 | $l=$_POST["loc"]; 1039 | $result=mysql_query("select * from departments where Dept_No='$i';"); 1040 | if(mysql_num_rows($result)==0) 1041 | { 1042 | mysql_query("insert into Departments values (\"$n\",\"$l\",\"$i\",0);"); 1043 | header('Location: login.php?pid=view_dept'); 1044 | } 1045 | else 1046 | echo ("*Department No. already exists*"); 1047 | } 1048 | } 1049 | else if(isset($_GET['pid'])&&((strcmp($_GET['pid'],"mod_dept")==0))) 1050 | { 1051 | if(isset($_GET['option'])&&(strcmp($_GET['option'],"mod_insert")==0)) 1052 | { 1053 | $id=$_GET['id']; 1054 | $name=$_POST['name']; 1055 | $loc=$_POST['loc']; 1056 | mysql_query("update Departments SET Name=\"$name\", Location=\"$loc\" where Dept_No=\"$id\";"); 1057 | header('Location: ?pid=view_dept'); 1058 | } 1059 | else if(isset($_GET['option'])&&(strcmp($_GET['option'],"mod_form")==0)) 1060 | { 1061 | $id=$_POST['id']; 1062 | if(isset($id)) 1063 | { 1064 | $result=mysql_query("select * from departments where Dept_No='$id'; "); 1065 | if(isset($result)&&(mysql_num_rows($result)!=0 )) 1066 | { 1067 | $row=mysql_fetch_array($result); 1068 | $name=$row['Name']; 1069 | $loc=$row['Location']; 1070 | echo("

Modify Department

"); 1071 | echo $id; 1072 | echo("
"); 1073 | //echo(""); 1074 | echo ("

Name      

"); 1075 | echo(""); 1076 | echo(""); 1077 | echo("
Name:

Location      

"); 1078 | } 1079 | else 1080 | { 1081 | echo ("

*Invalid Department No.*

"); 1082 | echo ("
Go Back
"); 1083 | } 1084 | } 1085 | } 1086 | else 1087 | { 1088 | echo "
"; 1089 | echo ""; 1090 | echo ""; 1091 | echo "
"; 1092 | } 1093 | } 1094 | else if(isset($_GET['pid'])&&(strcmp($_GET['pid'],"allot_room")==0)) 1095 | { 1096 | echo("

Room Allotment

"); 1097 | echo("
"); 1098 | echo(""); 1099 | echo(""); 1100 | echo(""); 1101 | echo(""); 1102 | echo("

Room Type:

Patient ID:

Allotment(Today's)Date:

"); 1103 | if((!empty($_POST["type"]))&&(!empty($_POST["id"]))&&(!empty($_POST["date"]))) 1104 | { 1105 | $type=$_POST["type"]; 1106 | $id=$_POST["id"]; 1107 | $date=$_POST["date"]; 1108 | $res1=mysql_query("select * from patients where Patient_ID='$id';"); 1109 | if(mysql_num_rows($res1)==0) 1110 | { 1111 | echo ""; 1112 | } 1113 | else 1114 | { 1115 | $res2=mysql_query("select * from room where ((type='$type') and (patient_id is null));"); 1116 | if(mysql_num_rows($res2)!=0) 1117 | { 1118 | $row=mysql_fetch_array($res2); 1119 | $r_no=$row['Room_No']; 1120 | mysql_query("insert into room_given values (\"$r_no\",\"$id\",'$date',null);"); 1121 | mysql_query("update room SET Patient_ID=\"$id\" where Room_No=\"$r_no\";"); 1122 | //if(mysql_affected_rows()!=0) 1123 | echo("Alloted Succesfully
Room No.= "); 1124 | echo($r_no); 1125 | } 1126 | else 1127 | echo ""; 1128 | } 1129 | } 1130 | } 1131 | else if(isset($_GET['pid'])&&(strcmp($_GET['pid'],"allot_vehicle")==0)) 1132 | { 1133 | echo("

Vehicle Allotment to Patients

"); 1134 | echo("
"); 1135 | echo(""); 1136 | echo(""); 1137 | echo(""); 1138 | echo(""); 1139 | echo("

Vehicle Type:

Patient ID:

Allotment(Today's)Date:

"); 1140 | if((!empty($_POST["type"]))&&(!empty($_POST["id"]))&&(!empty($_POST["date"]))) 1141 | { 1142 | $type=$_POST["type"]; 1143 | $id=$_POST["id"]; 1144 | $date=$_POST["date"]; 1145 | $res1=mysql_query("select * from patients where Patient_ID='$id';"); 1146 | if(mysql_num_rows($res1)==0) 1147 | echo ""; 1148 | else 1149 | { 1150 | $res3=mysql_query("select * from vehicle_given where id='$id' and return_date is null;"); 1151 | if(mysql_num_rows($res3)!=0) 1152 | echo ""; 1153 | else 1154 | { 1155 | $res2=mysql_query("select * from vehicles where ((type='$type') and id is null);"); 1156 | if(mysql_num_rows($res2)!=0) 1157 | { 1158 | $row=mysql_fetch_array($res2); 1159 | $reg_no=$row['Reg_No']; 1160 | mysql_query("insert into vehicle_given values (\"$reg_no\",\"$id\",'$date',null);"); 1161 | mysql_query("update vehicles SET id=$id where Reg_No=\"$reg_no\";"); 1162 | echo("Alloted Succesfully
Vehicle Reg No.= "); 1163 | echo($reg_no); 1164 | } 1165 | else 1166 | echo ""; 1167 | } 1168 | } 1169 | } 1170 | } 1171 | else if(isset($_GET['pid'])&&(strcmp($_GET['pid'],"allot_ms")==0)) 1172 | { 1173 | echo("

Assign Medical Duty for a Room

"); 1174 | echo("
"); 1175 | echo(""); 1176 | echo(""); 1177 | echo(""); 1178 | echo(""); 1179 | echo(""); 1180 | echo(""); 1181 | echo("

Room_No:

Medical-Staff ID:

Date:

Joining Time:

Leave Time:

"); 1182 | if((!empty($_POST["room"]))&&(!empty($_POST["id"]))&&(!empty($_POST["date"]))&&(!empty($_POST["jtime"]))&&(!empty($_POST["ltime"]))) 1183 | { 1184 | $room=$_POST["room"]; 1185 | $id=$_POST["id"]; 1186 | $date=$_POST["date"]; 1187 | $jtime=$_POST['jtime']; 1188 | $ltime=$_POST['ltime']; 1189 | $res1=mysql_query("select * from employee where Employee_ID='$id';"); 1190 | $res2=mysql_query("select * from room where Room_No='$room';"); 1191 | if((mysql_num_rows($res1)==0)||(mysql_num_rows($res2)==0)) 1192 | { 1193 | if(mysql_num_rows($res1)==0) 1194 | echo ""; 1195 | else 1196 | echo ""; 1197 | } 1198 | else if((strcmp($id[0],'M')!=0)&&(strcmp($id[1],'S')==0)) 1199 | echo ""; 1200 | else if(strcmp($jtime,$ltime)>0) 1201 | echo ""; 1202 | else 1203 | { 1204 | if((strcmp($id[0],'M')!=0)&&(strcmp($id[1],'S')!=0)) 1205 | { 1206 | $res1=mysql_query("select * from room where Room_No='$room' and Patient_ID is null;"); 1207 | if(mysql_num_rows($res1)!=0) 1208 | echo ""; 1209 | else 1210 | { 1211 | //if(isset($res1)) 1212 | $res2=mysql_query("select * from room where Room_No='$room';"); 1213 | $row1=mysql_fetch_array($res2); 1214 | $patient=$row1['Patient_ID']; 1215 | $res=mysql_query("select * from doctors where employee_id='$id';"); 1216 | $row=mysql_fetch_array($res); 1217 | $batch=$row['Batch_No']; 1218 | //echo "batch_no=".$batch; 1219 | //echo "patient_id=".$patient; 1220 | mysql_query("insert into attended_by values('$patient','$batch','$date');"); 1221 | mysql_query("insert into governed_by values(\"$id\",\"$room\",'$date','$jtime','$ltime');"); 1222 | echo ""; 1223 | } 1224 | } 1225 | else 1226 | { 1227 | mysql_query("insert into governed_by values(\"$id\",\"$room\",'$date','$jtime','$ltime');"); 1228 | echo ""; 1229 | } 1230 | } 1231 | 1232 | } 1233 | } 1234 | else if(isset($_GET['pid'])&&(strcmp($_GET['pid'],"view_ms")==0)) 1235 | { 1236 | echo "
"; 1237 | echo ""; 1238 | echo ""; 1239 | echo "
"; 1240 | if(isset($_GET['option'])&&strcmp($_GET['option'],"room_id")==0) 1241 | { 1242 | //echo "coming"; 1243 | if(!empty($_POST['room'])) 1244 | $room=$_POST['room']; 1245 | //echo "room=".$room; 1246 | $res=mysql_query("select * from governed_by where Room_No='$room';"); 1247 | if(mysql_num_rows($res)!=0) 1248 | { 1249 | echo("
"); 1250 | for($i=0;$i"); 1259 | } 1260 | echo("
  Employee ID    Room No.    Date    Joining Time    Leaving Time  
$emp$room$date$jtime$ltime
"); 1261 | } 1262 | else 1263 | echo ""; 1264 | } 1265 | } 1266 | else if(isset($_GET['pid'])&&(strcmp($_GET['pid'],"allot_doc")==0)) 1267 | { 1268 | echo("

Assign Doctor to Patient

"); 1269 | echo("
"); 1270 | echo(""); 1271 | echo(""); 1272 | echo(""); 1273 | echo(""); 1274 | echo("

Patient ID:

Doctor-ID:

Date:

"); 1275 | if((!empty($_POST["pid"]))&&(!empty($_POST["eid"]))&&(!empty($_POST["date"]))) 1276 | { 1277 | $pid=$_POST["pid"]; 1278 | $eid=$_POST["eid"]; 1279 | $date=$_POST["date"]; 1280 | $pres=mysql_query("select * from patients where Patient_ID='$pid';"); 1281 | $dres=mysql_query("select * from doctors where Employee_ID='$eid';"); 1282 | $row=mysql_fetch_array($dres); 1283 | if(mysql_num_rows($pres)==0) 1284 | echo ""; 1285 | else if(mysql_num_rows($dres)==0) 1286 | echo ""; 1287 | else 1288 | { 1289 | $batch=$row['Batch_No']; 1290 | mysql_query("insert into attended_by values('$pid','$batch','$date');"); 1291 | if(mysql_affected_rows()==1) 1292 | echo ""; 1293 | } 1294 | } 1295 | } 1296 | else if(isset($_GET['pid'])&&(strcmp($_GET['pid'],"unallot_room")==0)) 1297 | { 1298 | echo("

Room Un-Allotment

"); 1299 | echo("
"); 1300 | echo(""); 1301 | echo("

Room Number:

"); 1302 | echo(""); 1303 | echo("

Discharge Date:

"); 1304 | if((!empty($_POST["room"]))&&(!empty($_POST["date"]))) 1305 | { 1306 | $room=$_POST["room"]; 1307 | //echo $room; 1308 | $date=$_POST["date"]; 1309 | $res=mysql_query("select * from room_given where Room_No='$room' and Discharge_Date is null;"); 1310 | $row=mysql_fetch_array($res); 1311 | $allot_date=$row['Allot_date']; 1312 | if(mysql_num_rows($res)==0) 1313 | echo ""; 1314 | else if(strcmp($allot_date,$date)>0) 1315 | echo ""; 1316 | else 1317 | { 1318 | mysql_query("update room set patient_id=null where Room_No='$room';"); 1319 | mysql_query("update room_given set discharge_date='$date' where Room_No='$room' and discharge_date is null;"); 1320 | if(mysql_affected_rows()==1) 1321 | echo ""; 1322 | } 1323 | } 1324 | } 1325 | else if(isset($_GET['pid'])&&(strcmp($_GET['pid'],"unallot_vehicle")==0)) 1326 | { 1327 | echo("

Vehicle Un-Allotment

"); 1328 | echo("
"); 1329 | echo(""); 1330 | echo("

Registration Number:

"); 1331 | echo(""); 1332 | echo("

Returning Date:          

"); 1333 | if((!empty($_POST["reg"]))&&(!empty($_POST["date"]))) 1334 | { 1335 | $reg=$_POST["reg"]; 1336 | //echo $room; 1337 | $date=$_POST["date"]; 1338 | $res=mysql_query("select * from vehicle_given where Reg_No='$reg' and Return_Date is null;"); 1339 | $row=mysql_fetch_array($res); 1340 | $allot_date=$row['Allot_date']; 1341 | if(mysql_num_rows($res)==0) 1342 | echo ""; 1343 | else if(strcmp($allot_date,$date)>0) 1344 | echo ""; 1345 | else 1346 | { 1347 | mysql_query("update vehicles set ID=null where Reg_No='$reg';"); 1348 | mysql_query("update vehicle_given set return_date='$date' where Reg_No='$reg' and return_date is null;"); 1349 | if(mysql_affected_rows()==1) 1350 | echo ""; 1351 | } 1352 | } 1353 | } 1354 | else if(isset($_GET['pid']) && strcmp($_GET['pid'],"create_report") == 0) 1355 | { 1356 | echo "

Add Report Details

"; 1357 | echo "
"; 1358 | echo ""; 1359 | /*echo ""; 1360 | echo ""; 1361 | echo "";*/ 1362 | echo ""; 1363 | echo ""; 1365 | echo ""; 1374 | echo ""; 1376 | echo ""; 1377 | if(isset($_POST['PID'])&&isset($_POST['dept_no'])) 1378 | { 1379 | //$date=$_POST['date']; 1380 | $sel=mysql_query("SELECT curdate() date"); 1381 | $date=mysql_fetch_array($sel); 1382 | $date=$date['date']; 1383 | $cal=mysql_query("SELECT max(Report_No) R FROM medical_report"); 1384 | $row=mysql_fetch_array($cal); 1385 | $val=$row['R']; 1386 | $r_num="R".(substr($val,1)+1); 1387 | $pid=$_POST['PID']; 1388 | $dept_no=$_POST['dept_no']; 1389 | $check = mysql_query("SELECT * FROM patients where Patient_ID='$pid'"); 1390 | //$check1 = mysql_query("SELECT * FROM medical_report where Patient_ID='$pid'"); 1391 | $row=mysql_num_rows($check); 1392 | //$row1=mysql_num_rows($check1); 1393 | if($row>0) 1394 | { 1395 | $query = "INSERT INTO medical_report SET Patient_ID='$pid', Report_No='$r_num', R_date='$date'"; 1396 | 1397 | $add=mysql_query($query); 1398 | $query1 = "INSERT INTO give_details SET Department_No='$dept_no', Report_No='$r_num'"; 1399 | $add1=mysql_query($query1); 1400 | echo ""; 1401 | 1402 | } 1403 | else 1404 | echo ""; 1405 | } 1406 | } 1407 | else if(isset($_GET['pid']) && strcmp($_GET['pid'],"mod_report") == 0) 1408 | { 1409 | echo "

Add Report Details

"; 1410 | echo ""; 1411 | echo "

Date :           

Patient ID:

"; 1364 | echo "
Dept No.

"; 1375 | echo "
"; 1412 | echo ""; 1413 | echo ""; 1415 | echo ""; 1424 | echo ""; 1425 | echo ""; 1427 | echo ""; 1428 | echo ""; 1430 | echo ""; 1431 | echo ""; 1433 | echo ""; 1434 | if(isset($_POST['R_num'])) 1435 | { 1436 | $rnum=$_POST['R_num']; 1437 | $dept=$_POST['dept']; 1438 | $roomnum=$_POST['Room_num']; 1439 | $diet=$_POST['Diet']; 1440 | //echo $rnum; 1441 | $check=mysql_query("SELECT * FROM give_details where Report_No='$rnum'"); 1442 | if(mysql_num_rows($check)!=0) 1443 | { 1444 | mysql_query("UPDATE give_details SET Department_No='$dept' where Report_No='$rnum'"); 1445 | if(isset($roomnum)||isset($diet)) 1446 | { 1447 | if(!strcmp($roomnum,"")&&!strcmp($diet,"")) 1448 | $query = "UPDATE medical_report SET Room_No='$roomnum',Diet='$diet' where Report_No='$rnum'"; 1449 | else if(!strcmp($diet,"")) 1450 | $query = "UPDATE medical_report SET Room_No='$roomnum' where Report_No='$rnum'"; 1451 | else if(!strcmp($roomnum,"")) 1452 | { 1453 | $query = "UPDATE medical_report SET Diet='$diet' where Report_No='$rnum'"; 1454 | //echo $query; 1455 | } 1456 | $add=mysql_query($query); 1457 | //echo mysql_affected_rows(); 1458 | echo ""; 1459 | } 1460 | } 1461 | else 1462 | echo ""; 1463 | } 1464 | } 1465 | else if(isset($_GET['pid']) && strcmp($_GET['pid'],"add_date") == 0) 1466 | { 1467 | echo "

Add Closing Date

"; 1468 | echo ""; 1469 | echo "

Report No.:

"; 1414 | echo "

Dept number:

Room No.:

"; 1426 | echo "

Diet:         

"; 1429 | echo "

"; 1432 | echo "
"; 1470 | echo ""; 1471 | echo ""; 1472 | echo ""; 1473 | echo ""; 1474 | echo ""; 1475 | echo ""; 1476 | echo ""; 1477 | echo ""; 1479 | echo ""; 1480 | if(isset($_POST['date'])&&isset($_POST['num'])) 1481 | { 1482 | $date=$_POST['date']; 1483 | $rnum=$_POST['num']; 1484 | $result=mysql_query("SELECT * FROM medical_report where Report_No='$rnum'"); 1485 | $row=mysql_fetch_array($result); 1486 | $rdate=$row['R_date']; 1487 | if(strcmp($rdate,$date)>0) 1488 | echo ""; 1489 | else 1490 | { 1491 | $query = "UPDATE medical_report SET C_date='$date' where Report_No='$rnum'"; 1492 | $add=mysql_query($query); 1493 | if(mysql_affected_rows()==0) 1494 | echo ""; 1495 | else 1496 | echo ""; 1497 | } 1498 | } 1499 | } 1500 | else if(isset($_GET['option'])&&isset($_GET['pid'])&&((strcmp($_GET['pid'],"view_report")==0))&&((strcmp($_GET['option'],"search_tools")==0))) 1501 | { 1502 | echo "

Report No. :       

Closing Date :     

"; 1478 | echo "
"; 1503 | echo ""; 1504 | echo ""; 1505 | echo "
"; 1506 | echo "
"; 1507 | echo "
Filters: "; 1508 | echo ""; 1509 | echo "
"; 1510 | 1511 | } 1512 | else if(isset($_GET['pid'])&&((strcmp($_GET['pid'],"view_report")==0)||(strcmp($_GET['pid'],"patient_report")==0))) 1513 | { 1514 | echo "
"; 1515 | echo ""; 1516 | echo ""; 1517 | echo "
"; 1518 | if((strcmp($_GET['pid'],"patient_report")==0)) 1519 | { 1520 | $searchby=$_GET['id']; 1521 | $result=mysql_query("select * from medical_report where Report_No='$searchby'"); 1522 | echo "
"; 1523 | $row=mysql_fetch_array($result); 1524 | $num=$row['Report_No']; 1525 | $id=$row['Patient_ID']; 1526 | $result2=mysql_query("select * from patients where Patient_ID='$id'"); 1527 | $result4=mysql_query("select * from diagnosis where Report_No='$num'"); 1528 | $dept=mysql_query("select * from departments d,give_details g where g.Report_No='$num' and g.Department_No=d.Dept_No"); 1529 | $deptrow=mysql_fetch_array($dept); 1530 | $deptname=$deptrow['Name']; 1531 | $row2=mysql_fetch_array($result2); 1532 | //$dept=$row['Dept_No']; 1533 | $name=$row2['Name']; 1534 | $dob=$row2['DOB']; 1535 | $gender=$row2['Gender']; 1536 | $bg=$row2['Blood_Group']; 1537 | $date=$row['R_date']; 1538 | $cdate=$row['C_date']; 1539 | $room=$row['Room_No']; 1540 | $result3=mysql_query("select * from room where Room_No='$room'"); 1541 | $row3=mysql_fetch_array($result3); 1542 | $result5=mysql_query("select * from Room_Given where Patient_ID='$id'"); 1543 | $row5=mysql_fetch_array($result5); 1544 | $allotdate=$row5['Allot_date']; 1545 | $disdate=$row5['Discharge_date']; 1546 | $roomtype=$row3['Type']; 1547 | $diet=$row['Diet']; 1548 | //$pay=$row['Payment']; 1549 | 1550 | $cost1=mysql_query("select b.Rent from medical_report a, room b where a.Patient_ID=b.Patient_ID and Report_No='$num'"); 1551 | $costrow1=mysql_fetch_array($cost1); 1552 | $days=mysql_query("select DATEDIFF('$disdate','$allotdate') as day;"); 1553 | $dayrow=mysql_fetch_array($days); 1554 | $days=$dayrow['day']; 1555 | if($days==0) 1556 | { 1557 | $days=1; 1558 | } 1559 | $room_cost=$costrow1['Rent']*$days; 1560 | 1561 | $cost1=mysql_query("select b.Rent from medical_report a, vehicles b where a.Patient_ID=b.ID and Report_No='$num'"); 1562 | $costrow1=mysql_fetch_array($cost1); 1563 | $days1=mysql_query("select b.Allot_date,b.Return_date from medical_report a,vehicle_given b where a.Patient_ID=b.ID and Report_No='$num'"); 1564 | $days=mysql_fetch_array($days1); 1565 | $days=mysql_query("select datediff('$days[Return_date]','$days[Allot_date]') as day;"); 1566 | $dayrow=mysql_fetch_array($days); 1567 | $days=$dayrow['day']; 1568 | if($days==0) 1569 | { 1570 | $days=1; 1571 | } 1572 | $veh_cost=$costrow1['Rent']*$days; 1573 | /*echo $room_cost; 1574 | echo "
"; 1575 | echo $veh_cost;*/ 1576 | 1577 | 1578 | 1579 | 1580 | echo "

Medical Report

"; 1581 | echo ""; 1582 | echo ""; 1583 | echo ""; 1584 | echo ""; 1585 | echo ""; 1586 | echo ""; 1587 | echo ""; 1588 | echo ""; 1589 | echo ""; 1590 | echo ""; 1591 | echo ""; 1592 | echo ""; 1593 | echo ""; 1594 | echo ""; 1595 | echo ""; 1610 | echo ""; 1611 | echo ""; 1612 | echo "
Report No: $num
Date: $date
Patient ID: $id
Patient Name: $name
Date of Birth: $dob
Gender: $gender
Blood Group: $bg
Department: $deptname
Room No.: $room
Room Type: $roomtype
Allotment Date: $allotdate
Discharge Date: $disdate
Diagnosis: "; 1596 | echo ""; 1597 | $total=$room_cost+$veh_cost; 1598 | for($i=0;$i"; 1607 | } 1608 | echo "
Test DateTest NameResultCost
$date$name$res$cost
"; 1609 | echo "
Diet: $diet
Payment: $total
Report Closing Date: $cdate
"; 1613 | $flag=1; 1614 | } 1615 | else if(isset($_GET['option'])&&strcmp($_GET['option'],"search_val")==0) 1616 | { 1617 | if(!empty($_POST['search_report'])) 1618 | $searchby=$_POST['search_report']; 1619 | else $searchby='%'; 1620 | if(!empty($_POST['id'])) 1621 | $searchbyid=$_POST['id']; 1622 | if(!empty($_POST['date'])) 1623 | $searchbydate=$_POST['date']; 1624 | if(!empty($_POST['allot_date'])) 1625 | $searchbyallot=$_POST['allot_date']; 1626 | if(!empty($_POST['dis_date'])) 1627 | $searchbydis=$_POST['dis_date']; 1628 | $flag=0; 1629 | if(!empty($searchby)&&(($searchby[0]=='R')||($searchby[0]=='r'))) 1630 | { 1631 | $result=mysql_query("select * from medical_report where Report_No='$searchby'"); 1632 | if(!empty($result) && mysql_num_rows($result)==1) 1633 | { 1634 | echo "
"; 1635 | $row=mysql_fetch_array($result); 1636 | $num=$row['Report_No']; 1637 | $id=$row['Patient_ID']; 1638 | $result2=mysql_query("select * from patients where Patient_ID='$id'"); 1639 | $result4=mysql_query("select * from diagnosis where Report_No='$num'"); 1640 | $dept=mysql_query("select * from departments d,give_details g where g.Report_No='$num' and g.Department_No=d.Dept_No"); 1641 | $deptrow=mysql_fetch_array($dept); 1642 | $deptname=$deptrow['Name']; 1643 | $row2=mysql_fetch_array($result2); 1644 | //$dept=$row['Dept_No']; 1645 | $name=$row2['Name']; 1646 | $dob=$row2['DOB']; 1647 | $gender=$row2['Gender']; 1648 | $bg=$row2['Blood_Group']; 1649 | $date=$row['R_date']; 1650 | $cdate=$row['C_date']; 1651 | $room=$row['Room_No']; 1652 | $result3=mysql_query("select * from room where Room_No='$room'"); 1653 | $row3=mysql_fetch_array($result3); 1654 | $result5=mysql_query("select * from Room_Given where Patient_ID='$id'"); 1655 | $row5=mysql_fetch_array($result5); 1656 | $allotdate=$row5['Allot_date']; 1657 | $disdate=$row5['Discharge_date']; 1658 | $roomtype=$row3['Type']; 1659 | $diet=$row['Diet']; 1660 | //$pay=$row['Payment']; 1661 | $cost1=mysql_query("select b.Rent from medical_report a, room b where a.Patient_ID=b.Patient_ID and Report_No='$num'"); 1662 | $costrow1=mysql_fetch_array($cost1); 1663 | $days=mysql_query("select DATEDIFF('$disdate','$allotdate') as day;"); 1664 | $dayrow=mysql_fetch_array($days); 1665 | $days=$dayrow['day']; 1666 | if($days==0) 1667 | { 1668 | $days=1; 1669 | } 1670 | $room_cost=$costrow1['Rent']*$days; 1671 | 1672 | $cost1=mysql_query("select b.Rent from medical_report a, vehicles b where a.Patient_ID=b.ID and Report_No='$num'"); 1673 | $costrow1=mysql_fetch_array($cost1); 1674 | $days1=mysql_query("select b.Allot_date,b.Return_date from medical_report a,vehicle_given b where a.Patient_ID=b.ID and Report_No='$num'"); 1675 | $days=mysql_fetch_array($days1); 1676 | $days=mysql_query("select datediff('$days[Return_date]','$days[Allot_date]') as day;"); 1677 | $dayrow=mysql_fetch_array($days); 1678 | $days=$dayrow['day']; 1679 | if($days==0) 1680 | { 1681 | $days=1; 1682 | } 1683 | $veh_cost=$costrow1['Rent']*$days; 1684 | /*echo $room_cost; 1685 | echo "
"; 1686 | echo $veh_cost;*/ 1687 | 1688 | echo "

Medical Report

"; 1689 | echo ""; 1690 | echo ""; 1691 | echo ""; 1692 | echo ""; 1693 | echo ""; 1694 | echo ""; 1695 | echo ""; 1696 | echo ""; 1697 | echo ""; 1698 | echo ""; 1699 | echo ""; 1700 | echo ""; 1701 | echo ""; 1702 | echo ""; 1703 | echo ""; 1718 | echo ""; 1719 | echo ""; 1720 | echo "
Report No: $num
Date: $date
Patient ID: $id
Patient Name: $name
Date of Birth: $dob
Gender: $gender
Blood Group: $bg
Department: $deptname
Room No.: $room
Room Type: $roomtype
Allotment Date: $allotdate
Discharge Date: $disdate
Diagnosis: "; 1704 | echo ""; 1705 | $total=$room_cost+$veh_cost; 1706 | for($i=0;$i"; 1715 | } 1716 | echo "
Test DateTest NameResultCost
$date$name$res$cost
"; 1717 | echo "
Diet: $diet
Payment: $total
Report Closing Date: $cdate
"; 1721 | $flag=1; 1722 | } 1723 | else 1724 | echo ""; 1725 | 1726 | } 1727 | else 1728 | echo ""; 1729 | 1730 | 1731 | } 1732 | 1733 | } 1734 | 1735 | else if(isset($_GET['pid']) && strcmp($_GET['pid'],"del_report") == 0) 1736 | { 1737 | echo "
"; 1738 | echo ""; 1739 | echo ""; 1740 | echo "
"; 1741 | if(isset($_GET['option']) && strcmp($_GET['option'],"search_val")==0) 1742 | { 1743 | $search=$_POST['search_val']; 1744 | if(isset($search[0])&&($search[0]=='R' || $search[0]=='r')) 1745 | { 1746 | $result=mysql_query("select * from medical_report where Report_No='$search'"); 1747 | if(mysql_num_rows($result)==1) 1748 | { 1749 | $query=mysql_query("delete from medical_report where Report_No='$search'"); 1750 | echo ""; 1751 | } 1752 | else 1753 | { 1754 | echo ""; 1755 | } 1756 | } 1757 | else if(isset($search[0])) 1758 | { 1759 | $result=mysql_query("select * from patients where Name='$search'"); 1760 | if(mysql_num_rows($result)==1) 1761 | { 1762 | $row=mysql_fetch_array($result); 1763 | $id=$row['Patient_ID']; 1764 | $query=mysql_query("delete from medical_report where Patient_ID='$id'"); 1765 | if(mysql_affected_rows()==0) 1766 | echo ""; 1767 | else 1768 | echo ""; 1769 | } 1770 | else if(mysql_num_rows($result)>=1) 1771 | { 1772 | echo "
"; 1773 | echo ""; 1782 | } 1783 | } 1784 | 1785 | else 1786 | { 1787 | echo ""; 1788 | } 1789 | 1790 | } 1791 | else 1792 | echo ""; 1793 | } 1794 | if(isset($_GET['id'])) 1795 | { 1796 | $search=$_GET['id']; 1797 | $query=mysql_query("delete from medical_report where Patient_ID='$search'"); 1798 | if(mysql_affected_rows()==0) 1799 | echo ""; 1800 | else 1801 | echo ""; 1802 | } 1803 | } 1804 | else if(isset($_GET['pid']) && strcmp($_GET['pid'],"view_test") == 0) 1805 | { 1806 | echo "
"; 1807 | echo ""; 1808 | echo ""; 1809 | echo "
"; 1810 | if(isset($_GET['option']) && strcmp($_GET['option'],"search_val")==0) 1811 | { 1812 | $searchby=$_POST['search_val']; 1813 | 1814 | if((isset($searchby[0]))&&($searchby[0]=='R' || $searchby[0]=='r')) 1815 | { 1816 | $result=mysql_query("select * from diagnosis where Report_No='$searchby'"); 1817 | if(!empty($result) && mysql_num_rows($result)==1) 1818 | { 1819 | 1820 | echo "
"; 1821 | $row=mysql_fetch_array($result); 1822 | $date=$row['Test_date']; 1823 | $test=$row['Tests']; 1824 | $tresult=$row['T_result']; 1825 | $cost=$row['Cost']; 1826 | $result1=mysql_query("select * from medical_report where Report_No='$searchby'"); 1827 | $row1=mysql_fetch_array($result1); 1828 | $id=$row1['Patient_ID']; 1829 | $result2=mysql_query("select * from Patients where Patient_ID='$id'"); 1830 | $row2=mysql_fetch_array($result2); 1831 | $name=$row2['Name']; 1832 | echo "
"; 1833 | echo "

Diagnosis Details

"; 1834 | echo ""; 1835 | echo ""; 1836 | echo ""; 1837 | echo ""; 1838 | echo ""; 1839 | echo ""; 1840 | echo ""; 1841 | echo "
Test Date: $date
Patient ID : $id
Patient Name : $name
Test : $test
Test Result: $tresult
Cost: $cost
"; 1842 | } 1843 | else if(!empty($result) && mysql_num_rows($result) > 1) 1844 | { 1845 | echo "
"; 1846 | echo "
"; 1847 | for($i=0;$i"; 1854 | echo "

$name

"; 1855 | echo "

Test Date: $date
Report No.: $rnum

"; 1856 | echo "
"; 1857 | } 1858 | echo "
"; 1859 | } 1860 | 1861 | else 1862 | { 1863 | echo ""; 1864 | } 1865 | } 1866 | 1867 | else 1868 | echo ""; 1869 | } 1870 | } 1871 | else if(isset($_GET['pid']) && strcmp($_GET['pid'],"tests_details") == 0) 1872 | { 1873 | $name=$_GET['test']; 1874 | $date=$_GET['date']; 1875 | $rnum=$_GET['rnum']; 1876 | $result=mysql_query("select * from diagnosis where Report_No='$rnum' and Test_date='$date' and Tests='$name'"); 1877 | $row=mysql_fetch_array($result); 1878 | $tresult=$row['T_result']; 1879 | $cost=$row['Cost']; 1880 | $result1=mysql_query("select * from medical_report where Report_No='$rnum'"); 1881 | $row1=mysql_fetch_array($result1); 1882 | $id=$row1['Patient_ID']; 1883 | $result2=mysql_query("select * from Patients where Patient_ID='$id'"); 1884 | $row2=mysql_fetch_array($result2); 1885 | $pname=$row2['Name']; 1886 | echo "
"; 1887 | echo "

Diagnosis Details

"; 1888 | echo ""; 1889 | echo ""; 1890 | echo ""; 1891 | echo ""; 1892 | echo ""; 1893 | echo ""; 1894 | echo ""; 1895 | echo "
Test Date: $date
Patient ID : $id
Patient Name : $pname
Test : $name
Test Result: $tresult
Cost: $cost
"; 1896 | } 1897 | else if(isset($_GET['pid']) && strcmp($_GET['pid'],"add_test") == 0) 1898 | { 1899 | 1900 | echo "

Add Test Details

"; 1901 | echo "
"; 1902 | echo ""; 1903 | echo ""; 1904 | echo ""; 1905 | echo ""; 1906 | echo ""; 1907 | echo ""; 1908 | echo ""; 1909 | echo ""; 1910 | echo ""; 1911 | echo ""; 1912 | echo ""; 1913 | echo ""; 1915 | echo ""; 1916 | echo ""; 1918 | echo ""; 1919 | echo ""; 1921 | echo ""; 1922 | if(isset($_POST['date'])&&isset($_POST['test'])&&isset($_POST['R_num'])&&isset($_POST['cost'])) 1923 | { 1924 | $date=$_POST['date']; 1925 | $name=$_POST['test']; 1926 | $result=$_POST['result']; 1927 | $r_num=$_POST['R_num']; 1928 | $cost=$_POST['cost']; 1929 | $check = mysql_query("SELECT * FROM medical_report where Report_No='$r_num'"); 1930 | $row=mysql_fetch_array($check); 1931 | $rdate=$row['R_date']; 1932 | if(strcmp($rdate,$date)>0) 1933 | { 1934 | echo ""; 1935 | } 1936 | else 1937 | { 1938 | if($row>0) 1939 | { 1940 | $query = "INSERT INTO diagnosis SET Test_date='$date', Tests='$name', T_result='$result', Report_No='$r_num', Cost='$cost'"; 1941 | $add=mysql_query($query); 1942 | echo ""; 1943 | 1944 | } 1945 | else 1946 | echo ""; 1947 | } 1948 | } 1949 | } 1950 | else if(isset($_GET['pid']) && strcmp($_GET['pid'],"add_result") == 0) 1951 | { 1952 | 1953 | echo "

Add Test Result

"; 1954 | echo ""; 1955 | echo "

Date :           

Test Name :

Result :      

Report No.:

"; 1914 | echo "

Cost:            

"; 1917 | echo "

"; 1920 | echo "
"; 1956 | echo ""; 1957 | echo ""; 1958 | echo ""; 1959 | echo ""; 1960 | echo ""; 1961 | echo ""; 1962 | echo ""; 1963 | echo ""; 1964 | echo ""; 1965 | echo ""; 1966 | echo ""; 1968 | echo ""; 1969 | echo ""; 1971 | echo ""; 1972 | if(isset($_POST['date'])&&isset($_POST['test'])&&isset($_POST['R_num'])&&isset($_POST['result'])) 1973 | { 1974 | $date=$_POST['date']; 1975 | $name=$_POST['test']; 1976 | $result=$_POST['result']; 1977 | $r_num=$_POST['R_num']; 1978 | $query = "UPDATE diagnosis SET T_result='$result' where Test_date='$date' and Tests='$name' and Report_No='$r_num'"; 1979 | $add=mysql_query($query); 1980 | if(mysql_affected_rows()==0) 1981 | echo ""; 1982 | else 1983 | echo ""; 1984 | } 1985 | } 1986 | else if(isset($_GET['pid']) && strcmp($_GET['pid'],"del_test") == 0) 1987 | { 1988 | echo "

Date :           

Test Name :

Result :      

Report No.:

"; 1967 | echo "

"; 1970 | echo "
"; 1989 | echo ""; 1990 | echo ""; 1991 | echo "
"; 1992 | if(isset($_GET['option']) && strcmp($_GET['option'],"search_val")==0) 1993 | { 1994 | $search=$_POST['search_val']; 1995 | $result=mysql_query("select * from diagnosis where Report_No='$search'"); 1996 | if(mysql_num_rows($result)==1) 1997 | { 1998 | $query=mysql_query("delete from medical_report where Report_No='$search'"); 1999 | if(mysql_affected_rows()==0) 2000 | echo ""; 2001 | else 2002 | echo ""; 2003 | } 2004 | else if(mysql_num_rows($result)>1) 2005 | { 2006 | echo "
"; 2007 | echo "
"; 2008 | echo "

Click the test to delete !!!

"; 2009 | for($i=0;$i"; 2017 | echo "

$name

"; 2018 | echo "

Test Date: $date

"; 2019 | echo "
"; 2020 | } 2021 | } 2022 | 2023 | else 2024 | { 2025 | echo ""; 2026 | } 2027 | 2028 | } 2029 | if(isset($_GET['id'])&&isset($_GET['date'])&&isset($_GET['rnum'])) 2030 | { 2031 | $search=$_GET['id']; 2032 | $search1=$_GET['date']; 2033 | $search2=$_GET['rnum']; 2034 | $query=mysql_query("delete from diagnosis where Tests='$search' and Test_date='$search1' and Report_No='$search2'"); 2035 | if(mysql_affected_rows()==0) 2036 | echo ""; 2037 | else 2038 | echo ""; 2039 | } 2040 | } 2041 | else if(isset($_GET['pid'])&&((strcmp($_GET['pid'],"add_accompanies")==0))) 2042 | { 2043 | if(isset($_GET['option'])&&(strcmp($_GET['option'],"insert")==0)) 2044 | { 2045 | $name=$_POST['name']; 2046 | $address=$_POST['address']; 2047 | $dob=$_POST['dob']; 2048 | if(isset($_POST['contact'])) 2049 | $contact=$_POST['contact']; 2050 | else $contact="NULL"; 2051 | $gender=$_POST['gender']; 2052 | $rel=$_POST['rel']; 2053 | $id=$_POST['id']; 2054 | mysql_query("insert into accompanies values (\"$id\", \"$name\", \"$address\", \"$dob\", \"$contact\", \"$gender\", \"$rel\")"); 2055 | header('Location: ?pid=view_accompanies'); 2056 | } 2057 | else 2058 | { 2059 | echo "

Registeration

"; 2060 | echo ""; 2061 | echo ""; 2062 | echo ""; 2063 | echo ""; 2064 | echo ""; 2065 | echo ""; 2066 | echo ""; 2067 | echo ""; 2068 | echo ""; 2069 | echo "

Patient ID:

Name:

Address:

Date of Brith:

Contact:

Gender:

Relationship:

"; 2070 | echo "
"; 2071 | } 2072 | } 2073 | //KNS starts 2074 | if(isset($_GET['pid'])) 2075 | { 2076 | if(isset($_GET['pid']) && strcmp($_GET['pid'],"search_vehicle") == 0) 2077 | { 2078 | echo "
"; 2079 | echo ""; 2080 | echo ""; 2081 | echo "
"; 2082 | 2083 | if(isset($_GET['option']) && strcmp($_GET['option'],"search_val")==0) 2084 | { 2085 | $search=$_POST['search_val']; 2086 | 2087 | if(!empty($search) && ($search[0]=='V' || $search[0]=='v')) 2088 | { 2089 | 2090 | $result=mysql_query("select * from vehicles where Reg_No='$search'"); 2091 | 2092 | if(mysql_num_rows($result)==1) 2093 | { 2094 | echo "
"; 2095 | $val=mysql_fetch_array($result); 2096 | $reg=$val['Reg_No']; 2097 | $type=$val['Type']; 2098 | $dop=$val['DOP']; 2099 | $model=$val['MODEL']; 2100 | $cost=$val['Rent']; 2101 | 2102 | echo "

Vehicle Details

"; 2103 | echo ""; 2104 | echo ""; 2105 | echo ""; 2106 | echo "

"; 2107 | echo ""; 2108 | echo ""; 2109 | echo "
Reg No: $reg
Type: $type
Date of Purchase: $dop
Model: $model
Rent: $cost
"; 2110 | } 2111 | 2112 | else 2113 | { 2114 | echo "

"; 2115 | echo ""; 2116 | } 2117 | 2118 | } 2119 | 2120 | else if(!empty($search) && ($search[0]!='V' || $search[0]!='v')) 2121 | { 2122 | $result=mysql_query("select * from vehicles where Type='$search'"); 2123 | 2124 | if(mysql_num_rows($result)==1) 2125 | { 2126 | echo "
"; 2127 | $val=mysql_fetch_array($result); 2128 | $reg=$val['Reg_No']; 2129 | $type=$val['Type']; 2130 | $dop=$val['DOP']; 2131 | $model=$val['MODEL']; 2132 | $cost=$val['Rent']; 2133 | 2134 | echo "

Vehicle Details

"; 2135 | echo "

0"; 2136 | echo ""; 2137 | echo ""; 2138 | echo ""; 2139 | echo "

"; 2140 | echo ""; 2141 | echo ""; 2142 | echo "
Reg No: $reg
Type: $type
Date of Purchase: $dop
Model: $model
Rent: $cost
"; 2143 | } 2144 | 2145 | else if(mysql_num_rows($result)>1) 2146 | { 2147 | echo "
"; 2148 | echo "
"; 2149 | 2150 | for($i=0;$i"; 2156 | echo "

$reg

"; 2157 | echo "

Type: $type
"; 2158 | echo "

"; 2159 | } 2160 | } 2161 | 2162 | else 2163 | { 2164 | echo "

"; 2165 | echo ""; 2166 | } 2167 | } 2168 | 2169 | } 2170 | } 2171 | if(isset($_GET['pid']) && strcmp($_GET['pid'],"vehicle_details") == 0) 2172 | { 2173 | echo "
"; 2174 | echo ""; 2175 | echo ""; 2176 | echo "
"; 2177 | 2178 | $search=$_GET['id']; 2179 | $result=mysql_query("select * from vehicles where Reg_No='$search'"); 2180 | 2181 | echo "
"; 2182 | $val=mysql_fetch_array($result); 2183 | $reg=$val['Reg_No']; 2184 | $type=$val['Type']; 2185 | $dop=$val['DOP']; 2186 | $model=$val['MODEL']; 2187 | $cost=$val['Rent']; 2188 | 2189 | echo "

Vehicle Details

"; 2190 | echo ""; 2191 | echo ""; 2192 | echo ""; 2193 | echo "

"; 2194 | echo ""; 2195 | echo ""; 2196 | echo "
Reg No: $reg
Type: $type
Date of Purchase: $dop
Model: $model
Rent: $cost
"; 2197 | } 2198 | 2199 | if(isset($_GET['pid']) && strcmp($_GET['pid'],"add_vehicle") == 0) 2200 | { 2201 | echo "

"; 2202 | echo "

Add Vehicle

"; 2203 | echo "


"; 2204 | echo ""; 2205 | echo " "; 2206 | //echo "

"; 2207 | echo "

"; 2208 | //echo "

"; 2209 | echo "


"; 2210 | echo " "; 2211 | echo "
Registration Id:
Type:
Date of purchase:
Model:
"; 2212 | 2213 | /*$con = mysql_connect("localhost","root","","HMS"); 2214 | if(!$con) 2215 | { 2216 | echo " Connection Failed"; 2217 | } 2218 | // mysql_select_db("HMS", $con); 2219 | 2220 | /*if(isset($_POST['reg'])) 2221 | { 2222 | $temp=$_POST['reg']; 2223 | echo $temp; 2224 | }*/ 2225 | 2226 | if(isset($_POST['drop'])) 2227 | { 2228 | $type=$_POST['drop']; 2229 | 2230 | if($type=="Ambulance") 2231 | { 2232 | $cost=200.00; 2233 | 2234 | if(isset($_POST['Model']) ) 2235 | { 2236 | 2237 | $sel=mysql_query("select curdate() date"); 2238 | $DOP=mysql_fetch_array($sel); 2239 | $DOP=$DOP['date']; 2240 | 2241 | $model=$_POST['Model']; 2242 | 2243 | $result=mysql_query("select max(Reg_No) R from vehicles"); 2244 | $val=mysql_fetch_array($result); 2245 | //echo $val; 2246 | $test=$val['R']; 2247 | $reg="V".(substr($test,1)+1); 2248 | 2249 | /*$test=strval($val); 2250 | $reg="V".$test; 2251 | */ 2252 | /*echo $reg; 2253 | echo $type; 2254 | echo $DOP; 2255 | echo $model;*/ 2256 | 2257 | $query="INSERT INTO vehicles SET Type=\"Ambulance\",Reg_No='$reg',DOP='$DOP',Model='$model',ID=NULL,Rent=200"; 2258 | $result=mysql_query($query); 2259 | 2260 | echo ""; 2261 | 2262 | //$query = "INSERT INTO Medicinecategory(BatchNo,Name,Category) VALUES ('$_POST[Batchno]','$_POST[Name]','$_POST[Category]')"; 2263 | /*if(isset ($query)) 2264 | $sql=mysql_query($query,$con);*/ 2265 | } 2266 | } 2267 | 2268 | if($type=="Taxi") 2269 | { 2270 | if(isset($_POST['Model']) ) 2271 | { 2272 | 2273 | //$DOP=$_POST['DOP']; 2274 | $model=$_POST['Model']; 2275 | 2276 | $sel=mysql_query("select curdate() date"); 2277 | $DOP=mysql_fetch_array($sel); 2278 | $DOP=$DOP['date']; 2279 | /*$result=mysql_query("select * from vehicles"); 2280 | $val=mysql_num_rows($result);*/ 2281 | //echo $val; 2282 | 2283 | $result=mysql_query("select max(Reg_No) R from vehicles"); 2284 | $val=mysql_fetch_array($result); 2285 | //echo $val; 2286 | $test=$val['R']; 2287 | $reg="V".(substr($test,1)+1); 2288 | 2289 | /*$val=$val+1; 2290 | $test=strval($val); 2291 | $reg="V".$test; 2292 | */ 2293 | /*echo $reg; 2294 | echo $type; 2295 | echo $DOP; 2296 | echo $model;*/ 2297 | 2298 | $query="INSERT INTO vehicles SET Type=\"Taxi\",Reg_No='$reg',DOP='$DOP',Model='$model',ID=NULL,Rent=500"; 2299 | $result=mysql_query($query); 2300 | 2301 | echo ""; 2302 | 2303 | //$query = "INSERT INTO Medicinecategory(BatchNo,Name,Category) VALUES ('$_POST[Batchno]','$_POST[Name]','$_POST[Category]')"; 2304 | /*if(isset ($query)) 2305 | $sql=mysql_query($query,$con);*/ 2306 | } 2307 | } 2308 | } 2309 | } 2310 | 2311 | if(isset($_GET['pid']) && strcmp($_GET['pid'],"discard_vehicle") == 0) 2312 | { 2313 | echo "
"; 2314 | echo ""; 2315 | echo ""; 2316 | echo "
"; 2317 | 2318 | if(isset($_GET['option']) && strcmp($_GET['option'],"search_val")==0) 2319 | { 2320 | $search=$_POST['search_val']; 2321 | 2322 | if(!empty($search) &&($search[0]=='V' || $search[0]=='v')) 2323 | { 2324 | 2325 | $result=mysql_query("select * from vehicles where Reg_No='$search'"); 2326 | 2327 | if(mysql_num_rows($result)==1) 2328 | { 2329 | $query=mysql_query("delete from vehicles where Reg_No='$search'"); 2330 | echo "


"; 2331 | echo ""; 2332 | 2333 | } 2334 | 2335 | else 2336 | { 2337 | echo "

"; 2338 | echo ""; 2339 | } 2340 | } 2341 | 2342 | else if(!empty($search) &&($search[0]!='V' || $search[0]!='v')) 2343 | { 2344 | $result=mysql_query("select * from vehicles where Type='$search'"); 2345 | 2346 | if(mysql_num_rows($result)==1) 2347 | { 2348 | $query=mysql_query("delete from vehicles where Type='$search'"); 2349 | echo "


"; 2350 | echo ""; 2351 | } 2352 | 2353 | else if(mysql_num_rows($result)>=1) 2354 | { 2355 | echo "
"; 2356 | echo "
"; 2357 | 2358 | for($i=0;$i"; 2364 | echo "

$reg

"; 2365 | echo "

Type: $type
"; 2366 | echo "

"; 2367 | } 2368 | } 2369 | 2370 | else 2371 | { 2372 | echo "

"; 2373 | echo ""; 2374 | } 2375 | 2376 | } 2377 | 2378 | else 2379 | echo ""; 2380 | } 2381 | } 2382 | 2383 | if(isset($_GET['pid']) && strcmp($_GET['pid'],"discard_vehicle") == 0) 2384 | { 2385 | if(isset($_GET['id'])) 2386 | { 2387 | $search=$_GET['id']; 2388 | $result=mysql_query("select * from vehicles where Reg_No='$search'"); 2389 | //echo $search; 2390 | $query=mysql_query("delete from vehicles where Reg_No='$search'"); 2391 | echo "


"; 2392 | echo ""; 2393 | } 2394 | } 2395 | 2396 | else if(isset($_GET['pid']) && strcmp($_GET['pid'],"search_room") == 0) 2397 | { 2398 | echo "
"; 2399 | echo ""; 2400 | echo ""; 2401 | echo "
"; 2402 | 2403 | if(isset($_GET['option']) && strcmp($_GET['option'],"search_val")==0) 2404 | { 2405 | $search=$_POST['search_val']; 2406 | 2407 | if(!empty($search) && ($search[0]=='Z' || $search[0]=='z')) 2408 | { 2409 | 2410 | $result=mysql_query("select * from room where Room_No='$search'"); 2411 | 2412 | if(mysql_num_rows($result)==1) 2413 | { 2414 | echo "
"; 2415 | $val=mysql_fetch_array($result); 2416 | $reg=$val['Room_No']; 2417 | $type=$val['Type']; 2418 | $ext=$val['Extension']; 2419 | $cost=$val['Rent']; 2420 | 2421 | echo "

Room Details

"; 2422 | echo ""; 2423 | echo ""; 2424 | echo ""; 2425 | echo "

"; 2426 | echo ""; 2427 | echo "
Room No: $reg
Type: $type
Extension: $ext
Rent: $cost
"; 2428 | } 2429 | 2430 | else 2431 | { 2432 | echo "

"; 2433 | echo ""; 2434 | } 2435 | } 2436 | 2437 | else if(!empty($search) && ($search[0]!='Z' || $search[0]!='z')) 2438 | { 2439 | $result=mysql_query("select * from Room where Type='$search'"); 2440 | 2441 | if(mysql_num_rows($result)==1) 2442 | { 2443 | echo "
"; 2444 | $val=mysql_fetch_array($result); 2445 | $reg=$val['Room_No']; 2446 | $type=$val['Type']; 2447 | $ext=$val['Extension']; 2448 | $cost=$val['Rent']; 2449 | 2450 | echo "

Room Details

"; 2451 | echo ""; 2452 | echo ""; 2453 | echo ""; 2454 | echo "

"; 2455 | echo ""; 2456 | echo "
Room No: $reg
Type: $type
Extension: $ext
Rent: $cost
"; 2457 | 2458 | } 2459 | 2460 | else if(mysql_num_rows($result)>=1) 2461 | { 2462 | echo "
"; 2463 | echo "
"; 2464 | 2465 | for($i=0;$i"; 2471 | echo "

$reg

"; 2472 | echo "

Type: $type
"; 2473 | echo "

"; 2474 | } 2475 | } 2476 | 2477 | else 2478 | { 2479 | echo "

"; 2480 | echo ""; 2481 | } 2482 | } 2483 | 2484 | else 2485 | echo ""; 2486 | } 2487 | } 2488 | 2489 | if(isset($_GET['pid']) && strcmp($_GET['pid'],"add_room") == 0) 2490 | { 2491 | echo "

"; 2492 | echo "

Add Room

"; 2493 | echo "








"; 2494 | echo ""; 2495 | echo " "; 2496 | //echo ""; 2497 | echo "

"; 2498 | echo ""; 2499 | echo ""; 2500 | echo "
Room Id:

Type:
Extension:

"; 2501 | 2502 | /*$con = mysql_connect("localhost","root","","HMS"); 2503 | if(!$con) 2504 | { 2505 | echo " Connection Failed"; 2506 | } 2507 | // mysql_select_db("HMS", $con); 2508 | 2509 | /*if(isset($_POST['reg'])) 2510 | { 2511 | $temp=$_POST['reg']; 2512 | echo $temp; 2513 | }*/ 2514 | 2515 | $flag=1; 2516 | 2517 | if(isset($_POST['drop']) && isset($_POST['ext']) ) // 2518 | { 2519 | $ext=$_POST['ext']; 2520 | $check=mysql_query("select * from room where Extension='$ext'"); 2521 | if(mysql_num_rows($check)>=1) 2522 | { 2523 | //echo "check"; 2524 | $flag=0; 2525 | } 2526 | $type=$_POST['drop']; 2527 | 2528 | if($type=="Gen") 2529 | { 2530 | $cost=2500.00; 2531 | 2532 | if(isset($_POST['ext']) && $flag==1) 2533 | { 2534 | 2535 | $ext=$_POST['ext']; 2536 | 2537 | /*echo $reg; 2538 | echo $type; 2539 | echo $DOP; 2540 | echo $model;*/ 2541 | 2542 | $result=mysql_query("select * from room"); 2543 | $val=mysql_num_rows($result); 2544 | 2545 | $result=mysql_query("select max(Room_No) R from room"); 2546 | $val=mysql_fetch_array($result); 2547 | //echo $val; 2548 | $test=$val['R']; 2549 | $room="Z".(substr($test,1)+1); 2550 | 2551 | $query="INSERT INTO room SET Room_No='$room',Type=\"Gen\",Extension='$ext',Rent=2500,Patient_ID=null"; 2552 | $result=mysql_query($query); 2553 | 2554 | echo ""; 2555 | 2556 | //$query = "INSERT INTO Medicinecategory(BatchNo,Name,Category) VALUES ('$_POST[Batchno]','$_POST[Name]','$_POST[Category]')"; 2557 | /*if(isset ($query)) 2558 | $sql=mysql_query($query,$con);*/ 2559 | 2560 | //echo $val; 2561 | 2562 | 2563 | /*echo $reg; 2564 | echo $type; 2565 | echo $DOP; 2566 | echo $model;*/ 2567 | 2568 | //$query = "INSERT INTO Medicinecategory(BatchNo,Name,Category) VALUES ('$_POST[Batchno]','$_POST[Name]','$_POST[Category]')"; 2569 | /*if(isset ($query)) 2570 | $sql=mysql_query($query,$con);*/ 2571 | 2572 | } 2573 | } 2574 | 2575 | if($type=="pri" && $flag==1) 2576 | { 2577 | $cost=5000.00; 2578 | 2579 | if(isset($_POST['ext'])) 2580 | { 2581 | 2582 | $ext=$_POST['ext']; 2583 | 2584 | /*echo $reg; 2585 | echo $type; 2586 | echo $DOP; 2587 | echo $model;*/ 2588 | 2589 | $result=mysql_query("select * from room"); 2590 | $val=mysql_num_rows($result); 2591 | 2592 | $result=mysql_query("select max(Room_No) R from room"); 2593 | $val=mysql_fetch_array($result); 2594 | //echo $val; 2595 | $test=$val['R']; 2596 | $room="Z".(substr($test,1)+1); 2597 | 2598 | $query="INSERT INTO room SET Room_No='$room',Type=\"PRI\",Extension='$ext',Rent=2500,Patient_ID=null"; 2599 | $result=mysql_query($query); 2600 | 2601 | echo ""; 2602 | 2603 | //$query = "INSERT INTO Medicinecategory(BatchNo,Name,Category) VALUES ('$_POST[Batchno]','$_POST[Name]','$_POST[Category]')"; 2604 | /*if(isset ($query)) 2605 | $sql=mysql_query($query,$con);*/ 2606 | 2607 | //echo $val; 2608 | 2609 | 2610 | /*echo $reg; 2611 | echo $type; 2612 | echo $DOP; 2613 | echo $model;*/ 2614 | 2615 | //$query = "INSERT INTO Medicinecategory(BatchNo,Name,Category) VALUES ('$_POST[Batchno]','$_POST[Name]','$_POST[Category]')"; 2616 | /*if(isset ($query)) 2617 | $sql=mysql_query($query,$con);*/ 2618 | } 2619 | } 2620 | 2621 | if($type=="icu" && $flag==1) 2622 | { 2623 | $cost=2500.00; 2624 | 2625 | if(isset($_POST['ext'])) 2626 | { 2627 | 2628 | $ext=$_POST['ext']; 2629 | 2630 | /*echo $reg; 2631 | echo $type; 2632 | echo $DOP; 2633 | echo $model;*/ 2634 | 2635 | $result=mysql_query("select * from room"); 2636 | $val=mysql_num_rows($result); 2637 | 2638 | $result=mysql_query("select max(Room_No) R from room"); 2639 | $val=mysql_fetch_array($result); 2640 | //echo $val; 2641 | $test=$val['R']; 2642 | $room="Z".(substr($test,1)+1); 2643 | 2644 | $query="INSERT INTO room SET Room_No='$room',Type=\"ICU\",Extension='$ext',Rent=2500,Patient_ID=null"; 2645 | $result=mysql_query($query); 2646 | 2647 | echo ""; 2648 | 2649 | //$query = "INSERT INTO Medicinecategory(BatchNo,Name,Category) VALUES ('$_POST[Batchno]','$_POST[Name]','$_POST[Category]')"; 2650 | /*if(isset ($query)) 2651 | $sql=mysql_query($query,$con);*/ 2652 | 2653 | //echo $val; 2654 | 2655 | 2656 | /*echo $reg; 2657 | echo $type; 2658 | echo $DOP; 2659 | echo $model;*/ 2660 | 2661 | //$query = "INSERT INTO Medicinecategory(BatchNo,Name,Category) VALUES ('$_POST[Batchno]','$_POST[Name]','$_POST[Category]')"; 2662 | /*if(isset ($query)) 2663 | $sql=mysql_query($query,$con);*/ 2664 | } 2665 | } 2666 | 2667 | if($flag==0) 2668 | { 2669 | echo ""; 2670 | } 2671 | } 2672 | 2673 | 2674 | 2675 | } 2676 | if(isset($_GET['pid']) && strcmp($_GET['pid'],"room_details") == 0) 2677 | { 2678 | echo "
"; 2679 | echo ""; 2680 | echo ""; 2681 | echo "
"; 2682 | 2683 | $search=$_GET['id']; 2684 | $result=mysql_query("select * from room where Room_No='$search'"); 2685 | 2686 | echo "
"; 2687 | $val=mysql_fetch_array($result); 2688 | $reg=$val['Room_No']; 2689 | $type=$val['Type']; 2690 | $ext=$val['Extension']; 2691 | 2692 | echo "

Room Details

"; 2693 | echo ""; 2694 | echo ""; 2695 | echo ""; 2696 | echo "

"; 2697 | echo "
Room No: $reg
Type: $type
Extension: $ext
"; 2698 | } 2699 | if(isset($_GET['pid']) && strcmp($_GET['pid'],"discard_room") == 0) 2700 | { 2701 | echo "
"; 2702 | echo ""; 2703 | echo ""; 2704 | echo "
"; 2705 | 2706 | if(isset($_GET['option']) && strcmp($_GET['option'],"search_val")==0) 2707 | { 2708 | $search=$_POST['search_val']; 2709 | 2710 | if(!empty($search) && ($search[0]=='Z' || $search[0]=='z')) 2711 | { 2712 | 2713 | $result=mysql_query("select * from room where Room_No='$search'"); 2714 | 2715 | if(mysql_num_rows($result)==1) 2716 | { 2717 | $query=mysql_query("delete from room where Room_No='$search'"); 2718 | echo "hello"; 2719 | echo "


"; 2720 | echo ""; 2721 | } 2722 | 2723 | else 2724 | { 2725 | echo "

"; 2726 | echo ""; 2727 | } 2728 | } 2729 | 2730 | else if(!empty($search) && ($search[0]!='Z' || $search[0]!='z')) 2731 | { 2732 | $result=mysql_query("select * from room where Type='$search'"); 2733 | 2734 | if(mysql_num_rows($result)==1) 2735 | { 2736 | $query=mysql_query("delete from room where Type='$search'"); 2737 | echo "


"; 2738 | echo ""; 2739 | } 2740 | 2741 | else if(mysql_num_rows($result)>=1) 2742 | { 2743 | echo "
"; 2744 | echo "
"; 2745 | 2746 | for($i=0;$i"; 2752 | echo "

$reg

"; 2753 | echo "

Type: $type
"; 2754 | echo "

"; 2755 | } 2756 | } 2757 | 2758 | else 2759 | { 2760 | echo "

"; 2761 | echo ""; 2762 | } 2763 | } 2764 | 2765 | else 2766 | echo ""; 2767 | } 2768 | } 2769 | if(isset($_GET['pid']) && strcmp($_GET['pid'],"discard_room") == 0) 2770 | { 2771 | if(isset($_GET['id'])) 2772 | { 2773 | $search=$_GET['id']; 2774 | $result=mysql_query("select * from room where Room_No='$search'"); 2775 | //echo $search; 2776 | $query=mysql_query("delete from room where Room_No='$search'"); 2777 | echo "


"; 2778 | echo ""; 2779 | } 2780 | } 2781 | 2782 | if(isset($_GET['pid']) && strcmp($_GET['pid'],"alloted_vehicle") == 0) 2783 | { 2784 | echo "
"; 2785 | echo ""; 2786 | echo ""; 2787 | echo "
"; 2788 | 2789 | if(isset($_GET['option']) && strcmp($_GET['option'],"search_val")==0) 2790 | { 2791 | $search=$_POST['search_val']; 2792 | 2793 | if((!empty($search)) && ($search[0]=='V' || $search[0]=='v')) 2794 | { 2795 | $find=mysql_query("select * from vehicles where Reg_No='$search'"); 2796 | 2797 | if(mysql_num_rows($find)==0) 2798 | echo ""; 2799 | 2800 | else 2801 | { 2802 | $result=mysql_query("select * from vehicle_given where Reg_No='$search'"); 2803 | 2804 | if(mysql_num_rows($result)==0) 2805 | { 2806 | echo ""; 2807 | } 2808 | 2809 | else 2810 | { 2811 | if((!empty($result) && mysql_num_rows($result)==1)) 2812 | { 2813 | echo "
"; 2814 | $val=mysql_fetch_array($result); 2815 | $reg=$val['Reg_No']; 2816 | $id=$val['ID']; 2817 | $ad=$val['Allot_date']; 2818 | $rd=$val['Return_date']; 2819 | $rent=mysql_query("select Rent from vehicles where Reg_No='$search'"); 2820 | $cost=mysql_fetch_array($rent); 2821 | $price=$cost['Rent']; 2822 | 2823 | echo "

Vehicle Allotment History

"; 2824 | echo ""; 2825 | echo ""; 2826 | echo ""; 2827 | echo "

"; 2828 | echo ""; 2829 | echo ""; 2830 | echo "
Reg No: $reg
Used by: $id
Allotment Room: $ad
Return Date: $rd
Rent: $price
"; 2831 | } 2832 | 2833 | else if(!empty($result) && (mysql_num_rows($result)>1)) 2834 | { 2835 | echo "
"; 2836 | echo "
"; 2837 | 2838 | echo "

Select any vehicle

"; 2839 | 2840 | for($i=0;$i"; 2849 | echo "

$reg

"; 2850 | //echo "

Type: $type
"; 2851 | echo "

"; 2852 | } 2853 | } 2854 | } 2855 | } 2856 | } 2857 | 2858 | 2859 | else if((!empty($search)) && ($search[0]!='V' || $search[0]!='v')) 2860 | { 2861 | $find=mysql_query("select * from vehicles where Type='$search'"); 2862 | 2863 | if(mysql_num_rows($find)==0) 2864 | echo ""; 2865 | 2866 | else 2867 | { 2868 | $result=mysql_query("select b.Reg_No,b.ID,b.Allot_date,b.Return_date from vehicles a,vehicle_given b where a.Type='$search' and a.Reg_No=b.Reg_No"); 2869 | 2870 | if(mysql_num_rows($result)==0) 2871 | { 2872 | echo ""; 2873 | } 2874 | 2875 | else 2876 | { 2877 | if((!empty($result) && mysql_num_rows($result)==1)) 2878 | { 2879 | echo "
"; 2880 | $val=mysql_fetch_array($result); 2881 | $reg=$val['Reg_No']; 2882 | $id=$val['ID']; 2883 | $ad=$val['Allot_date']; 2884 | $rd=$val['Return_date']; 2885 | $rent=mysql_query("select Rent from vehicles where Type='$search'"); 2886 | $cost=mysql_fetch_array($rent); 2887 | $price=$cost['Rent']; 2888 | 2889 | echo "

Vehicle Allotment History

"; 2890 | echo ""; 2891 | echo ""; 2892 | echo ""; 2893 | echo "

"; 2894 | echo ""; 2895 | echo ""; 2896 | echo "
Reg No: $reg
Used by: $id
Allotment Date: $ad
Return Date: $rd
Rent: $price
"; 2897 | } 2898 | 2899 | 2900 | else if(!empty($result) && (mysql_num_rows($result)>1)) 2901 | { 2902 | echo "
"; 2903 | echo "
"; 2904 | 2905 | echo "

Select any vehicle

"; 2906 | 2907 | for($i=0;$i"; 2916 | echo "

$reg

"; 2917 | //echo "

Type: $type
"; 2918 | echo "

"; 2919 | } 2920 | } 2921 | } 2922 | } 2923 | } 2924 | 2925 | else 2926 | echo ""; 2927 | } 2928 | } 2929 | 2930 | if(isset($_GET['pid']) && strcmp($_GET['pid'],"vehicle_al") == 0) 2931 | { 2932 | echo "
"; 2933 | echo ""; 2934 | echo ""; 2935 | echo "
"; 2936 | 2937 | if(isset($_GET['id']) && isset($_GET['reg']) && isset($_GET['ad']) || isset($_GET['rd']) ) 2938 | { 2939 | $search=$_GET['reg']; 2940 | //$result=mysql_query("select * from vehicle_given where Reg_No='$search'"); 2941 | echo "
"; 2942 | //$val=mysql_fetch_array($result); 2943 | 2944 | // $reg=$val['Reg_No']; 2945 | $id=$_GET['id']; 2946 | $reg=$_GET['reg']; 2947 | $ad=$_GET['ad']; 2948 | $rd=$_GET['rd']; 2949 | 2950 | $rent=mysql_query("select Rent from vehicles where Reg_No='$search'"); 2951 | $cost=mysql_fetch_array($rent); 2952 | $price=$cost['Rent']; 2953 | 2954 | echo "

Vehicle Allotment History

"; 2955 | echo ""; 2956 | echo ""; 2957 | echo ""; 2958 | echo "

"; 2959 | echo ""; 2960 | echo ""; 2961 | echo "
Reg No: $reg
Used by: $id
Allotment Date: $ad
Return Date: $rd
Rent: $price
"; 2962 | } 2963 | } 2964 | 2965 | /*Room allotment */ 2966 | 2967 | if(isset($_GET['pid']) && strcmp($_GET['pid'],"alloted_room") == 0) 2968 | { 2969 | echo "
"; 2970 | echo ""; 2971 | echo ""; 2972 | echo "
"; 2973 | 2974 | if(isset($_GET['option']) && strcmp($_GET['option'],"search_val")==0) 2975 | { 2976 | $search=$_POST['search_val']; 2977 | 2978 | if((!empty($search)) && ($search[0]=='Z' || $search[0]=='z')) 2979 | { 2980 | $find=mysql_query("select * from room where Room_No='$search'"); 2981 | 2982 | if(mysql_num_rows($find)==0) 2983 | echo ""; 2984 | 2985 | else 2986 | { 2987 | $result=mysql_query("select * from room_given where Room_No='$search'"); 2988 | 2989 | if(mysql_num_rows($result)==0) 2990 | { 2991 | echo ""; 2992 | } 2993 | 2994 | else 2995 | { 2996 | if((!empty($result) && mysql_num_rows($result)==1)) 2997 | { 2998 | echo "
"; 2999 | $val=mysql_fetch_array($result); 3000 | $room=$val['Room_No']; 3001 | $id=$val['Patient_ID']; 3002 | $ad=$val['Allot_date']; 3003 | $rd=$val['Discharge_date']; 3004 | $rent=mysql_query("select Rent from room where Room_No='$search'"); 3005 | $price=mysql_fetch_array($rent); 3006 | $cost=$price['Rent']; 3007 | 3008 | echo "

Room Allotment History

"; 3009 | echo ""; 3010 | echo ""; 3011 | echo ""; 3012 | echo "

"; 3013 | echo ""; 3014 | echo ""; 3015 | echo "
Room No: $room
Patient Id: $id
Allotment Date: $ad
Discharge Date: $rd
Rent: $cost
"; 3016 | } 3017 | 3018 | else if(!empty($result) && (mysql_num_rows($result)>1)) 3019 | { 3020 | echo "
"; 3021 | echo "
"; 3022 | 3023 | for($i=0;$i"; 3032 | echo "

$room

"; echo "
"; 3033 | //echo "

$reg

"; 3034 | //echo "

Type: $type
"; 3035 | echo "

"; 3036 | } 3037 | } 3038 | } 3039 | } 3040 | } 3041 | 3042 | else if((!empty($search)) && ($search[0]!='Z' || $search[0]!='z')) 3043 | { 3044 | $find=mysql_query("select * from room where Type='$search'"); 3045 | 3046 | if(mysql_num_rows($find)==0) 3047 | echo ""; 3048 | 3049 | else 3050 | { 3051 | $result=mysql_query("select * from room a,room_given b where a.Type='$search' and a.Room_No=b.Room_No"); 3052 | //echo mysql_num_rows($result); 3053 | 3054 | if(mysql_num_rows($result)==0) 3055 | { 3056 | echo ""; 3057 | } 3058 | 3059 | else 3060 | { 3061 | if((!empty($result) && mysql_num_rows($result)==1)) 3062 | { 3063 | echo "
"; 3064 | $val=mysql_fetch_array($result); 3065 | $room=$val['Room_No']; 3066 | $id=$val['Patient_ID']; 3067 | $ad=$val['Allot_date']; 3068 | $rd=$val['Discharge_date']; 3069 | $rent=mysql_query("select Rent from room where Room_No='$search'"); 3070 | $price=mysql_fetch_array($rent); 3071 | $cost=$price['Rent']; 3072 | 3073 | 3074 | echo "

Room Allotment History

"; 3075 | echo ""; 3076 | echo ""; 3077 | echo ""; 3078 | echo "

"; 3079 | echo ""; 3080 | echo ""; 3081 | echo "
Room No: $room
Patient Id: $id
Allotment Date: $ad
Discharge Date: $rd
Rent: $cost
"; 3082 | } 3083 | 3084 | else if(!empty($result) && (mysql_num_rows($result)>1)) 3085 | { 3086 | echo "
"; 3087 | echo "
"; 3088 | 3089 | echo "

Select any room

"; 3090 | 3091 | for($i=0;$i"; 3100 | echo "

$reg

"; 3101 | //echo "

Type: $type
"; 3102 | echo "

"; 3103 | } 3104 | } 3105 | } 3106 | } 3107 | } 3108 | 3109 | 3110 | else 3111 | echo ""; 3112 | } 3113 | 3114 | /* Room allotment finished */ 3115 | } 3116 | if(isset($_GET['pid']) && strcmp($_GET['pid'],"room_al") == 0) 3117 | { 3118 | echo "
"; 3119 | echo ""; 3120 | echo ""; 3121 | echo "
"; 3122 | 3123 | if(isset($_GET['id']) && isset($_GET['room']) && isset($_GET['ad']) || isset($_GET['rd']) ) 3124 | { 3125 | $search=$_GET['room']; 3126 | //$result=mysql_query("select * from vehicle_given where Reg_No='$search'"); 3127 | echo "
"; 3128 | //$val=mysql_fetch_array($result); 3129 | 3130 | // $reg=$val['Reg_No']; 3131 | $id=$_GET['id']; 3132 | $room=$_GET['room']; 3133 | $ad=$_GET['ad']; 3134 | $rd=$_GET['rd']; 3135 | 3136 | $rent=mysql_query("select Rent from room where Room_No='$search'"); 3137 | $cost=mysql_fetch_array($rent); 3138 | $price=$cost['Rent']; 3139 | 3140 | echo "

Room Allotment History

"; 3141 | echo ""; 3142 | echo ""; 3143 | echo ""; 3144 | echo "

"; 3145 | echo ""; 3146 | echo ""; 3147 | echo "
Reg No: $room
Used by: $id
Allotment Date: $ad
Return Date: $rd
Rent: $price
"; 3148 | } 3149 | } 3150 | 3151 | } 3152 | 3153 | /* KNS END */ 3154 | ?> 3155 |
3156 |
3157 | 3158 | --------------------------------------------------------------------------------