report on hms

143
ARYABHATTA, AJMER CONTENTS 1. Introduction 1.1 Purpose 1.2 Scope 1.3 Technologies used 1.4 Overview 2. Overall Description 2.1 Goals of Proposed System 2.2 Background 2.3 Project Requirements 2.4 User Characteristics 2.5 Constraints 3. Conclusion 4. Bibliography Hospital Management System Page 1

Upload: sachin-sharma

Post on 17-Feb-2017

73 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Report On HMS

ARYABHATTA, AJMER

CONTENTS

1. Introduction1.1 Purpose1.2 Scope1.3 Technologies used1.4 Overview

2. Overall Description2.1 Goals of Proposed System2.2 Background2.3 Project Requirements2.4 User Characteristics2.5 Constraints

3. Conclusion

4. Bibliography

Introduction

Hospital Management System Page 1

Page 2: Report On HMS

ARYABHATTA, AJMER

1.1) Purpose• The Software is for the automation of Hospital Management.• It maintains two levels of users:-_ Administrator Level_ User Level• The Software includes:-_ Maintaining Patient details._ Providing and maintaining all kinds of tests for a patient._ Billing and Report generation.

1.2) ScopeIt can be used in any Hospital, Clinic, Dispensary or Pathology labs for maintainingpatient details and their test results.

1.3) Technologies to be usedThis project will be a desktop application to be developed in VB 6.0 having MsAccess as backend.• Database Design (Ms Access)• Form Design (VB 6.0)• Coding (VB 6.0)• Testing (VB 6.0)• Reporting Tool (Data Report)

1.4) Overview_ Project is related to Hospital Management System._ The project maintains two levels of users:-• Administrator Level-Doctor• User Level-Data Entry Operator

_ Main facilities available in this project are:-• Maintaining records of indoor/outdoor patients.• Maintaining patients diagnosis details, advised tests to be done.• Providing different test facilities to a doctor for diagnosis of patients._ X-Ray_ Urine Test_ Stool Test_ Sonography Test_ Gastroscopy Test_ Colonoscopy Test_ Blood Test_ Biochemistry Test• Providing billing details for indoor/outdoor patients._ Related test reports, patient details report, prescription and billing reports canbe generated as per user requirements._ User or Administrator can search a patient’s record by his/her name or theirregistration date.

1. Overall Description

Hospital Management System Page 2

Page 3: Report On HMS

ARYABHATTA, AJMER

2.1) Goals of proposed system

1. Planned approach towards workingThe working in the organization will be well planned and organized. The data will be stored properly in data stores, which will help in retrieval of information as well as its storage.2. AccuracyThe level of accuracy in the proposed system will be higher. All operation would be done correctly and it ensures that whatever information is coming from the center is accurate.3. Reliability The reliability of the proposed system will be high due to the above stated reasons. The reason for the increased reliability of the system is that now there would be proper storage of information.4. No Redundancy In the proposed system utmost care would be that noinformation is repeated anywhere, in storage or otherwise. This would assureeconomic use of storage space and consistency in the data stored.5. Immediate retrieval of informationThe main objective of proposed system is to provide for a quick and efficient retrieval of information. Any type of information would be available whenever the user requires.6. Immediate storage of informationIn manual system there are many problems to store the largest amount of information.7. Easy to OperateThe system should be easy to operate and should be such that it can be developed within a short period of time and fit in the limited budget of the user.

2.2) BackgroundA Hospital is a place where Patients come up for general diseases. Hospitals providefacilities like:-_ Consultation by Doctors on Diseases._ Diagnosis for diseases._Providing treatment facility._ Facility for admitting Patients (providing beds, nursing, etc.)Various operational works that are done in a Hospital are:-_ Recording information about the Patients that come._ Generating bills._ Recording information related to diagnosis given to Patients.

These are the various jobs that need to be done in a Hospital by the operational staff and Doctors. All these works are done on papers.

Hospital Management System Page 3

Page 4: Report On HMS

ARYABHATTA, AJMER

The work is done as follows:-_ Information about Patients is done by just writing the Patients name, age and gender. Whenever the Patient comes up his information is stored freshly._ Bills are generated by recording price for each facility provided to Patient on a separate sheet and at last they all are summed up._ Diagnosis information to patients is generally recorded on the document, which contains Patient information. It is destroyed after some time period to decrease the paper load in the office._ Immunization records of children are maintained in pre-formatted sheets, which are kept in a file. All this work is done manually by the receptionist and other operational staff and lot of papers are needed to be handled and taken care of Doctors have to remember various medicines available for diagnosis and sometimes miss better alternatives as they can’t remember them at that time.

Project Requirements

Processor RAM Disk SpacePentium II, Pentium III,Pentium IV or higher

64 Mb or Higher 130 Mb

Operating System DatabaseWin-98, Win-XP, Linux or any otherhigher version

Ms Access

2.4) User CharacteristicsEvery user should be:• Comfortable of working with computer.• He must have knowledge in medical field.• He must also have basic knowledge of English too.

2.5) Constraints• GUI is only in English.• Login and password is used for identification of user and there is no facility forguest.

Hospital Management System Page 4

Hardware Requirements

Software Requirements

Page 5: Report On HMS

ARYABHATTA, AJMER

CONTENTS

1. Introduction1.1 Purpose1.2 Scope1.3 Technologies used1.4 Overview

2. Overall Description2.1 Goals of Proposed System2.2 Background2.3 Project Requirements2.4 User Characteristics2.5 Constraints

3. Conclusion

4. Bibliography

Hospital Management System Page 5

Page 6: Report On HMS

ARYABHATTA, AJMER

Hospital Management System

Splash Screen:-

General:-

Dim a%

Dim wind$

Dim result As Variant

Text Explicit

Key_Press:-

Private Sub Form_KeyPress(KeyAscii As Integer)

Unload Me

End Sub

Hospital Management System Page 6

Page 7: Report On HMS

ARYABHATTA, AJMER

Form_Load:-

Private Sub Form_Load()

Dim wind$

Dim result As Variant

wind = Space(150)

result = GetComputerName(wind, 150)

Label2.Caption = "This Product Is Regestered To:-" & Trim(wind)

End Sub

Timer_Code:-

Private Sub Timer1_Timer()

a = a + 1

ProgressBar1.Value = a

Splash.MousePointer = 11

lblWarning.Caption = (ProgressBar1.Value / ProgressBar1.Max) * 100 & "%..."

If a = 100 Then

Timer1.Enabled = False

ProgressBar1.Visible = False

Unload Me

MDIForm1.Show

Login.Show

ElseIf a = 7 Then

lbl.Caption = "Peparing User Interface...."

ElseIf a = 10 Then

lbl.Caption = "Peparing User Interface...."

ElseIf a = 15 Then

lbl.Caption = "Loading..."

ElseIf a = 20 Then

Hospital Management System Page 7

Page 8: Report On HMS

ARYABHATTA, AJMER

lbl.Caption = "Copying_File..."

ElseIf a = 50 Then

lbl.Caption = "Save_File..!!!"

im1.Picture = LoadPicture("images1\5.jpg")

lblLicenseTo.ForeColor = vbBlack

lbl.ForeColor = vbBlack

lblWarning.ForeColor = vbBlack

Label1.ForeColor = vbBlack

ElseIf a = 60 Then

lbl.Caption = "Please Wait..."

ElseIf a = 90 Then

lbl.Caption = "Installation Successfull..."

ElseIf a >= 97 Then

lbl.Caption = "Ready to Use..."

End If

End Sub

Login_Form:-

Hospital Management System Page 8

Page 9: Report On HMS

ARYABHATTA, AJMER

General:-

Text Explicit

Dim rs As Recordset

Public LoginSucceeded As Boolean

Form_Load:-

Private Sub Form_Load()

Txtuser.BackColor = &H80FFFF

Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2

Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2

End Sub

To Click On Cancel Button:-

Private Sub cmdCancel_Click()

'set the global var to false

'to denote a failed login

LoginSucceeded = False

Me.Hide

End Sub

Key_Press On Text1:-

Private Sub Text1_KeyPress(KeyAscii As Integer)

Hospital Management System Page 9

Page 10: Report On HMS

ARYABHATTA, AJMER

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

Key_Press On Text2:-

Private Sub Text2_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

GotFocus On TxtPass:-

Private Sub txtpass_GotFocus()

txtpass.BackColor = &H80FFFF

End Sub

LostFocus On TxtPass:-

Private Sub txtpass_LostFocus()

Hospital Management System Page 10

Page 11: Report On HMS

ARYABHATTA, AJMER

txtpass.BackColor = vbWhite

End Sub

GottFocus On Txtuser:-

Private Sub Txtuser_GotFocus()

Txtuser.BackColor = &H80FFFF

End Sub

LostFocus On TxtUser :-

Private Sub Txtuser_LostFocus()

Txtuser.BackColor = vbWhite

End Sub

Modules:-

Variables Declare as Generally:-

Public cnn As New Connection.

Public D_id As New Recordset, p As New Recordset, rs As New Recordset, Ref As New Recordset, p_id As New Recordset, id As New Recordset, Dt As New Recordset, lt As New Recordset

The API Text Viewer (Get_Computer_Name):-

Public Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

MDIFORM:-

Hospital Management System Page 11

Page 12: Report On HMS

ARYABHATTA, AJMER

MDIForm_DbiClivk:-

Private Sub MDIForm_DblClick()

Anknowledgement.SHOW

End Sub

MDIForm_Load:-

Private Sub MDIForm_Load()

MDIForm1.Height = Screen.Height

MDIForm1.Width = Screen.Width

If cnn.State = adStateOpen Then

cnn.close

Else

cnn.Open ("provider = microsoft.jet.oledb.4.0;data source=" & App.Path & "\HMS.mdb;Jet OLEDB:Database password=sss")

End If

Hospital Management System Page 12

Page 13: Report On HMS

ARYABHATTA, AJMER

End Sub

MDIForm_Unlaod:-

Private Sub MDIForm_Unload(Cancel As Integer)

Dim a%

a = MsgBox("Quit the Project", vbDefaultButton4 + vbYesNoCancel, "HMS_Info...")

If a = vbYes Then

Unload Me

ElseIf a = vbNo Then

Me.Hide

ElseIf a = vbCancel Then

Me.SHOW

End If

End Sub

Click On Lab_Test Menu:-

Private Sub mnlabtest_Click()

Test.SHOW

End Sub

Click On Add_New_Staff Menu:-

Private Sub mnuaddstaff_Click()

ADDStaff.SHOW

End Sub

Click On Acknowledgement Menu:-

Private Sub mnuanknowledgement_Click()

Anknowledgement.SHOW

End Sub

Click On Discharge_Patient_Ticket Menu:-

Hospital Management System Page 13

Page 14: Report On HMS

ARYABHATTA, AJMER

Private Sub mnudischargepatientticket_Click()

Dischargeticket.SHOW

End Sub

Click On Doctor_Info Menu:-

Private Sub mnuDoctorinfo_Click()

aboutstaff.SHOW

End Sub

Click On Exit Menu:-

Private Sub mnuexit_Click()

Unload Me

End Sub

Click On add_New_Doctor Menu:-

Private Sub mnunewdoctor_Click()

AddDoctor.SHOW

End Sub

Click On Outer_Patient Menu:-

Private Sub mnuouterpatient_Click()

OuterPatient.SHOW

End Sub

Click On Patient_Details Menu:-

Private Sub mnupatientDetails_Click()

PatientDetails.SHOW

End Sub

Click On Patient_Discharge_Form Menu:-

Hospital Management System Page 14

Page 15: Report On HMS

ARYABHATTA, AJMER

Private Sub mnupatientdischargeform_Click()

PatientDetails.SHOW

End Sub

Click On Patient_Registration Menu:-

Private Sub mnupatiententry_Click()

Patient.SHOW

End Sub

Click On Staff_Info Menu:-

Private Sub mnustaffinfo_Click()

Staffinfo.SHOW

End Sub

Click On Search_Doctor Menu:-

Private Sub mnusearchDoctor_Click()

SearchDoctor.SHOW

End Sub

Click On Search_Staff Menu:-

Private Sub mnuSearchstaff_Click()

aboutstaff.SHOW

End Sub

Click On Standard_ToolBar:-

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

If Button.Caption = "Patient_Registration" Then

Patient.SHOW

ElseIf Button.Caption = "Patient_Details" Then

PatientDetails.SHOW

ElseIf Button.Caption = "Add_Doctor" Then

Hospital Management System Page 15

Page 16: Report On HMS

ARYABHATTA, AJMER

AddDoctor.SHOW

ElseIf Button.Caption = "Search_Doctor" Then

SearchDoctor.SHOW

ElseIf Button.Caption = "Search_Staff" Then

aboutstaff.SHOW

ElseIf Button.Caption = "New_Staff" Then

ADDStaff.SHOW

ElseIf Button.Caption = "Outer_Patient" Then

OuterPatient.SHOW

ElseIf Button.Caption = "Billing_Voucher" Then

Billings.SHOW

ElseIf Button.Caption = "Lab_Test" Then

Test.SHOW

ElseIf Button.Caption = "Discharge_Patient" Then

PatientDetails.SHOW

End If

End Sub

Patient_Registration:-

Hospital Management System Page 16

Page 17: Report On HMS

ARYABHATTA, AJMER

General:-

Dim flag%

To Click On Text:-

Private Sub bloodsugar_Click()

'bloodsugar.Caption = "Blood Sugar"

End Sub

To Click On Text:-

Private Sub bloodtest_Click()

'bloodtest.Caption = "Blood_Test"

End Sub

To Click On Text:-

Hospital Management System Page 17

Page 18: Report On HMS

ARYABHATTA, AJMER

Private Sub ctscane_Click()

'ctscane.Caption = "CT_Scane"

End Sub

To Got_Focus On DTPicker:-

Private Sub DTPicker1_GotFocus()

DTPicker1.CalendarBackColor = &H80FFFF

End Sub

To Lost_Focus On Dtpicker1:-

Private Sub DTPicker1_LostFocus()

DTPicker1.CalendarBackColor = vbWhite

End Sub

To Click On Text:-

Private Sub ecg_Click()

ecg.Caption = "ECG"

End Sub

To Click On Button:-

Private Sub exit_Click()

Unload Me

End Sub

Form_Load:-

Hospital Management System Page 18

Page 19: Report On HMS

ARYABHATTA, AJMER

Private Sub Form_Load()

Call loadDoctorName

gender.ListIndex = 0

Doctor.ListIndex = 0

Rno.ListIndex = 0

Bno.ListIndex = 0

Call Unique

Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2

Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2

DTPicker1.Value = Date

End Sub

To click On Save_Button:-

Private Sub save_Click()

cnn.Execute " insert into Patient_Registration(Reg_No,P_Name,Age,Gender,F_Name,Dr_Preffered,Address,Contact_No,Body_Sign,Admit_DD,R_No,B_No,X_Ray,Ultra_Sound,ECG,Blood_Test,CT_Scane,Blood_Sugar)values(" & Text1.Text & ",'" & Text2.Text & "'," & Text3.Text & ",'" & gender.Text & "','" & Text8.Text & "','" & Doctor.Text & "','" & Text5.Text & "'," & Text6.Text & ",'" & Text7.Text & "','" & DTPicker1.Value & "'," & Rno.Text & "," & Bno.Text & ",'" & xray.Value & "','" & ultrasound.Value & "','" & ecg.Value & "','" & bloodtest.Value & "','" & ctscane.Value & "','" & bloodsugar.Value & "') "

If flag = 1 Then\

Flag=0

Exit Sub

End If

MsgBox "Record Successfully Added", vbDefaultButton1, "Patient_Registration_Form"

Call clear

Call Unique

End Sub

Hospital Management System Page 19

Page 20: Report On HMS

ARYABHATTA, AJMER

To KeyPress On Text1:-

Private Sub Text1_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

End Sub

GotFocus On Text2:-

Private Sub Text2_GotFocus()

Text2.BackColor = &H80FFFF

End Sub

To KeyPress On Text2:-

Private Sub Text2_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

Hospital Management System Page 20

Page 21: Report On HMS

ARYABHATTA, AJMER

LostFocus On Text2:-

Private Sub Text2_LostFocus()

Text2.BackColor = vbWhite

End Sub

GotFocus On Text3:-

Private Sub Text3_GotFocus()

Text3.BackColor = &H80FFFF

End Sub

KeyPress On Text3:-

Private Sub Text3_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

End Sub

LostFocus On Text3:-

Private Sub Text3_LostFocus()

Text3.BackColor = vbWhite

End Sub

GotFocus On Text4:-

Hospital Management System Page 21

Page 22: Report On HMS

ARYABHATTA, AJMER

Private Sub Text4_GotFocus()

Text4.BackColor = &H80FFFF

End Sub

KeyPress On Text4:-

Private Sub Text4_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

LostFocus On Text4:-

Private Sub Text4_LostFocus()

Text4.BackColor = vbWhite

End Sub

GotFocus On Text5:-

Private Sub Text5_GotFocus()

Text5.BackColor = &H80FFFF

End Sub

KeyPress On Text5:-

Private Sub Text5_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

Hospital Management System Page 22

Page 23: Report On HMS

ARYABHATTA, AJMER

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

LostFocus On Text5:-

Private Sub Text5_LostFocus()

Text5.BackColor = vbWhite

End Sub

GotFocus On Text6:-

Private Sub Text6_GotFocus()

Text6.BackColor = &H80FFFF

End Sub

KeyPress On Text6:-

Private Sub Text6_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

End Sub

LostFocus On Text6:-

Hospital Management System Page 23

Page 24: Report On HMS

ARYABHATTA, AJMER

Private Sub Text6_LostFocus()

Text6.BackColor = vbWhite

End Sub

GotFocus On Text7:-

Private Sub Text7_GotFocus()

Text7.BackColor = &H80FFFF

End Sub

KeyPress On Text7:-

Private Sub Text7_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

LostFocus On Text7:-

Private Sub Text7_LostFocus()

Text7.BackColor = vbWhite

End Sub

Procedure Clear:-

Hospital Management System Page 24

Page 25: Report On HMS

ARYABHATTA, AJMER

Sub clear()

Text1.Text = " "

Text2.Text = " "

Text3.Text = " "

Doctor.ListIndex = 0

Text5.Text = " "

Text6.Text = " "

Text7.Text = " "

Text8.Text = " "

Rno.ListIndex = 0

Bno.ListIndex = 0

gender.ListIndex = 0

xray.Value = 0

ultrasound.Value = 0

bloodtest.Value = 0

bloodsugar.Value = 0

ecg.Value = 0

ctscane.Value = 0

End Sub

Procedure Unique:-

Sub Unique()

Dim p_id As New Recordset

p_id.Open "select * from Patient_Registration order by Reg_No", cnn, adOpenDynamic, adLockOptimistic

If p_id.RecordCount = 0 Then

Text1.Text = 0

Else

Hospital Management System Page 25

Page 26: Report On HMS

ARYABHATTA, AJMER

p_id.MoveLast

Text1.Text = p_id.Fields("Reg_No").Value + 1

End If

p_id.close

End Sub

GotFocus on Text8:-

Private Sub Text8_GotFocus()

Text8.BackColor = &H80FFFF

End Sub

LostFocus on Text8:-

Private Sub Text8_LostFocus()

Text8.BackColor = vbWhite

End Sub

GotFocus on Text9:-

Private Sub Text9_GotFocus()

Text9.BackColor = &H80FFFF

End Sub

KeyPress on Text9:-

Private Sub Text9_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

Hospital Management System Page 26

Page 27: Report On HMS

ARYABHATTA, AJMER

End Sub

LostFocus on Text9:-

Private Sub Text9_LostFocus()

Text9.BackColor = vbWhite

End Sub

To Click on Check_Box:-

Private Sub xray_Click()

xray.Caption = "X-Ray"

End Sub

Procedure Load_Doctor_Name:-

Sub loadDoctorName()

Dim i%, rss As New Recordset

rss.Open "select * from New_Doctor ", cnn, adOpenKeyset, adLockReadOnly

For i = 0 To rss.RecordCount - 1

Doctor.AddItem (rss.Fields("D_Name").Value)

rss.MoveNext

Next

rss.close

End Sub

Patient_Details:-

Hospital Management System Page 27

Page 28: Report On HMS

ARYABHATTA, AJMER

To Click on Close_Button:-

Private Sub close_Click()

Unload Me

End Sub

To Click on Cammand_Button:-

Hospital Management System Page 28

Page 29: Report On HMS

ARYABHATTA, AJMER

Private Sub Command1_Click()

Patient_Reports.SHOW

End Sub

To Click on Option_Button:-

Private Sub Date_Click()

Frame2.Visible = True

PatientName.Visible = False

Label1.Visible = False

Label2.Visible = True

DTPicker1.Visible = True

Call loadDTP

End Sub

To Click on Discharge_Button:-

Private Sub discharge_Click()

dischargeform.SHOW

Call catch

End Sub

To Click on Dtpicker:-

Private Sub DTPicker1_Click()

'Call loadDTPData

End Sub

To GotFocus on DTPicker:-

Private Sub DTPicker1_GotFocus()

DTPicker1.CalendarBackColor = &H80FFFF

End Sub

To LostFocus on DTPicker:-

Hospital Management System Page 29

Page 30: Report On HMS

ARYABHATTA, AJMER

Private Sub DTPicker1_LostFocus()

DTPicker1.CalendarBackColor = vbWhite

Call loadDTPData

End Sub

Form_Load:-

Private Sub Form_Load()

Call all

Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2

Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2

DTPicker1.Value = Date

End Sub

To Click onGet_Report:-

Private Sub getreport_Click()

If lv.ListItems.Count = 0 Then

Exit Sub

End If

If DataEnvironment1.Connection1.State <> 0 Then

DataEnvironment1.Connection1.close

End If

DataEnvironment1.Connection1.Open

DataEnvironment1.Command3 lv.SelectedItem.Text

Patient_Reports.SHOW

End Sub

To Click on List_View:-

Hospital Management System Page 30

Page 31: Report On HMS

ARYABHATTA, AJMER

Private Sub lv_Click()

getreport.Visible = True

discharge.Visible = True

End Sub

To GotFocus on List_View:-

Private Sub lv_GotFocus()

lv.BackColor = &H80FFFF

End Sub

To GotFocus on Text1:-

Private Sub Text1_GotFocus()

Text1.BackColor = &H80FFFF

End Sub

To KeyPress on Text1:-

Private Sub Text1_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

To LostFocus onText1:-

Private Sub Text1_LostFocus()

Text1.BackColor = vbWhite

End Sub

Hospital Management System Page 31

Page 32: Report On HMS

ARYABHATTA, AJMER

To GotFocus on Text2:-

Private Sub Text2_GotFocus()

Text2.BackColor = &H80FFFF

End Sub

To LostFocus on Text2:-

Private Sub Text2_LostFocus()

Text2.BackColor = vbWhite

End Sub

Procedure Of Load_Patient_Data:-

Sub loadPatientdata()

Dim l As ListItem, rss As New Recordset

rss.Open "select * from Patient_Registration where P_Name like '" & PatientName.Text & "%'", cnn, adOpenKeyset, adLockReadOnly

lv.ListItems.clear

If rss.RecordCount > 0 Then

rss.MoveFirst

While rss.EOF = False

Set l = lv.ListItems.Add(, , rss.Fields("Reg_No").Value)

l.SubItems(1) = rss.Fields("P_Name").Value

l.SubItems(2) = rss.Fields("Age").Value

l.SubItems(3) = rss.Fields("Gender").Value

l.SubItems(4) = rss.Fields("F_Name").Value

l.SubItems(5) = rss.Fields("Dr_Preffered").Value

l.SubItems(6) = rss.Fields("Address").Value

l.SubItems(7) = rss.Fields("Contact_No").Value

l.SubItems(8) = rss.Fields("Body_Sign").Value

l.SubItems(9) = rss.Fields("Admit_DD").Value

Hospital Management System Page 32

Page 33: Report On HMS

ARYABHATTA, AJMER

l.SubItems(10) = rss.Fields("R_No").Value

l.SubItems(11) = rss.Fields("B_No").Value

l.SubItems(12) = rss.Fields("X_Ray").Value

l.SubItems(13) = rss.Fields("Ultra_Sound").Value

l.SubItems(14) = rss.Fields("ECG").Value

l.SubItems(15) = rss.Fields("Blood_Test").Value

l.SubItems(16) = rss.Fields("CT_Scane").Value

l.SubItems(17) = rss.Fields("Blood_Sugar").Value

rss.MoveNext

Wend

rss.close

End If

End Sub

Procedure Of Load_Name:-

Sub loadname()

Dim i%, rss As New Recordset

rss.Open "select * from Patient_Registration ", cnn, adOpenKeyset, adLockReadOnly

For i = 0 To rss.RecordCount - 1

PatientName.AddItem (rss.Fields("P_Name").Value)

rss.MoveNext

Next

rss.close

End Sub

To Click on Option_Button:-

Hospital Management System Page 33

Page 34: Report On HMS

ARYABHATTA, AJMER

Private Sub optName_Click()

Frame2.Visible = True

PatientName.Visible = True

Label1.Visible = True

Label2.Visible = False

DTPicker1.Visible = False

Call loadname

End Sub

To Click on Option_Button :-

Private Sub PatientName_Click()

Call loadPatientdata

End Sub

To GotFocus on Combo_Box:-

Private Sub PatientName_GotFocus()

PatientName.BackColor = &HC0FFFF

End Sub

To KeyDown on Combo_Box:-

Private Sub PatientName_KeyDown(KeyCode As Integer, Shift As Integer)

Call loadPatientdata

End Sub

To LostFocus on combo_Box:-

Private Sub PatientName_LostFocus()

PatientName.BackColor = vbWhite

End Sub

Procedure Of LoadDTPData:-

Hospital Management System Page 34

Page 35: Report On HMS

ARYABHATTA, AJMER

Sub loadDTPData()

Dim l As ListItem, rss As New Recordset

rss.Open "select * from Patient_Registration where Admit_DD like '" & DTPicker1.Value & "%'", cnn, adOpenKeyset, adLockReadOnly

lv.ListItems.clear

If rss.RecordCount > 0 Then

rss.MoveFirst

While rss.EOF = False

Set l = lv.ListItems.Add(, , rss.Fields("Reg_No").Value)

l.SubItems(1) = rss.Fields("P_Name").Value

l.SubItems(2) = rss.Fields("Age").Value

l.SubItems(3) = rss.Fields("Gender").Value

l.SubItems(4) = rss.Fields("F_Name").Value

l.SubItems(5) = rss.Fields("Dr_Preffered").Value

l.SubItems(6) = rss.Fields("Address").Value

l.SubItems(7) = rss.Fields("Contact_No").Value

l.SubItems(8) = rss.Fields("Body_Sign").Value

l.SubItems(9) = rss.Fields("Admit_DD").Value

l.SubItems(10) = rss.Fields("R_No").Value

l.SubItems(11) = rss.Fields("B_No").Value

l.SubItems(12) = rss.Fields("X_Ray").Value

l.SubItems(13) = rss.Fields("Ultra_Sound").Value

l.SubItems(14) = rss.Fields("ECG").Value

l.SubItems(15) = rss.Fields("Blood_Test").Value

l.SubItems(16) = rss.Fields("CT_Scane").Value

l.SubItems(17) = rss.Fields("Blood_Sugar").Value

rss.MoveNext

Hospital Management System Page 35

Page 36: Report On HMS

ARYABHATTA, AJMER

Wend

rss.close

End If

End Sub

Procedure Of Load_DTP:-

Sub loadDTP()

Dim j%, rss As New Recordset

rss.Open "select * from Patient_Registration where Admit_DD =#" & DTPicker1.Value & "# ", cnn, adOpenKeyset, adLockReadOnly

rss.close

End Sub

Sub all()

PatientName.ListIndex = 0

Frame2.Visible = False

optName.Value = 0

Date.Value = 0

End Sub

Procedure Of Catch:-

Sub catch()

dischargeform.Text1.Text = lv.SelectedItem

dischargeform.txtpn.Text = lv.SelectedItem.SubItems(1)

dischargeform.FatherName.Text = lv.SelectedItem.SubItems(4)

dischargeform.gender.Text = lv.SelectedItem.SubItems(3)

dischargeform.Text2.Text = lv.SelectedItem.SubItems(2)

dischargeform.txtdct.Text = lv.SelectedItem.SubItems(5)

dischargeform.Text5.Text = lv.SelectedItem.SubItems(6)

dischargeform.Text6.Text = lv.SelectedItem.SubItems(7)

Hospital Management System Page 36

Page 37: Report On HMS

ARYABHATTA, AJMER

dischargeform.Text7.Text = lv.SelectedItem.SubItems(8)

dischargeform.admit.Value = lv.SelectedItem.SubItems(9)

dischargeform.Rno.Text = lv.SelectedItem.SubItems(10)

dischargeform.Bno.Text = lv.SelectedItem.SubItems(11)

dischargeform.xray.Value = lv.SelectedItem.SubItems(12)

dischargeform.ultrasound.Value = lv.SelectedItem.SubItems(13)

dischargeform.ecg.Value = lv.SelectedItem.SubItems(14)

dischargeform.bloodtest.Value = lv.SelectedItem.SubItems(15)

dischargeform.ctscane.Value = lv.SelectedItem.SubItems(16)

dischargeform.bloodsugar.Value = lv.SelectedItem.SubItems(17)

End Sub

New_Doctor:-

Hospital Management System Page 37

Page 38: Report On HMS

ARYABHATTA, AJMER

To Click On Add_Button:-

Private Sub CmdAdd_Click()

Call Unique

cnn.Execute ("insert into New_Doctor(D_id,D_Name,Gender,Dept,specialization,Contact_No) values(" & Text1.Text & ",'" & Text2.Text & "','" & gender.Text & "','" & Text3.Text & "','" & specialization.Text & "'," & Text6.Text & ")")

Call clear_Doctor

Text2.SetFocus

Call Unique

MsgBox ("Record Successfully Added")

End Sub

To Click on Cancel_Button:-

Private Sub cmdCancel_Click()

Unload Me

End Sub

Form_Load:-

Private Sub Form_Load()

gender.ListIndex = 0

specialization.ListIndex = 0

Call Unique

Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2

Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2

End Sub

To GotFocus on Combo_Box:-

Private Sub Gender_GotFocus()

gender.BackColor = &H80FFFF

Hospital Management System Page 38

Page 39: Report On HMS

ARYABHATTA, AJMER

End Sub

To LostFocus on Combo_Box:-

Private Sub Gender_LostFocus()

gender.BackColor = vbWhite

End Sub

To KeyPress on Text1:-

Private Sub Text1_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

End Sub

To GotFocus on Text2:-

Private Sub Text2_GotFocus()

Text2.BackColor = &H80FFFF

End Sub

To KeyPress on Text2:-

Private Sub Text2_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

Hospital Management System Page 39

Page 40: Report On HMS

ARYABHATTA, AJMER

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

To LostFocus on Text2:-

Private Sub Text2_LostFocus()

Text2.BackColor = vbWhite

End Sub

To GotFocus on Text3:-

Private Sub Text3_GotFocus()

Text3.BackColor = &H80FFFF

End Sub

To LostFocus on Text3:-

Private Sub Text3_LostFocus()

Text3.BackColor = vbWhite

End Sub

To GotFocus on Text4:-

Private Sub Text4_GotFocus()

Text4.BackColor = &H80FFFF

End Sub

To KeyPress on Text4:-

Private Sub Text4_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

Hospital Management System Page 40

Page 41: Report On HMS

ARYABHATTA, AJMER

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

To LostFocus on Text4:-

Private Sub Text4_LostFocus()

Text4.BackColor = vbWhite

End Sub

To GotFocus on Text5:-

Private Sub Text5_GotFocus()

Text5.BackColor = &H80FFFF

End Sub

To KeyPress on Text5:-

Private Sub Text5_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

Hospital Management System Page 41

Page 42: Report On HMS

ARYABHATTA, AJMER

Procedure Of Clear_Doctor_Feilds:-

Sub clear_Doctor()

Text2.Text = " "

Text3.Text = " "

Text6.Text = " "

gender.ListIndex = 0

specialization.ListIndex = 0

End Sub

Procedure Of Unique:-

Private Sub Unique()

Dim D_id As New Recordset

D_id.Open "select * from New_Doctor order by D_id", cnn, adOpenDynamic, adLockOptimistic

If D_id.RecordCount = 0 Then

Text1.Text = 0

Else

D_id.MoveLast

Text1.Text = D_id.Fields("D_id").Value + 1

End If

D_id.close

End Sub

To LostFocus on Text5:-

Private Sub Text5_LostFocus()

09Text5.BackColor = vbWhite

End Sub

Hospital Management System Page 42

Page 43: Report On HMS

ARYABHATTA, AJMER

To GotFocus on Text6:-

Private Sub Text6_GotFocus()

Text6.BackColor = &H80FFFF

End Sub

To LostFocus on Text6:-

Private Sub Text6_LostFocus()

Text6.BackColor = vbWhite

End Sub

Hospital Management System Page 43

Page 44: Report On HMS

ARYABHATTA, AJMER

Doctor_Details:-

To Click on Close_Button:-

Private Sub close_Click()

Unload Me

End Sub

Hospital Management System Page 44

Page 45: Report On HMS

ARYABHATTA, AJMER

To Click on Command_Button:-

Private Sub Command1_Click()

DoctorReports.SHOW

End Sub

To Click on Option_Button:-

Private Sub Dept_Click()

Frame2.Visible = True

n.Visible = False

DNAME.Visible = False

DEPT_NAME.Visible = True

d.Visible = True

Call loaddept

End Sub

To Click On Combo_Box:-

Private Sub DEPT_NAME_Click()

Call loadDeptData

End Sub

To GotFocus on Combo_Box:-

Private Sub DEPT_NAME_GotFocus()

DEPT_NAME.BackColor = &H80FFFF

End Sub

To KeyDown on Combo_Box:-

Private Sub DEPT_NAME_KeyDown(KeyCode As Integer, Shift As Integer)

Call loadDeptData

End Sub

Hospital Management System Page 45

Page 46: Report On HMS

ARYABHATTA, AJMER

To LostFocus on Combo_Box:-

Private Sub DEPT_NAME_LostFocus()

Call loadDeptData

End Sub

To Click on Combo_Box:-

Private Sub DNAME_Click()

Call loadDoctordata

End Sub

To GotFocus on Combo_Box:-

Private Sub DNAME_GotFocus()

DNAME.BackColor = &H80FFFF

End Sub

To KeyDown on Combo_Box:-

Private Sub DNAME_KeyDown(KeyCode As Integer, Shift As Integer)

Call loadDoctordata

End Sub

To LostFocus on Combo_Box:-

Private Sub DNAME_LostFocus()

Call loadDoctordata

End Sub

Form_Load:-

Private Sub Form_Load()

Call doc

Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2

Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2

End Sub

Hospital Management System Page 46

Page 47: Report On HMS

ARYABHATTA, AJMER

To Click on getreport_Button:-

Private Sub getreport_Click()

If DataEnvironment1.Connection1.State <> 0 Then

DataEnvironment1.Connection1.close

End If

DataEnvironment1.Connection1.Open

DataEnvironment1.Command1 lvd.SelectedItem.Text

DoctorReports.SHOW

End Sub

To Click on List_View :-

Private Sub lvd_Click()

lvd.BackColor = &H80FFFF

getreport.Visible = True

End Sub

To GodFocus on List_View :-

Private Sub lvd_GotFocus()

lvd.BackColor = &H80FFFF

getreport.Visible = True

End Sub

To LostFocus on List_View :-

Private Sub lvd_LostFocus()

lvd.BackColor = vbWhite

End Sub

Hospital Management System Page 47

Page 48: Report On HMS

ARYABHATTA, AJMER

Procedure Of Load_Name

Sub loadname()

Dim i%, rss As New Recordset

rss.Open "select * from New_Doctor ", cnn, adOpenKeyset, adLockReadOnly

For i = 0 To rss.RecordCount - 1

DNAME.AddItem (rss.Fields("D_Name").Value)

rss.MoveNext

Next

rss.close

End Sub

Procedure Of Load_Doctor_Data:-

Sub loadDoctordata()

Dim l As ListItem, rss As New Recordset

rss.Open "select * from New_Doctor where D_Name like '" & DNAME.Text & "%'", cnn, adOpenKeyset, adLockReadOnly

lvd.ListItems.clear

If rss.RecordCount > 0 Then

rss.MoveFirst

While rss.EOF = False

Set l = lvd.ListItems.Add(, , rss.Fields("D_id").Value)

l.SubItems(1) = rss.Fields("D_Name").Value

l.SubItems(2) = rss.Fields("Gender").Value

l.SubItems(3) = rss.Fields("Dept").Value

l.SubItems(4) = rss.Fields("Specialization").Value

l.SubItems(5) = rss.Fields("Contact_No").Value

rss.MoveNext

Wend

Hospital Management System Page 48

Page 49: Report On HMS

ARYABHATTA, AJMER

rss.close

End If

End Sub

Procedure Of Load_Dept:-

Sub loaddept()

Dim i%, rss As New Recordset

rss.Open "select * from New_Doctor", cnn, adOpenKeyset, adLockReadOnly

rss.MoveFirst

For i = 0 To rss.RecordCount - 1

DEPT_NAME.AddItem rss.Fields("Dept").Value

rss.MoveNext

Next

rss.close

End Sub

Procedure Of Laod_Dept_Data:-

Sub loadDeptData()

Dim l As ListItem, rss As New Recordset

rss.Open "select * from New_Doctor where Dept like '" & DEPT_NAME.Text & "%'", cnn, adOpenKeyset, adLockReadOnly

lvd.ListItems.clear

If rss.RecordCount > 0 Then

rss.MoveFirst

While rss.EOF = False

Set l = lvd.ListItems.Add(, , rss.Fields("D_id").Value)

l.SubItems(1) = rss.Fields("D_Name").Value

l.SubItems(2) = rss.Fields("Gender").Value

l.SubItems(3) = rss.Fields("Dept").Value

Hospital Management System Page 49

Page 50: Report On HMS

ARYABHATTA, AJMER

l.SubItems(4) = rss.Fields("Specialization").Value

l.SubItems(5) = rss.Fields("Contact_No").Value

rss.MoveNext

Wend

rss.close

End If

End Sub

To Click on Option_Button :-

Private Sub optName_Click()

Frame2.Visible = True

n.Visible = True

DNAME.Visible = True

DEPT_NAME.Visible = False

d.Visible = False

Call loadname

End Sub

Procedure Of Doc:-

Private Sub doc()

Frame2.Visible = False

DNAME.ListIndex = 0

DEPT_NAME.ListIndex = 0

optName.Value = 0

Dept.Value = 0

End Sub

Hospital Management System Page 50

Page 51: Report On HMS

ARYABHATTA, AJMER

Add_New_Staff:-

To Click on Close_Button :-

Private Sub close_Click()

Unload Me

End Sub

To GotFocus on Combo_Box :-

Private Sub DD_GotFocus()

DD.BackColor = &H80FFFF

End Sub

To LostFocus on Combo_Box :-

Private Sub DD_LostFocus()

DD.BackColor = vbWhite

End Sub

Hospital Management System Page 51

Page 52: Report On HMS

ARYABHATTA, AJMER

Form_Load:-

Private Sub Form_Load()

Call load

Call Unique

Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2

Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2

End Sub

To GotFocus on Combo_Box :-

Private Sub Gender_GotFocus()

gender.BackColor = &H80FFFF

End Sub

To LostFocus on Combo_Box :-

Private Sub Gender_LostFocus()

gender.BackColor = vbWhite

End Sub

To GotFocus on Combo_Box :-

Private Sub Martial_GotFocus()

Martial.BackColor = &H80FFFF

End Sub

To LostFocus on Combo_Box :-

Private Sub Martial_LostFocus()

Martial.BackColor = vbWhite

End Sub

Hospital Management System Page 52

Page 53: Report On HMS

ARYABHATTA, AJMER

To GotFocus on Combo_Box :-

Private Sub MM_GotFocus()

MM.BackColor = &H80FFFF

End Sub

To LostFocus on Combo_Box :-

Private Sub MM_LostFocus()

MM.BackColor = vbWhite

End Sub

To GotFocus on Combo_Box :-

Private Sub Shift_GotFocus()

Shift.BackColor = &H80FFFF

End Sub

To LostFocus on Combo_Box :-

Private Sub Shift_LostFocus()

Shift.BackColor = vbWhite

End Sub

Procedure of Show:-

Private Sub SHOW_Click()

cnn.Execute (" insert into Add_New_Staff(S_id,S_Cate,S_Name,Sex,S_D,S_O,S_B,S_Contact,S_Address,Status,Shift,City,State) values(" & Text1.Text & ",'" & Staff.Text & "','" & Text5.Text & "','" & gender.Text & "'," & DD.Text & ",'" & MM.Text & "'," & YYYY.Text & "," & Text2.Text & ",'" & Text3.Text & "','" & Martial.Text & "','" & Shift.Text & "','" & Text4.Text & "','" & Text6.Text & "')")

Call clear_Staff

Call Unique

MsgBox "Record Successfully Added", vbDefaultButton3, "Add New Staff Member"

End Sub

Hospital Management System Page 53

Page 54: Report On HMS

ARYABHATTA, AJMER

To GotFocus on Combo_Box :-

Private Sub Staff_GotFocus()

Staff.BackColor = &H80FFFF

End Sub

To LostFocus on Combo_Box :-

Private Sub Staff_LostFocus()

Staff.BackColor = vbWhite

End Sub

To KeyPress on Text1 :-

Private Sub Text1_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

End Sub

To GotFocus onText2 :-

Private Sub Text2_GotFocus()

Text2.BackColor = &H80FFFF

End Sub

Hospital Management System Page 54

Page 55: Report On HMS

ARYABHATTA, AJMER

To KeyPress on Text2:-

Private Sub Text2_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

End Sub

To LostFocus onText2 :-

Private Sub Text2_LostFocus()

Text2.BackColor = vbWhite

End Sub

To GotFocus on Text3 :-

Private Sub Text3_GotFocus()

Text3.BackColor = &H80FFFF

End Sub

To KeyPress on Text3 :-

Private Sub Text3_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

Hospital Management System Page 55

Page 56: Report On HMS

ARYABHATTA, AJMER

KeyAscii = 0

Exit Sub

End If

End Sub

To LostFocus on Text3 :-

Private Sub Text3_LostFocus()

Text3.BackColor = vbWhite

End Sub

To GotFocus on Text4 :-

Private Sub Text4_GotFocus()

Text4.BackColor = &H80FFFF

End Sub

To KeyPress on Text4 :-

Private Sub Text4_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

To LostFocus on Text4 :-

Private Sub Text4_LostFocus()

Text4.BackColor = vbWhite

End Sub

Hospital Management System Page 56

Page 57: Report On HMS

ARYABHATTA, AJMER

To GotFocus on Text5 :-

Private Sub Text5_GotFocus()

Text5.BackColor = &H80FFFF

End Sub

To KeyPress on Text5 :-

Private Sub Text5_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

To LostFocus on Text5:-

Private Sub Text5_LostFocus()

Text5.BackColor = vbWhite

End Sub

To GotFocus on Text6:-

Private Sub Text6_GotFocus()

Text6.BackColor = &H80FFFF

End Sub

Hospital Management System Page 57

Page 58: Report On HMS

ARYABHATTA, AJMER

To KeyPress on Text6:-

Private Sub Text6_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

Procedure Of Clear_Staff_Feilds:-

Sub clear_Staff()

Text1.Text = " "

Text2.Text = " "

Text3.Text = " "

Text4.Text = " "

Text5.Text = " "

Text6.Text = " "

Shift.ListIndex = 0

Martial.ListIndex = 0

DD.ListIndex = 0

MM.ListIndex = 0

YYYY.ListIndex = 0

Staff.ListIndex = 0

gender.ListIndex = 0

End Sub

Hospital Management System Page 58

Page 59: Report On HMS

ARYABHATTA, AJMER

Procedure Of Unique:-

Private Sub Unique()

Dim id As New Recordset

id.Open "select * from Add_New_Staff order by S_id", cnn, adOpenDynamic, adLockOptimistic

If id.RecordCount = 0 Then

Text1.Text = 0

Else

id.MoveLast

Text1.Text = id.Fields("S_id").Value + 1

End If

id.close

End Sub

To LostFocus on Text6:-

Private Sub Text6_LostFocus()

Text6.BackColor = vbWhite

End Sub

To GotFocus on Combo_Box:-

Private Sub YYYY_GotFocus()

YYYY.BackColor = &H80FFFF

End Sub

To LostFocus on Combo_Box:-

Private Sub YYYY_LostFocus()

YYYY.BackColor = vbWhite

End Sub

Hospital Management System Page 59

Page 60: Report On HMS

ARYABHATTA, AJMER

Procedure Of Load:-

Sub load()

DD.ListIndex = 0

MM.ListIndex = 0

YYYY.ListIndex = 0

gender.ListIndex = 0

Shift.ListIndex = 0

Martial.ListIndex = 0

Staff.ListIndex = 0

End Sub

Hospital Management System Page 60

Page 61: Report On HMS

ARYABHATTA, AJMER

Search_Staff:-

To Click on Close_Button:-

Private Sub close_Click()

Call clear

Unload Me

End Sub

Hospital Management System Page 61

Page 62: Report On HMS

ARYABHATTA, AJMER

Form_Load:-

Private Sub Form_Load()

Call clear

Call all

Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2

Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2

End Sub

To Click on getreport_Button:-

Private Sub getreport_Click()

If DataEnvironment1.Connection1.State <> 0 Then

DataEnvironment1.Connection1.close

End If

DataEnvironment1.Connection1.Open

DataEnvironment1.Command4 lvs.SelectedItem.Text

StaffReport.SHOW

End Sub

To GotFocus on List_View:-

Private Sub lvs_GotFocus()

lvs.BackColor = &H80FFFF

getreport.Enabled = True

End Sub

To LostFocus on List_View:-

Private Sub lvs_LostFocus()

lvs.BackColor = vbWhite

End Sub

Hospital Management System Page 62

Page 63: Report On HMS

ARYABHATTA, AJMER

To Click on Option_Button:-

Private Sub Category_Click()

Frame2.Visible = True

Call loadcate

Label9.Visible = True

Staff.Visible = True

Label5.Visible = False

Staff_Name.Visible = False

End Sub

To Click on Option_Button:-

Private Sub sname_Click()

Label9.Visible = False

Staff.Visible = False

Label5.Visible = True

Staff_Name.Visible = True

Call loadstaffname

Frame2.Visible = True

Label5.Visible = True

Staff_Name.Visible = True

Label9.Visible = False

Staff.Visible = False

End Sub

To Click on combo_Box:-

Private Sub Staff_Click()

Call loadStaffCate

End Sub

Hospital Management System Page 63

Page 64: Report On HMS

ARYABHATTA, AJMER

To GotFocus on Combo_Box:-

Private Sub Staff_GotFocus()

Staff.BackColor = &H80FFFF

End Sub

To KeyPress on Combo_Box :-

Private Sub Staff_KeyDown(KeyCode As Integer, Shift As Integer)

Call loadStaffCate

End Sub

To KeyPress on Combo_Box:-

Private Sub Staff_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

End Sub

To LostFocus on Combo_Box:-

Private Sub Staff_LostFocus()

Call loadStaffCate

Staff.BackColor = vbWhite

End Sub

Hospital Management System Page 64

Page 65: Report On HMS

ARYABHATTA, AJMER

To GotFocus on Text1:-

Private Sub Text1_GotFocus()

Text1.BackColor = &H80FFFF

End Sub

To KeyPress on Text1:-

Private Sub Text1_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

End Sub

To LostFocus on Text1:-

Private Sub Text1_LostFocus()

Text1.BackColor = vbWhite

End Sub

To GotFocus on Text2:-

Private Sub Text2_GotFocus()

Text2.BackColor = &H80FFFF

End Sub

Hospital Management System Page 65

Page 66: Report On HMS

ARYABHATTA, AJMER

To KeyPress on Text2:-

Private Sub Text2_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

To LostFocus on Text2:-

Private Sub Text2_LostFocus()

Text2.BackColor = vbWhite

End Sub

Procedure Of Clear Fields:-

Sub clear()

Staff_Name.ListIndex = 0

Staff.ListIndex = 0

End Sub

Procedure Of Staff_Name:-

Private Sub Staff_Name_Click()

Call loadStaffData

End Sub

Hospital Management System Page 66

Page 67: Report On HMS

ARYABHATTA, AJMER

To GotFocus on Combo_Box:-

Private Sub Staff_Name_GotFocus()

Staff_Name.BackColor = &H80FFFF

End Sub

To KeyDown on Combo_Box:-

Private Sub Staff_Name_KeyDown(KeyCode As Integer, Shift As Integer)

Call loadStaffData

End Sub

To KeyPress on Combo_Box:-

Private Sub Staff_Name_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

To LostFocus on Combo_Box:-

Private Sub Staff_Name_LostFocus()

Staff_Name.BackColor = vbWhite

End Sub

Hospital Management System Page 67

Page 68: Report On HMS

ARYABHATTA, AJMER

Procedure of Load_Staff_Name:-

Sub loadstaffname()

Dim i%, rss As New Recordset

rss.Open "select * from Add_New_Staff ", cnn, adOpenKeyset, adLockReadOnly

For i = 0 To rss.RecordCount - 1

Staff_Name.AddItem (rss.Fields("S_Name").Value)

rss.MoveNext

Next

rss.close

End Sub

Procedure of Load_Staff_Data:-

Sub loadStaffData()

Dim l As ListItem, rss As New Recordset

rss.Open "select * from Add_New_Staff where S_Name like '" & Staff_Name.Text & "%'", cnn, adOpenKeyset, adLockReadOnly

lvs.ListItems.clear

If rss.RecordCount > 0 Then

rss.MoveFirst

While rss.EOF = False

Set l = lvs.ListItems.Add(, , rss.Fields("S_id").Value)

l.SubItems(1) = rss.Fields("S_Cate").Value

l.SubItems(2) = rss.Fields("S_Name").Value

l.SubItems(3) = rss.Fields("Sex").Value

l.SubItems(4) = rss.Fields("S_D").Value

l.SubItems(5) = rss.Fields("S_O").Value

l.SubItems(6) = rss.Fields("S_B").Value

l.SubItems(7) = rss.Fields("S_Contact").Value

Hospital Management System Page 68

Page 69: Report On HMS

ARYABHATTA, AJMER

l.SubItems(8) = rss.Fields("S_Address").Value

l.SubItems(9) = rss.Fields("Status").Value

l.SubItems(10) = rss.Fields("Shift").Value

l.SubItems(11) = rss.Fields("City").Value

l.SubItems(12) = rss.Fields("State").Value

rss.MoveNext

Wend

rss.close

End If

End Sub

Procedurem Of Load_Category:-

Sub loadcate()

Dim i%, rss As New Recordset

rss.Open "select * from Add_New_Staff", cnn, adOpenKeyset, adLockReadOnly

rss.MoveFirst

For i = 0 To rss.RecordCount - 1

Staff.AddItem (rss.Fields("S_Cate").Value)

rss.MoveNext

Next

rss.close

End Sub

Procedure Of Load_Staff_Category:-

Sub loadStaffCate()

Dim ls As ListItem, rss As New Recordset

rss.Open "select * from Add_New_Staff where S_Cate like '" & Staff.Text & "%'", cnn, adOpenKeyset, adLockReadOnly

lvs.ListItems.clear

Hospital Management System Page 69

Page 70: Report On HMS

ARYABHATTA, AJMER

If rss.RecordCount > 0 Then

rss.MoveFirst

While rss.EOF = False

Set ls = lvs.ListItems.Add(, , rss.Fields("S_id").Value)

ls.SubItems(1) = rss.Fields("S_Cate").Value

ls.SubItems(2) = rss.Fields("S_Name").Value

ls.SubItems(3) = rss.Fields("Sex").Value

ls.SubItems(4) = rss.Fields("S_D").Value

ls.SubItems(5) = rss.Fields("S_O").Value

ls.SubItems(6) = rss.Fields("S_B").Value

ls.SubItems(7) = rss.Fields("S_Contact").Value

ls.SubItems(8) = rss.Fields("S_Address").Value

ls.SubItems(9) = rss.Fields("Status").Value

ls.SubItems(8) = rss.Fields("Shift").Value

ls.SubItems(9) = rss.Fields("City").Value

ls.SubItems(8) = rss.Fields("State").Value

rss.MoveNext

Wend

rss.close

End If

End Sub

Procedure Of Clear Fields:-

Sub all()

sname.Value = 0

Category.Value = 0

Staff_Name.ListIndex = 0

Staff.ListIndex = 0

Hospital Management System Page 70

Page 71: Report On HMS

ARYABHATTA, AJMER

Label5.Visible = False

Label9.Visible = False

Staff_Name.Visible = False

Staff.Visible = False

Frame2.Visible = False

End Sub

Hospital Management System Page 71

Page 72: Report On HMS

ARYABHATTA, AJMER

Outer_Patient:-

To Click onCancel_Button:-

Private Sub CANCEL_Click()

Unload Me

End Sub

To GotFocus on Combo_Box:-

Private Sub Doctor_GotFocus()

Doctor.BackColor = &H80FFFF

End Sub

Hospital Management System Page 72

Page 73: Report On HMS

ARYABHATTA, AJMER

To LostFocus on Combo_Box:-

Private Sub Doctor_LostFocus()

Doctor.BackColor = vbWhite

End Sub

To GotFocus on Dtpicker:-

Private Sub DTPicker1_GotFocus()

DTPicker1.CalendarBackColor = &H80FFFF

End Sub

To LostFocus on Dtpicker:-

Private Sub DTPicker1_LostFocus()

DTPicker1.CalendarBackColor = vbWhite

End Sub

Private Sub DTPicker2_GotFocus()

DTPicker2.CalendarBackColor = &H80FFFF

End Sub

Private Sub DTPicker2_LostFocus()

DTPicker2.CalendarBackColor = vbWhite

End Sub

Form_Load:-

Private Sub Form_Load()

Call loadDoctorName

Call Outer

Doctor.ListIndex = 0

Text2.BackColor = &H80FFFF

Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2

Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2

Hospital Management System Page 73

Page 74: Report On HMS

ARYABHATTA, AJMER

DTPicker1.Value = Date

DTPicker2.Value = Time

End Sub

To Click on Ok_Button:-

Private Sub OK_Click()

cnn.Execute "insert into Outer_Patient(Ref_No,Op_Name,Dr_Preffered,Contact_No,Address,Ap_Datedd,Ap_Timett,Fees)Values(" & Text1.Text & ",'" & Text2.Text & "','" & Doctor.Text & "'," & Text5.Text & ",'" & Text6.Text & "','" & DTPicker1.Value & "','" & DTPicker2.Value & "'," & Text4.Text & ")"

Call clear_Outer_Patient

Call Outer

End Sub

To KeyPress on Text1:-

Private Sub Text1_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

End Sub

To GotFocus on Text2:-

Private Sub Text2_GotFocus()

Text2.BackColor = &H80FFFF

Hospital Management System Page 74

Page 75: Report On HMS

ARYABHATTA, AJMER

End Sub

To KeyPress on Text2:-

Private Sub Text2_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

To LostFocus on Text2:-

Private Sub Text2_LostFocus()

Text2.BackColor = vbWhite

End Sub

To GotFocus on Text3:-

Private Sub Text3_GotFocus()

Text3.BackColor = &H80FFFF

End Sub

To KeyPress on Text3:-

Private Sub Text3_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Hospital Management System Page 75

Page 76: Report On HMS

ARYABHATTA, AJMER

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

To LostFocus on Text3:-

Private Sub Text3_LostFocus()

Text3.BackColor = vbWhite

End Sub

To GotFocus on Text4:-

Private Sub Text4_GotFocus()

Text4.BackColor = &H80FFFF

End Sub

To KeyPress on Text4:-

Private Sub Text4_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

End Sub

Hospital Management System Page 76

Page 77: Report On HMS

ARYABHATTA, AJMER

Procedure Of Clear_Outer_Patient:-

Sub clear_Outer_Patient()

Text1.Text = " "

Text2.Text = " "

Doctor.ListIndex = 0

Text4.Text = " "

Text5.Text = ""

Text6.Text = ""

Doctor.ListIndex = 0

End Sub

Sub Outer()

Dim Ref As New Recordset

Ref.Open "select * from Outer_Patient order by Ref_no", cnn, adOpenDynamic, adLockOptimistic

If Ref.RecordCount = 0 Then

Text1.Text = 1

Else

Ref.MoveLast

Text1.Text = Ref.Fields("Ref_no").Value + 1

End If

Ref.close

End Sub

To LostFocus on Text4:-

Private Sub Text4_LostFocus()

Text4.BackColor = vbWhite

End Sub

Hospital Management System Page 77

Page 78: Report On HMS

ARYABHATTA, AJMER

To GotFocus on Text5:-

Private Sub Text5_GotFocus()

Text5.BackColor = &H80FFFF

End Sub

To KeyPress on Text5:-

Private Sub Text5_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

End Sub

To LostFocus on Text5:-

Private Sub Text5_LostFocus()

Text5.BackColor = vbWhite

End Sub

To GotFocus on Text6:-

Private Sub Text6_GotFocus()

Text6.BackColor = &H80FFFF

End Sub

Hospital Management System Page 78

Page 79: Report On HMS

ARYABHATTA, AJMER

To LostFocus on Text6:-

Private Sub Text6_LostFocus()

Text6.BackColor = vbWhite

End Sub

Procedure Of Load_Doctor_Name:-

Sub loadDoctorName()

Dim i%, rss As New Recordset

rss.Open "select * from New_Doctor ", cnn, adOpenKeyset, adLockReadOnly

For i = 0 To rss.RecordCount - 1

Doctor.AddItem (rss.Fields("D_Name").Value)

rss.MoveNext

Next

rss.close

End Sub

Hospital Management System Page 79

Page 80: Report On HMS

ARYABHATTA, AJMER

Lab_test:-

General:-

Dim flag%

To GotFocus on Text_Box:-

Private Sub Age_GotFocus()

Age.BackColor = &H80FFFF

End Sub

To LostFocus on Text_Box:-

Private Sub Age_LostFocus()

Age.BackColor = vbWhite

End Sub

Hospital Management System Page 80

Page 81: Report On HMS

ARYABHATTA, AJMER

To Click on Cancel_Button:-

Private Sub CANCEL_Click()

Unload Me

End Sub

To GotFocus on DTPicker:-

Private Sub DTP1_GotFocus()

DTP1.CalendarBackColor = &H80FFFF

End Sub

To LostFocus on DTPicker:-

Private Sub DTP1_LostFocus()

DTP1.CalendarBackColor = vbWhite

End Sub

Form_Load:-

Private Sub Form_Load()

Gender.ListIndex = 0

Test_Name.ListIndex = 0

Call TestName

Call Unique

Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2

Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2

End Sub

To GotFocus on Combo_Box:-

Private Sub Gender_GotFocus()

Gender.BackColor = &H80FFFF

End Sub

Hospital Management System Page 81

Page 82: Report On HMS

ARYABHATTA, AJMER

To LostFocus on Combo_Box:-

Private Sub Gender_LostFocus()

Gender.BackColor = vbWhite

End Sub

To Click on getreport_Button:-

Private Sub getreport_Click()

If lvt.ListItems.Count = 0 Then

Exit Sub

End If

If DataEnvironment2.Connection1.State <> 0 Then

DataEnvironment2.Connection1.close

End If

DataEnvironment2.Connection1.Open

DataEnvironment2.Lab_Test lvt.SelectedItem.Text

Lab_Test.SHOW

End Sub

To Click on OK_Button:-

Private Sub OK_Click()

On Error Resume Next

Call check

If flag = 1 Then

flag = 0

Exit Sub

End If

cnn.Execute ("insert into Lab_Test(Ref_No,Refer,P_Name,Gender,Age,Address,Lab_Test,Contact_No,DDD) values(" & Text1.Text & ",'" & Text2.Text & "','" & Text6.Text & "','" & Gender.Text &

Hospital Management System Page 82

Page 83: Report On HMS

ARYABHATTA, AJMER

"'," & Text5.Text & ",'" & Text4.Text & "','" & Test_Name.Text & "'," & Text3.Text & ",'" & DTP1.Value & "')")

MsgBox "Save Recode", vbDefaultButton1, "Lab_Test_Form"

Call clear_Lab_Test

Call Unique

End Sub

To GotFocus on Combo_Box:-

Private Sub Test_Name_GotFocus()

Test_Name.BackColor = &H80FFFF

End Sub

To LostFocus on Combo_Box:-

Private Sub Test_Name_LostFocus()

Test_Name.BackColor = vbWhite

End Sub

To GotFocus on Text2:-

Private Sub Text2_GotFocus()

Text2.BackColor = &H80FFFF

End Sub

To KeyPress on Text2:-

Private Sub Text2_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

Hospital Management System Page 83

Page 84: Report On HMS

ARYABHATTA, AJMER

End If

End Sub

To LostFocus on Text2:-

Private Sub Text2_LostFocus()

Text2.BackColor = vbWhite

End Sub

To GotFocus on Text3:-

Private Sub Text3_GotFocus()

Text3.BackColor = &H80FFFF

End Sub

To KeyPress on Text3:-

Private Sub Text3_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

End Sub

To LostFocus on Text3:-

Private Sub Text3_LostFocus()

Text3.BackColor = vbWhite

End Sub

Hospital Management System Page 84

Page 85: Report On HMS

ARYABHATTA, AJMER

To GotFocus on Text4:-

Private Sub Text4_GotFocus()

Text4.BackColor = &H80FFFF

End Sub

To KeyPress on Text4:-

Private Sub Text4_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

To LostFocus on Text4:-

Private Sub Text4_LostFocus()

Text4.BackColor = vbWhite

End Sub

To GotFocus on Text5:-

Private Sub Text5_GotFocus()

Text5.BackColor = &H80FFFF

End Sub

To KeyPress on Text5:-

Private Sub Text5_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Hospital Management System Page 85

Page 86: Report On HMS

ARYABHATTA, AJMER

Exit Sub

Else

KeyAscii = 0

End If

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

End Sub

To LostFocus on Text5:-

Private Sub Text5_LostFocus()

Text5.BackColor = vbWhite

End Sub

To GotFocus on Text6:-

Private Sub Text6_GotFocus()

Text6.BackColor = &H80FFFF

End Sub

To KeyPress on Text6:-

Private Sub Text6_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

Hospital Management System Page 86

Page 87: Report On HMS

ARYABHATTA, AJMER

To LostFocus on Text6:-

Private Sub Text6_LostFocus()

Text6.BackColor = vbWhite

End Sub

Procedure Of Clear_Lab_Test Fields:-

Sub clear_Lab_Test()

Text2.Text = " "

Text4.Text = " "

Text6.Text = " "

Text3.Text = " "

Text5.Text = " "

Gender.ListIndex = 0

Test_Name.ListIndex = 0

Text2.SetFocus

End Sub

Proceduren Of Unique:-

Sub Unique()

Dim lt As New Recordset

lt.Open "select * from Lab_Test order by Ref_No", cnn, adOpenDynamic, adLockOptimistic

If lt.RecordCount = 0 Then

Text1.Text = 1

Else

lt.MoveLast

Text1.Text = lt.Fields("Ref_No").Value + 1

End If

lt.close

Hospital Management System Page 87

Page 88: Report On HMS

ARYABHATTA, AJMER

End Sub

Procedure Of Check:-

Sub check()

If Trim(Text2) = "" Then

MsgBox "Lab_Test Health Center Field Can't be Blank", vbOKOnly + vbCritical, "Error Show"

Text2.SetFocus

flag = 1

Exit Sub

End If

If Trim(Text6) = "" Then

MsgBox "Lab_Test Patient Name Can't be Blank", vbOKOnly + vbCritical, "Error Show"

Text6.SetFocus

flag = 1

Exit Sub

End If

If Trim(Text5) = "" Then

MsgBox "Lab_Test Age Can't be Blank", vbOKOnly + vbCritical, "Error Show"

Text5.SetFocus

flag = 1

Exit Sub

End If

If Trim(Text4) = "" Then

MsgBox "Lab_Test Address Can't be Blank", vbOKOnly + vbCritical, "Error Show"

Text4.SetFocus

flag = 1

Hospital Management System Page 88

Page 89: Report On HMS

ARYABHATTA, AJMER

Exit Sub

End If

If Trim(Text3) = "" Then

MsgBox "Lab_Test Contact_No Can't be Blank", vbOKOnly + vbCritical, "Error Show"

Text3.SetFocus

flag = 1

Exit Sub

End If

End Sub

Procedure Of Test_Name:-

Sub TestName()

Dim l As ListItem, rss As New Recordset

rss.Open "select * from Lab_Test where Ref_No like '" & Text1.Text & "%'", cnn, adOpenKeyset, adLockReadOnly

lvt.ListItems.clear

If rss.RecordCount > 0 Then

rss.MoveFirst

While rss.EOF = False

Set l = lvt.ListItems.Add(, , rss.Fields("Ref_No").Value)

l.SubItems(1) = rss.Fields("Refer").Value

l.SubItems(2) = rss.Fields("P_Name").Value

l.SubItems(3) = rss.Fields("Gender").Value

l.SubItems(4) = rss.Fields("Age").Value

l.SubItems(5) = rss.Fields("Address").Value

l.SubItems(6) = rss.Fields("Lab_Test").Value

l.SubItems(7) = rss.Fields("Contact_No").Value

l.SubItems(8) = rss.Fields("DDD").Value

Hospital Management System Page 89

Page 90: Report On HMS

ARYABHATTA, AJMER

rss.MoveNext

Wend

rss.close

End If

End Sub

Hospital Management System Page 90

Page 91: Report On HMS

ARYABHATTA, AJMER

Discharge_form:-

To Click on Dtpicker:-

Private Sub admit_Click()

admit.CalendarBackColor = &H80FFFF

End Sub

To GotFocus on Dtpicker:-

Private Sub admit_GotFocus()

admit.CalendarBackColor = &H80FFFF

End Sub

Hospital Management System Page 91

Page 92: Report On HMS

ARYABHATTA, AJMER

To LostFocus on Dtpicker :-

Private Sub admit_LostFocus()

admit.CalendarBackColor = vbWhite

End Sub

To GotFocus on Text_Box:-

Private Sub Bno_GotFocus()

Bno.BackColor = &H80FFFF

End Sub

To LostFocus on Text_Box:-

Private Sub Bno_LostFocus()

Bno.BackColor = vbWhite

End Sub

To Click on Dtpicker:-

Private Sub DOD_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)

DOD.CalendarBackColor = &H80FFFF

End Sub

To Click on Dtpicker:-

Private Sub DOD_Click()

DOD.CalendarBackColor = &H80FFFF

End Sub

To GotFocus on Dtpciker:-

Private Sub DOD_GotFocus()

DOD.CalendarBackColor = &H80FFFF

End Sub

Hospital Management System Page 92

Page 93: Report On HMS

ARYABHATTA, AJMER

To LostFocus on Dtpicker:-

Private Sub DOD_LostFocus()

DOD.CalendarBackColor = vbWhite

End Sub

To Click on Exit_Button:-

Private Sub exit_Click()

Unload Me

End Sub

To GotFocus on Text_Box:-

Private Sub FatherName_GotFocus()

FatherName.BackColor = &H80FFFF

End Sub

To LostFocus on Text_Box:-

Private Sub FatherName_LostFocus()

FatherName.BackColor = vbWhite

End Sub

Form_Load:-

Private Sub Form_Load()

Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2

Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2

End Sub

To GotFocus on Combo_Box:-

Private Sub Gender_GotFocus()

gender.BackColor = &H80FFFF

End Sub

Hospital Management System Page 93

Page 94: Report On HMS

ARYABHATTA, AJMER

To LostFocus on Combo_Box:-

Private Sub Gender_LostFocus()

gender.BackColor = vbWhite

End Sub

To GotFocus on Text_Box:-

Private Sub Rno_GotFocus()

Rno.BackColor = &H80FFFF

End Sub

To LostFocus on Text_Box:-

Private Sub Rno_LostFocus()

Rno.BackColor = vbWhite

End Sub

To Click on Save_Button:-

Private Sub save_Click()

cnn.Execute ("insert into Discharge_Form(P_id,P_Name,F_Name,Gender,Age,Dr_Preffered,Address,Contact_No,Body_Sign,Admit_DD,D_O_D,RNO,BNO,X_Ray,US,ECG,BT,CT,BS,Result,Total_Amount)values(" & Text1.Text & ",'" & txtpn.Text & "','" & FatherName.Text & "','" & gender.Text & "'," & Text2.Text & ",'" & txtdct.Text & "','" & Text5.Text & "'," & Text6.Text & ",'" & Text7.Text & "','" & admit.Value & "','" & DOD.Value & "'," & Rno.Text & "," & Bno.Text & ",'" & xray.Value & "','" & ultrasound.Value & "','" & ecg.Value & "','" & bloodtest.Value & "','" & ctscane.Value & "','" & bloodsugar.Value & "','" & Text9.Text & "'," & Text10.Text & ")")

MsgBox "Record Successsfully Added", vbDefaultButton1, "Discharge Successfully"

Call clear

End Sub

Hospital Management System Page 94

Page 95: Report On HMS

ARYABHATTA, AJMER

To GotFocus on Text1:-

Private Sub Text1_GotFocus()

Text1.BackColor = &H80FFFF

End Sub

To KeyPress on Text1:-

Private Sub Text1_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

End Sub

To LostFocus on Text1:-

Private Sub Text1_LostFocus()

Text1.BackColor = vbWhite

End Sub

To GotFocus on Text10:-

Private Sub Text10_GotFocus()

Text10.BackColor = &H80FFFF

End Sub

Hospital Management System Page 95

Page 96: Report On HMS

ARYABHATTA, AJMER

To KeyPress on Text10:-

Private Sub Text10_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

End Sub

To KeyPress on Text3:-

Private Sub Text3_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

Hospital Management System Page 96

Page 97: Report On HMS

ARYABHATTA, AJMER

To KeyPress on Text4:-

Private Sub Text4_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

End Sub

To LostFocus on Text10:-

Private Sub Text10_LostFocus()

Text10.BackColor = vbWhite

End Sub

To GotFocus on Text2:-

Private Sub Text2_GotFocus()

Text2.BackColor = &H80FFFF

End Sub

To LostFocus on Text2:-

Private Sub Text2_LostFocus()

Text2.BackColor = vbWhite

End Sub

Hospital Management System Page 97

Page 98: Report On HMS

ARYABHATTA, AJMER

To GotFocus on Text5:-

Private Sub Text5_GotFocus()

Text5.BackColor = &H80FFFF

End Sub

To LostFocus on Text5:-

Private Sub Text5_LostFocus()

Text5.BackColor = vbWhite

End Sub

To GotFocus on Text6:-

Private Sub Text6_GotFocus()

Text6.BackColor = &H80FFFF

End Sub

To KeyPress on Text6:-

Private Sub Text6_KeyPress(KeyAscii As Integer)

If (KeyAscii >= 48) And (KeyAscii <= 57) Or (KeyAscii = 46) Or (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

Else

KeyAscii = 0

End If

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

End Sub

Hospital Management System Page 98

Page 99: Report On HMS

ARYABHATTA, AJMER

To LostFocus on Text6:-

Private Sub Text6_LostFocus()

Text6.BackColor = vbWhite

End Sub

To GotFocus on Text7:-

Private Sub Text7_GotFocus()

Text7.BackColor = &H80FFFF

End Sub

To KeyPress on Text7:-

Private Sub Text7_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

To LostFocus on Text7:-

Private Sub Text7_LostFocus()

Text7.BackColor = vbWhite

End Sub

To GotFocus on Text9:-

Private Sub Text9_GotFocus()

Text9.BackColor = &H80FFFF

End Sub

Hospital Management System Page 99

Page 100: Report On HMS

ARYABHATTA, AJMER

To KeyPress on Text9:-

Private Sub Text9_KeyPress(KeyAscii As Integer)

If (KeyAscii = 8) Or (KeyAscii = 32) Then

Exit Sub

End If

If Not (((KeyAscii >= 65) And (KeyAscii <= 90) Or (KeyAscii >= 97) And (KeyAscii <= 122))) Then

KeyAscii = 0

Exit Sub

End If

End Sub

Procedure Of list :-

Sub list()

admit.Value = Date

txtpn.Text = ""

txtdct.Text = ""

gender.Text = ""

Rno.Text = ""

Bno.Text = ""

End Sub

Procedure Of Load_Patient_Name:-

Sub loadpatientName()

Dim i%, rss As New Recordset

rss.Open "select * from Patient_Registration ", cnn, adOpenKeyset, adLockReadOnly

For i = 0 To rss.RecordCount - 1

PName.AddItem (rss.Fields("P_Name").Value)

rss.MoveNext

Hospital Management System Page 100

Page 101: Report On HMS

ARYABHATTA, AJMER

Next

rss.close

End Sub

Procedure Of Unique:-

Private Sub Unique()

Dim p As New Recordset

p.Open "select * from Discharge order by P_id", cnn, adOpenDynamic, adLockOptimistic

If p.RecordCount = 0 Then

Text1.Text = 0

Else

p.MoveLast

Text1.Text = p.Fields("P_id").Value + 1

End If

p.close

End Sub

Procedure Of Clear Fields:-

Sub clear()

Text1.Text = ""

txtpn.Text = ""

txtdct.Text = ""

FatherName.Text = ""

Text2.Text = ""

Text5.Text = ""

Text6.Text = ""

Text7.Text = ""

gender.Text = ""

Hospital Management System Page 101

Page 102: Report On HMS

ARYABHATTA, AJMER

Rno.Text = ""

Bno.Text = ""

Text9.Text = ""

Text10.Text = ""

xray.Value = 0

ultrasound.Value = 0

ecg.Value = 0

ctscane.Value = 0

bloodtest.Value = 0

bloodsugar.Value = 0

End Sub

To LostFocus on Text9:-

Private Sub Text9_LostFocus()

Text9.BackColor = vbWhite

End Sub

To GotFocus on Txtdct:-

Private Sub txtdct_GotFocus()

txtdct.BackColor = &H80FFFF

End Sub

To LostFocus on Txtdct:-

Private Sub txtdct_LostFocus()

txtdct.BackColor = vbWhite

End Sub

To GotFocus on Txtpn:-

Private Sub txtpn_GotFocus()

txtpn.BackColor = &H80FFFF

Hospital Management System Page 102

Page 103: Report On HMS

ARYABHATTA, AJMER

End Sub

To LostFocus on Txtpn:-

Private Sub txtpn_LostFocus()

txtpn.BackColor = vbWhite

End Sub

Hospital Management System Page 103

Page 104: Report On HMS

ARYABHATTA, AJMER

Reports Of HMS

Patient_Reports:-

To Click On GetReport_Button :-

private Sub report_Click()

If lv.ListItems.Count = 0 Then

Exit Sub

End If

If DataEnvironment1.Connection1.State <> 0 Then

DataEnvironment1.Connection1.closeEnd If

DataEnvironment1.Connection1.OpenDataEnvironment1.Command3 lv.SelectedItem.TextPatient_Reports.SHOW

End Sub

Hospital Management System Page 104

Page 105: Report On HMS

ARYABHATTA, AJMER

Outer_Patient_Reports:-

To Click On GetReport_Button:-

Private Sub report_Click()

If lop.ListItems.Count = 0 Then

Exit Sub

End If

If DataEnvironment2.Connection1.State <> 0 Then

DataEnvironment2.Connection1.close

End If

DataEnvironment2.Connection1.Open

DataEnvironment2.Outer lop.SelectedItem.Text

Outer_Report.SHOW

End Sub

Hospital Management System Page 105

Page 106: Report On HMS

ARYABHATTA, AJMER

Doctor_Reports:-

To Click on GetReport_Button:-Private Sub getreport_Click()If DataEnvironment1.Connection1.State <> 0 Then

DataEnvironment1.Connection1.closeEnd If

DataEnvironment1.Connection1.OpenDataEnvironment1.Command1 lvd.SelectedItem.TextDoctorReports.SHOW

End Sub

Staff_Reports:-

Hospital Management System Page 106

Page 107: Report On HMS

ARYABHATTA, AJMER

To Click on GetReport_Button:-

Private Sub getreport_Click()

If DataEnvironment1.Connection1.State <> 0 Then

DataEnvironment1.Connection1.close

End If

DataEnvironment1.Connection1.Open

DataEnvironment1.Command4 lvs.SelectedItem.Text

StaffReport.SHOW

End Sub

Lab_Test_Reports:-

To Click on GetReport_Button:-Private Sub getreport_Click()

If lvt.ListItems.Count = 0 Then

Exit Sub

End If

If DataEnvironment2.Connection1.State <> 0 Then

DataEnvironment2.Connection1.close

End If

Hospital Management System Page 107

Page 108: Report On HMS

ARYABHATTA, AJMER

DataEnvironment2.Connection1.Open

DataEnvironment2.Lab_Test lvt.SelectedItem.Text

Lab_Test.SHOW

End Sub

Dishcarge_Patient_Reports:-

To Click on GetReport_Button:-Private Sub getreport_Click()

If lvpd.ListItems.Count = 0 ThenExit Sub

End IfIf DataEnvironment1.Connection1.State <> 0 Then

DataEnvironment1.Connection1.closeEnd If

DataEnvironment1.Connection1.OpenDataEnvironment1.Command6 lvpd.SelectedItem.TextDischargeReports.SHOW

End Sub

Hospital Management System Page 108

Page 109: Report On HMS

ARYABHATTA, AJMER

Data_Base_Tables

1. Login Table:-

Field Name Data type LengthUser_Name Text 255

Password Text 255

Hospital Management System Page 109

Page 110: Report On HMS

ARYABHATTA, AJMER

2. Patient_Registration_Table:-

Field Name Da ta type LengthReg_No (Primary Key) Number Long IntegerPatient_Name TTextText 2255 NumberAge Number Long IntegerGender Text 255Father_Name Text 255Dr_Preffered Text 255Address Text 255Contact_No Memo 1000Body_Sign Text 255Admit_Date Text 255Room_No Number Long IntegerBed_No Number Long IntegerX_Ray Text 255Ultra_Sound Text 255ECG Text 255Blood_Test Text 255CT_Scane Text 255Blood_Sugar Text 255

3. Patient Details (Search_Patient) Table:-

Hospital Management System Page 110

Page 111: Report On HMS

ARYABHATTA, AJMER

Field Name Da ta type LengthName Text 255Admit_Date Text 255Patient_Name Text 255Admit_Date Text 255LV Text 255

4. Doctor Table:-

Field Name Da ta type LengthDoctor_Id(Primary Key) Number Long IntegerDoctor_Name Text 255Gender Text 255Dept_Name Text 255Specialization Text 255Contact_No Memo 1000

5. Search Doctor Tables:- Field Name Da ta type Length

Name Text Long IntegerDept_Name Text 255Doctor_Name Text 255Dept_Name Text 255LVD Text 255

6. Staff Tables:-

Hospital Management System Page 111

Page 112: Report On HMS

ARYABHATTA, AJMER

Field Name Da ta type LengthStaff_Id (Primary Key) Number Long IntegerStaff_Category Text 255Staff_Name Text 255Sex Text 255DD Text 255MM Text 255YYYY Number Long IntegerContact_No Memo 1000Address Text 255Status Text 255Work_Time Text 255City Text 255State Text 255

7. Staff Search Tables:-

Field Name Da ta type LengthName Text 255Category Text 255Staff_Name Text 255Staff_Category Text 255

Hospital Management System Page 112

Page 113: Report On HMS

ARYABHATTA, AJMER

LVS Text 255

8. Outer Patient Tables:-

Field Name Da ta type LengthRef_No (Primary Key) Number :Long IntegerPatient_Name Text 255Dr_Preffered Text 255Room_No Number Long IntegerContact_No Memo 1000Address Text 255App_Date Text 255App_Time Text 255Fees Number Long Integer

9. Laboratory Test Tables:-

Hospital Management System Page 113

Page 114: Report On HMS

ARYABHATTA, AJMER

Field Name Da ta type LengthRef_No(Primary Key) Number Long IntegerHealth_Center Text 255Patient_Name Text 255Sex Text 255Age Number Long IntegerAddress Text 255Lab_Test_Name Text 255Contact_No Memo 1000Date Text 255LVT Text 255

10. Discharge Patient Tables:-

Hospital Management System Page 114

Page 115: Report On HMS

ARYABHATTA, AJMER

Field Name Da ta type LengthRef_No Number Long IntegerPatient_Name Text 255Father_Name Text 255Gender Text 255Age Number Long IntegerDr_Preffered Text 255Address Text 255Contact_No Memo 1000Body_Sign Text 255Admit_Date Text 255Discharge_Date Text 255Room_No Number Long IntegerBed_No Number Long InetgerX_Ray Text 255Ultra_Sound Text 255ECG Text 255Blood_Test Text 255CT_Scane Text 255Blood_Sugar Text 255Result Text 255Total_Amount Number Long Integer

Data Base In MS AccessCreating a Report using the Access Report Wizard

Hospital Management System Page 115

Page 116: Report On HMS

ARYABHATTA, AJMER

Microsoft Access provides many built-in wizards which allow one to create database objects, such as reports, quickly and easily. The following steps demonstrate the process of creating a very simple report.

1. Choose the Reports Menu: Once a database is opened, the main database menu as shown below is displayed. Click on the "Reports" selection and a list of the various reports Microsoft included in the sample database is displayed. Double-click on a few of these and get a feel for what reports look like and the various types of information that they contain.

2. Create a new Report: Click on the “New” button and the process of creating a report scratch will start.

3. Select the Report Wizard: The next screen that appears will require the selection of the method to be used to create the report. Select the Report Wizard, which will help through the creation process step-by-step.

4. Choose a Table or query: Choose the source of data for the report. If the information is to be retrieved from a single table, select it from the drop-down box below. Alternatively, for more complex reports, the report can be based on the output of a query previously designed. For example, all of the data we need is contained within the Employees table, so choose this table and click on OK.

Data Base Designed In Access

Hospital Management System Page 116

Page 117: Report On HMS

ARYABHATTA, AJMER

All The Tables Create in Access:-

A. Login.B. Patient_Registration.C Outer_Patient. D Add_New_Doctor.E. Add_New_Staff.F. Laboratory Test.G. Discharge_Patient.

A. Login:-

Hospital Management System Page 117

Page 118: Report On HMS

ARYABHATTA, AJMER

B. Patient_Registration:-

To Save Data In Ms_Access:-

Hospital Management System Page 118

Page 119: Report On HMS

ARYABHATTA, AJMER

cnn.Execute " insert into Patient_Registration(Reg_No,P_Name,Age,Gender,F_Name,Dr_Preffered,Address,Contact_No,Body_Sign,Admit_DD,R_No,B_No,X_Ray,Ultra_Sound,ECG,Blood_Test,CT_Scane,Blood_Sugar)values(" & Text1.Text & ",'" & Text2.Text & "'," & Text3.Text & ",'" & Gender.Text & "','" & Text8.Text & "','" & Doctor.Text & "','" & Text5.Text & "'," & Text6.Text & ",'" & Text7.Text & "','" & DTPicker1.Value & "'," & RNO.Text & "," & BNO.Text & ",'" & xray.Value & "','" & ultrasound.Value & "','" & ecg.Value & "','" & bloodtest.Value & "','" & ctscane.Value & "','" & bloodsugar.Value & "') "

To Show Save_Message:-

MsgBox "Record Successfully Added", vbDefaultButton1, "Patient_Registration_Form"

C. Outer_Patient:-

To Save Data In Ms_Access:-cnn.Execute ("insert into Out_Patient(Ref_No,P_Name,Dr_Preffered,R_NO,Contact_No,Address,Ap_Datedd,Ap_Timett,Fees)Values(" & Text1.Text & ",'" & Text2.Text & "','" & Doctor.Text & "'," & Text3.Text & "," & Text5.Text & ",'" & Text6.Text & "','" & DTPicker1.Value & "','" & DTPicker2.Value & "'," & Text4.Text & ")")

To Show Save_Message:-

MsgBox "Save Record", vbDefaultButton1, "Outer_Patient"

D. Add_New_Doctor:-

Hospital Management System Page 119

Page 120: Report On HMS

ARYABHATTA, AJMER

To Save Data In Ms_Access:-

cnn.Execute ("insert into Add_Doctor(D_id,D_Name,Gender,Dept_Name,specialization,Contact_No) values(" & Text1.Text & ",'" & Text2.Text & "','" & Gender.Text & "','" & Text3.Text & "','" & specialization.Text & "'," & Text6.Text & ")")

To Show Save_Message:-

MsgBox "Record Successfully Added", vbDefaultButton2, "Add_New_Doctor"

E. Add_New_Staff:-

To Save Data In Ms_Access:-

Hospital Management System Page 120

Page 121: Report On HMS

ARYABHATTA, AJMER

cnn.Execute (" insert into Add_New_Staff(S_id,S_Cate,S_Name,Sex,S_D,S_O,S_B,S_Contact,S_Address,Status,Shift,City,State) values(" & Text1.Text & ",'" & Staff.Text & "','" & Text5.Text & "','" & Gender.Text & "'," & DD.Text & ",'" & MM.Text & "'," & YYYY.Text & "," & Text2.Text & ",'" & Text3.Text & "','" & Martial.Text & "','" & Shift.Text & "','" & Text4.Text & "','" & Text6.Text & "')")

To ShowSave Message:-

MsgBox "Record Successfully Added", vbDefaultButton3, "Add New Staff Member"

F. Lob_Test:

To Save Data In Ms_Access:-

cnn.Execute ("insert into Lab_Test(Ref_No,Refer,P_Name,Gender,Age,Address,Lab_Test,Contact_No,DDD) values(" & Text1.Text & ",'" & Text2.Text & "','" & Text6.Text & "','" & Gender.Text & "'," & Text5.Text & ",'" & Text4.Text & "','" & Test_Name.Text & "'," & Text3.Text & ",'" & DTP1.Value & "')")

To Show Save Message:-

MsgBox "Save Recode", vbDefaultButton1, "Lab_Test_Form"

G.Discharge_Patient:-

Hospital Management System Page 121

Page 122: Report On HMS

ARYABHATTA, AJMER

To Save Data In Ms_Access:-

cnn.Execute ("insert into Discharge_Patient(P_id,P_Name,F_Name,Gender,Age,Dr_Preffered,Address,Contact_No,Body_Sign,Admit_DD,D_O_D,R_No,B_No,XR,US,ECG,BT,CT,BS,Result,Total_Amount)values(" & Text1.Text & ",'" & txtpn.Text & "','" & FatherName.Text & "','" & txtgen.Text & "'," & Text2.Text & ",'" & txtdct.Text & "','" & Text5.Text & "'," & Text6.Text & ",'" & Text7.Text & "','" & admit.Value & "','" & DOD.Value & "'," & Rno.Text & "," & Bno.Text & ",'" & xray.Value & "','" & ultrasound.Value & "','" & ecg.Value & "','" & bloodtest.Value & "','" & ctscane.Value & "','" & bloodsugar.Value & "','" & Text9.Text & "'," & Text10.Text & ")")

To Show Save Message:-

MsgBox "Record Successsfully Added first", vbDefaultButton1, "Discharge Successfully"

2.Conclusion

The project Hospital Management System (HMS) is for computerizing the working in a hospital. The software takes care of all the requirements of an average hospital and is capable to provide easy and effective storage of information related to patients that come up to the hospital.

It generates test reports; provide prescription details including various tests. It also provides billing facility on the basis of patient’s status whether it is an indoor or outdoor patient. The system also provides the facility of backup as per the requirement.

4. Bibliography

Hospital Management System Page 122

Page 123: Report On HMS

ARYABHATTA, AJMER

1. Mastering VB 6.02. SMS hospital.3. SateLite hospital Ajmer.

Hospital Management System Page 123