On-screen Output:
Entering of customer details / ward
Selecting of equipment
Entering the access password
Error messages
Validation rules
Printed Outputs:
Customer details and equipment
Time length of loan and date
Management Statistics
The printed output is produced using the print faculties built into Visual Basic exposed through the printer object; this will then use any available printers on the system to produce the output from the program. To give the printouts a professional appearance and style, I have designed a logo for the company which is saved as a graphics file in the location of the program on disc.
Businesslogo.bmp
Every time output is required, the graphic is printed first and then the output from the program follows. Finally a standard company motto is printed, giving the contact number of the company and a message of thanks.
To make comments or would just like to contact HospitalEquipmentLoanSystem
Telephone: 0800 1297430 Online: Email: Facsimile: 0800 1297432
◉ Design – User Interface:
My application has been created so it will be extremely easy for the user to understand and use the application. When the program initially starts up there is login screen, which is then followed by a simple form that allows the user to access 4 separate forms as displayed below.
When you access the main form (frmMaindisplay), the user will be able to access another four forms as described below…
As you can see, once the user has completed the customer information form, they can proceed to the main form for equipment hire (frmLoans); from which the equipment is loaned. Here, the information which is inputted is repeated in the loans form and is saved (The area is highlighted above).
This form has the ability to calculate the week’s loan period and calculates the amount of equipment loaned. Either one piece equipment or a range …
E.g.
Once the items were selected, the number in stock would be updated. As you can see from this screenshot, the number in stock should be five but because the user selected three items the number in stock has changed to two. This proves that the calculator for this function works. But I will test it further to see the extent of this facility and if there are any problems.
Once the user has selected all the necessary items and is all loaned out, the user is required to press the button “loan” so that the information will be saved and can proceed to the following forms.
Like the loans form, there are several other forms jus like it, so that it can cater for the other points of the specification such as repairs and reports etc.
◉ Design – User Interface 2:
The password prompt form is easy to design, it will require a text box for the password, and two command buttons for OK and Cancel. The positioning should obey the standard of buttons to the right or below the main controls, and I have chosen the following layout:
This layout allows for simple operation and uses the standard accepted system of a username and password, although the username will be fixed to “H.E.L.S.” and made non-editable (locked) so that it cannot be modified. There is only need for one username. The password field will be made to accept passwords and display the password as asterisks, for extra security.
Code for password / security:
Option Explicit
Public LoginSucceeded As Boolean
Private Sub cmdCancel_Click()
'set the global var to false
'to denote a failed login
LoginSucceeded = False
Me.Hide
End Sub
Private Sub cmdOK_Click()
'check for correct password
If txtPassword = "cedric" Then
'place code to here to pass the
'success to the calling sub
'setting a global var is the easiest
LoginSucceeded = True
Me.Hide
frmMaindisplay.Show
Else
MsgBox "Invalid Password, try again!", , "Login"
txtPassword.SetFocus
SendKeys "{Home}+{End}"
End If
End Sub
If the user inputs an incorrect password a message will be displayed, saying “Invalid Password, try again!” To increase security I have integrated another package called EasyEncrypto so that the files will be encrypted all the time unless decrypted by the user. In order to keep the data used by the program secure, a password feature will restrict access to the program to trusted individuals. This means that any user with access to the computer, but does not know the password cannot create or modify (or even start) any part of the program without the password. Because the data files used by the system are reads from and written to using random access, they are not in a human-readable format, so it is virtually impossible of successfully modify there contents without access to the program.
◉ Data Flow Diagram:
◉ Design – Record Structure & File Organisation:
The files that store the equipment and customer details will be created using the “Random Access Files” feature of visual basic. This provides direct access to store records of a fixed size to a file. Two files are used, one for the equipment and the other for customer details. These files should exist in the directory containing the program. In order to write random access files, each record must be defined using Type statement. These specify what each record should contain so that the size of each record, and hence the structure of the random access files, can be determined. Here the Type statements for the application.
Private Type StockLoad
StockLoad_1 As Integer
StockLoad_2 As Integer
StockLoad_3 As Integer
StockLoad_4 As Integer
StockLoad_5 As Integer
StockLoad_6 As Integer
StockLoad_7 As Integer
StockLoad_8 As Integer
StockLoad_9 As Integer
StockLoad_10 As Integer
End Type
Private Type Details
Customer_1 As String * 18
Customer_2 As String * 18
Customer_3 As String * 18
Customer_4 As String * 18
Customer_5 As String * 18
Customer_6 As String * 18
Customer_7 As String * 12
Customer_8 As String
ItemCode1 As String * 12
ItemCode2 As String * 12
ItemCode3 As String * 12
ItemCode4 As String * 12
ItemCode5 As String * 12
ItemCode6 As String * 12
ItemCode7 As String * 12
ItemCode8 As String * 12
ItemCode9 As String * 12
ItemCode10 As String * 12
ItemCode11 As String * 12
ItemCode12 As String * 12
ItemCode13 As String * 12
ItemCode14 As String * 12
ItemCode15 As String * 12
ItemCode16 As String * 12
ItemCode17 As String * 12
ItemCode18 As String * 12
ItemCode19 As String * 12
ItemCode20 As String * 12
ItemCode21 As String * 12
ItemCode22 As String * 12
ItemCode23 As String * 12
ItemCode24 As String * 12
ItemCode25 As String * 12
ItemCode26 As String * 12
ItemCode27 As String * 12
ItemCode28 As String * 12
ItemCode29 As String * 12
ItemCode30 As String * 12
ItemCode31 As String * 12
ItemCode32 As String * 12
ItemCode33 As String * 12
ReturnDate As String * 8
LoanAmount As Integer
End Type
Private Type Checkpoint
Check_1 As Integer
Check_2 As Integer
Check_3 As Integer
Check_4 As Integer
Check_5 As Integer
Check_6 As Integer
Check_7 As Integer
Check_8 As Integer
Check_9 As Integer
Check_10 As Integer
Check_11 As Integer
Check_12 As Integer
Check_13 As Integer
Check_14 As Integer
Check_15 As Integer
Check_16 As Integer
Check_17 As Integer
Check_18 As Integer
Check_19 As Integer
Check_20 As Integer
Check_21 As Integer
Check_22 As Integer
Check_23 As Integer
Check_24 As Integer
Check_25 As Integer
Check_26 As Integer
Check_27 As Integer
Check_28 As Integer
Check_29 As Integer
Check_30 As Integer
Check_31 As Integer
Check_32 As Integer
Check_33 As Integer
End Type
*For each type statement there is a corresponding Public arrays of the type’s defined. These are used to hold all of the data while the program is running – similar to a table of file in a database. All the files are loaded from the disc into the corresponding arrays upon program load for use throughout the entire program. When the program is exited the files are updated using the records from the arrays.
◉ Printing Reports and Overview form:
(Code for printing summary letters for customers)
Private Sub CmdLetter_Click()
CommonDialog1.ShowPrinter
Printer.PrintQuality = vbPRPQHigh
Printer.PaintPicture LoadPicture(App.Path & "\Businesslogo.bmp"), 0, 0
Printer.Print vbCrLf
Printer.Print vbCrLf
Printer.Print vbCrLf
Printer.Print vbCrLf
Printer.Print vbCrLf
Printer.Print vbCrLf
Printer.Font.Name = "Times New Roman"
Printer.Font.Size = 14
Printer.FontBold = True
Printer.Print " " & "____________________________________________________________"
Printer.Print " " & "Loan Statistics for " & Format(Now, "DD/MM/YY")
Printer.Print " " & "Loan Statistics for " & lblItem.Caption
Printer.Print " " & "------------------------------------------------------------"
Printer.Print
Printer.Font.Name = " Times New Roman "
Printer.Font.Size = 12
Printer.Print
Printer.Print " " & " " & "Dear " & lblTitle.Caption & lblName.Caption
Printer.Print
Printer.Print " " & "This is simply a reminder that the equipment you have loaned from us"
Printer.Print " " & "is due back in exactly one week. Please ensure that you note this and"
Printer.Print " " & "return the equipment on the agreed date or there will be an issuing of"
Printer.Print " " & "a penalty."
Printer.Print
Printer.Print
Printer.Print
Printer.Print
Printer.Print
Printer.Print
Printer.Print
Printer.Print " " & "Your sincerely"
Printer.Print " " & "Cedric John"
Printer.Print " " & "Reminder from Hospital Equipment Loan System"
Printer.Print " " & "____________________________________________________________"
End Sub
Private Sub cmdPrintDetails_Click()
On Error GoTo Handler
If chkCustomer.Value = 1 Then
CommonDialog1.ShowPrinter
Printer.PrintQuality = vbPRPQHigh
Printer.PaintPicture LoadPicture(App.Path & "\Businesslogo.bmp"), 0, 0
Printer.Print vbCrLf
Printer.Print vbCrLf
Printer.Print vbCrLf
Printer.Print vbCrLf
Printer.Print vbCrLf
Printer.Print vbCrLf
Printer.Font.Name = "MS Sans Serif"
Printer.Font.Size = 14
Printer.FontBold = True
Printer.Print " " & "____________________________________________________________"
Printer.Print " " & "Loan Statistics for " & Format(Now, "DD/MM/YY")
Printer.Print " " & "Loan Statistics for " & lblItem.Caption
Printer.Print " " & "------------------------------------------------------------"
Printer.Print
Printer.Font.Name = "MS Sans Serif"
Printer.Font.Size = 12
Printer.Print " " & " " & "Title "; Tab(30); lblTitle.Caption
Printer.Print " " & " " & "Name "; Tab(30); lblName.Caption
Printer.Print " " & " " & "Address "; Tab(30); lblAddress_1.Caption
Printer.Print " "; Tab(30); lblAddress_2.Caption
Printer.Print " " & " " & "City "; Tab(30); lblCity.Caption
Printer.Print " " & " " & "Postcode "; Tab(30); lblPostcode.Caption
Printer.Print " " & " " & "Telephone "; Tab(30); lblTelephone.Caption
Printer.Print " " & " " & "Ward "; Tab(30); lblWards.Caption
Printer.Print " " & "------------------------------------------------------------"
Printer.Print
Printer.Print " " & " " & "Item Code "; Tab(30); lblItem.Caption
Printer.Print " " & " " & "Return "; Tab(30); lblReturnDate.Caption
Printer.Print " " & " " & "Number of Loans "; Tab(30); lblNumLoan.Caption
Printer.Print " " & "------------------------------------------------------------"
Printer.Print " " & "____________________________________________________________"
End If
If chkRepair.Value = 1 Then
CommonDialog1.ShowPrinter
Printer.PrintQuality = vbPRPQHigh
Printer.PaintPicture LoadPicture(App.Path & "\Businesslogo.bmp"), 0, 0
Printer.Print vbCrLf
Printer.Print vbCrLf
Printer.Print vbCrLf
Printer.Print vbCrLf
Printer.Print vbCrLf
Printer.Print vbCrLf
Printer.Font.Name = "MS Sans Serif"
Printer.Font.Size = 14
Printer.FontBold = True
Printer.Print " " & "____________________________________________________________"
Printer.Print " " & "Loan Statistics for " & Format(Now, "DD/MM/YY")
Printer.Print " " & "Loan Statistics for " & lblItemCode.Caption & lblState.Caption
Printer.Print " " & "------------------------------------------------------------"
Printer.Print
Printer.Font.Name = "MS Sans Serif"
Printer.Font.Size = 12
Printer.Print " " & " " & "Description "; Tab(30); lblDescription.Caption
Printer.Print
Printer.Print " " & " " & "Item Code "; Tab(30); lblItemCode.Caption
Printer.Print
Printer.Print " " & " " & "Cost Of Replacement "; Tab(30); lblReplaceCost.Caption
Printer.Print
Printer.Print " " & "------------------------------------------------------------"
Printer.Print
Printer.Print " " & " " & "Sent: Date "; Tab(30); lblDate.Caption
Printer.Print " " & " " & "Return: Date "; Tab(30); lblLoanDate.Caption
Printer.Print
Printer.Print " " & "------------------------------------------------------------"
Printer.Print " " & "____________________________________________________________"
End If
Exit Sub
Handler: MsgBox "Select the printing style", vbCritical
End Sub
◉ Did my program meet the specification?
The first aspect of the specification is that I must be able to produce a hard copy of the information, of any piece of equipment. This has been proved on pages 10 and 11. The next aspect concerns the loan period. The equipment is lent out for a 6-week period in the first place, but this loan can be renewed for periods of 6 weeks.
The check boxes allow the user to choose from a length of one week to six weeks as requested in the specification.
The text box next to “Return on the:” displays the date of the week that it should be returned and if the user is not sure of the current date they can select “Today’s date” and the date of that day will appear.
The specification also asked to allow the user to input name and address. Also there must be a range for the ward numbers. The wards must range from W1 to W10. So there must be 10 different options. I have chosen the ward ranges to appear in a combo box form as shown below.
Candidate # : Centre # : Page