Вы находитесь на странице: 1из 14

Hospital Case (Part 2)

Objective: To be able to create a program that will be able to help hospital personnel manage the activities in the hospital. The program should
be able to manage items, business partners, doctors, procedures, and patients. For Part 2, we have the following deliverables:

1. In the “Homepage” Sheet, create the buttons for the following: Item Master, Business Partner Master, Doctor Profiles Master, Procedures
Master, and Admit Patient. See Example below:

2. Create a UserForm captioned “Doctors Master”. See the structure of the userform in the picture below.
Here’s how the UserForm should work:
2.1. The textbox1 beside Item code is where the personnel could type the Doctor Code so that the details of the item will show on Labels 8
to 13. For example, the Item Code is DC10004, the result should be the one below.

IMPORTANT TIP:
1. In order to change the captions of label8 to label13 immediately after typing in Textbox1, the codes should be written on the
Private Sub TextBox1_AfterUpdate(). Remember the process on how we were able to create a “UserForm_Initialize()”? Do the
same for the textbox1. Right Click on TextBox1 > View Code then change the TextBox1_Change to TextBox1_AfterUpdate. This will
make the codes typed in this macro run whenever the TextBox1 is updated.
2. Recall Case 6 on how we were able to change the captions of the labels for the different multipages.

2.2. Upon making the labels change after updating the Doctor Code textbox, the next thing we should create is the warning message box if
ever the user inputs a wrong Item Code (see Example below)

Tip: This part is tricky, you might want to do this at a later time and continue to 2.3
2.3. Since we told the user to click “Show Choices” we must create the UserForm for it. The UserForm should have a caption “Doctors” and a
listbox with 4 columns showing the Doctor code, Surname, First Name, and the Specialty.

After choosing an item, the user will click “Select”. If “Select” is clicked, then this userform should close and the user should be directed
back to “Item Master” UserForm with the details of the item he selected. For example, DC10004 was selected (see figure above), the
result should be the one below:

3. Once the details are complete, then the user could choose whether to edit the details or close the Doctors Master. If the User wants to edit
the details, then we should create the UserForm for it.
3.1. Create a new userform and caption it “Edit Doctor Details”. Copy the Structure of the form below

Here’s how it works: Label8 should be changed to the Item Code specified in the “Doctor Master” UserForm upon Initialize of this “Edit
Doctor Details” UserForm. The details in the Textboxes, Option Buttons, and Comboboxes should also correspond to the Doctor code on
label 8. Continuing the example of DC10007 from 2.3, if we clicked “Edit Details” the result should be the one below:

In this manner, the user is presented with the current data and is given the power to make changes. Once the user clicks “Save
Changes”, the changes should reflect on the “Doctors” Sheet.
The dropdown lists for specialty should contain the specialties of the doctors as shown on Doctors Sheet. See picture below:

4. If the user clicks on “Add New Doctor” on the Doctor Master UserForm, then we should show the UserForm for it. Create a new UserForm
and caption it “Add Doctor”. Copy the structure of the userform below:

Here’s how it works: The user will input the details of the doctor and once the user clicks “Add Doctor”, then the new doctor should be
added to the DoctorMaster Sheet. You should be experts on this by now. If a field is left blank, the user should be notified. The doctor code
DCXXXXX must be followed.
5. Create a UserForm captioned “Procedure Master”. See the structure of the userform in the picture below.

Here’s how the UserForm should work:


5.1. The textbox1 beside Procedure code is where the personnel could type the Procedure Code so that the details of the procedure will
show on Labels 4 & 5. For example, the Item Code is PL10001, the result should be the one below.
IMPORTANT TIP:
1. In order to change the captions of label4 & label5 immediately after typing in Textbox1, the codes should be written on the Private
Sub TextBox1_AfterUpdate(). Remember the process on how we were able to create a “UserForm_Initialize()”? Do the same for
the textbox1. Right Click on TextBox1 > View Code then change the TextBox1_Change to TextBox1_AfterUpdate. This will make the
codes typed in this macro run whenever the TextBox1 is updated.
2. Recall Case 6 on how we were able to change the captions of the labels for the different multipages.

5.2. Upon making the labels change after updating the Procedure Code textbox, the next thing we should create is the warning message box
if ever the user inputs a wrong Item Code (see Example below)

Tip: This part is tricky, you might want to do this at a later time and continue to 5.3

5.3. Since we told the user to click “Show Choices” we must create the UserForm for it. The UserForm should have a caption “Procedures”
and a listbox with 2 columns showing the Procedure code and the procedure name.
After choosing a procedure, the user will click “Select”. If “Select” is clicked, then this userform should close and the user should be
directed back to “Procedures Master” UserForm with the details of the item he selected. For example, PL10004 was selected (see figure
above), the result should be the one below:

6. Once the details are complete, then the user could choose whether to edit the details or close the Procedure Master. If the User wants to
edit the details, then we should create the UserForm for it.

6.1. Create a new userform and caption it “Edit Procedure Details”. Copy the Structure of the form below
Here’s how it works: Label4 should be changed to the Procedure Code specified in the “Procedure Master” UserForm upon Initialize of
this “Edit Procedure Details” UserForm. The details in the Textboxes should also correspond to the item code on label 4. Also the
Listbox on the company type should reflect what kind of company the current Procedure Code is. Continuing the example of PL10004
from 5.3, if we clicked “Edit Details” the result should be the one below:

In this manner, the user is presented with the current data and is given the power to make changes. Once the user clicks “Save
Changes”, the changes should reflect on the “ProcedureList” Sheet.
7. If the user clicks on “Add New Proc.” on the Procedure Master UserForm, then we should show the UserForm for it. Create a new UserForm
and caption it “Add Procedure”. Copy the structure of the userform below:

Here’s how it works: The user will input the details of the item and once the user clicks “Add Partner”, then the new item should be added
to the BusinessPartners Sheet. You should be experts on this by now. If a field is left blank, the user should be notified. The Procedure code
PLXXXXX must be followed.

TIP: Make use of the Initialize for UserForms and AfterUpdate / Change for TextBoxes as I have mentioned above.
8. Create a sheet called “Procedure Log” and have the following Columns:

9. Create the UserForm for Admit Patients. Caption it: Admit Patient. It has the following Format:

Here’s how it works:


The user will input the patient code in order to change the content for labels 7 to 11; just like how it is with the Item Master,
BusinessPartner Master, Doctor Master, and Procedure Master. The user can also choose Show choices to show the patients recorded in the
database. An error will show if the patient code does not exist.
If the user clicks on show choices, the userform captioned “Patients” should show. It has 5 columns, showing the Patient Code, Surname,
First Name, Age, and Sex. See picture below:

Once the user clicks on Select, then it should reflect on the Admit Patient UserForm
10. Adding Procedures done to the patient:

Here’s how it works:


Once a user clicks the “+” sign, the “Procedures” User Form should show. Once the user has selected a procedure, the “Doctors” User Form
will show. After selecting a procedure and a doctor, the details on labels 21-27 should update. See Example below.

The same should happen if the second row + is pressed. As well as on the third row.
11. If a user clicks on the X button on the right, then the details for that row should be deleted.

12. Once the user clicks on Record, then the details should be copied to the “ProcedureLog” Sheet. Entries must follow the PNXXXXX code for
each entry in the Procedure Log.

TIP: For the SUBTOTAL, Equate the captions of lables27, 34, 41 to a variable. Declare the variables needed as LONG instead of INTEGER,
since integer can only go up to +- 37,768 while Long can go up till +-2,147,483,648. Recall the concepts from lecture 2.

Вам также может понравиться