Analysis
. Background to/identification of the problem
I came up with my project idea through a problem my friend, a shop clerk, who runs a DVD rental shop, had faced. He used to rent out DVDs to his registered customers for the price of £1.50 for old DVD's and £3.00 for DVD's which are pretty new but the problem was that he had to do everything without a computer system which made his job quite difficult for him. So I have decided to make a system for his video rental shop as my project which would make it easier for him.
The general environment is him behind a counter surrounded by loads of DVDs so he is the only person who works in the shop, there is no staff but sometimes when required, he may get someone to cover for him if needed.
The current system in operation works by a customer registering with the rental shop first they then receive their unique membership number which they then quote every time they want to rent a DVD out and then pay the rental price for that DVD. The shop clerk then looks for this membership number through a file which contains all the registered customers and their membership numbers, arranged in order from smallest to biggest and every time a new customer registers they get the next available membership number with in the file. The problem with the current system is that everything is done manually which is really time consuming and may get much difficult to maintain when and if the total number of members for that shop exceeds over 500, as looking for the membership numbers through a list of over 500 can take along time to find.
For a solution to this problem I am aiming to come up with a system which will try to reduce the amount of time being spent while dealing with rentals and come up with a computerised system. I will transfer all the registered customers who are already registered with the shop to one single table first and then transfer all the DVDs which are available to rent at the shop to another separate table each with its own unique DVD ID.
The shop clerk's shop is open from 9 in the morning till 6 in the afternoon with no staff, just him. The problem is tackled now by the shop clerk just taking the orders and writing it down in a file he has with all the people who have registered with his shop, each having their own membership number. For example if a customer came into the shop and wanted to borrow a DVD, the customer would give the shop clerk their membership number, which then the shop clerk would search for this number in his file and write down the title of the DVD that has been borrowed into the file and take the money off the customer.
A computer system can be used to completely computerise the system and reduce the time needed by having all the people who have registered with the shop in a single database with all their unique membership numbers. It could also allow the clerk to carry out other functions such as see which loans are overdue by the click of a button and print this out and target those people for repayment.
The shop clerk will be able to answer any sort of questions I have which will help me in my project.
2. Identification of prospective users
The computer system is going to be used by the shop clerk, who needs access to all the facilities, and mostly it will be only him who is going to be using it but sometimes when he has to take time off for a reason someone else may be using it. The shop clerk is computer literate but will require a bit of training before using the actual system.
3. User needs and acceptable limitations
The shop clerk would like the system to:
* Have some sort of security so I will be placing a username and password as security
* He also wants it to allow him to register and update customers details with the shop
* He also wants it to allow him to assign rented DVD's to people who have borrowed them
* He would like to display the DVD's which haven't been rented out when someone wants to rent out a DVD
* The system must also print out a receipt for the customer
* He also wants the system to allow him to add newly available DVD's to the existing selection
* He also wants the system to be able to gather loans which are overdue and be able to print the list out
* The system must allow the user to see which DVD's have been rented out and which haven't
* The system must be able to work out how much money the rental shop has made.
The limitations would be that
4. Data Sources and Destinations
* The shop clerk will type his username and password in to the system to access it.
* When a customer is registering the details e.g. names, telephone number, address etc will come from the customer. This will be received in a paper form.
* The DVD's will be obtained from the shop itself and its details will be entered into the system by the shop clerk/user.
5. Data Flow Diagram
(Current System)
(Proposed System)
6. Data Dictionary - (Loans)
Name
Data Type
Length
Validation
Example Data
Comment
Membership Number
String
Variable
Must only be numbers
658
Unique identifier of a registered customer
DVD ID
String
Must only be numbers
25
Unique to every film
Date Borrowed
Date
0 characters
1/02/2005
The date a DVD was borrowed
Due Date
Date
0 characters
6/02/2005
The date a DVD is Due back
Rental cost
5 characters
£2.00
The price of renting a DVD
Data Dictionary - (Members)
Name
Data Type
Length
Validation
Example Data
Comment
Title
String
5 Characters Max
Must Only Contain Letters
Mr
The title of a member
Forename
String
5 Characters Max
Must Only Contain Letters
John
The forename of a member
Surname
String
5 Characters Max
Must Only Contain Letters
Smith
The surname of a member
Address
5 Lines Max
84 Lambert avenue etc
The address of a member
Telephone Number
String
5 Characters Max
Must only be numbers
0161 543 6789
The telephone number of a member
Date Joined
Date
0 characters
Must only be numbers
05/06/2004
The date a member joined
Additional Notes
String
0 characters
Any other additional notes that are needed on the member
Data Dictionary - (Films)
Name
Data Type
Length
Validation
Example Data
Comment
Film Title
The Matrix
The name of the DVD Film
Genre
String
20 Characters Max
Must only Contain letters
Horror
The genre of the film
Length
String
5 Characters
01.30
How long the film lasts for
Age Certificate
2 Characters
Must only Contain numbers
2
The minimum age you have to be to watch a film
DVD ID
String
Variable
Must only Contain numbers
26
The ID of the DVD which is specific to every DVD
Price
Currency
Max 3 char
Must only be numbers
£1.50
The price charged for the loan
Data Dictionary - (Usernames and Passwords)
Name
Data Type
Length
Validation
Example Data
Comment
DVD ID
Number
Variable
Must only be a number
5
The ID of the DVD which is specific to every DVD movie
Member ID
Number
Variable
Must only be a number
2
7. E-R model for the existing system
8. Objectives of the project
The project aims are:
* The system must be user friendly and easy to figure out how to use it.
* The system must have some sort of security and only valid users can log on
* The system must be able to register and update customers details with the shop and should give them a unique membership ID in the process which can be used by the rental shop to identify the member
* The system must be able to add new DVD's to the existing catalogue and should also give each DVD a unique DVD ID
* The system must assign A Copy Id to each DVD cause there be more than one copy of the same DVD
* The system must allow the user to see which DVD's have been rented out and which haven't
* The system must be able to assign rented DVD's to people who have borrowed them
* The system must also print out a receipt for the customer
* The system must also be able gather a list of all loans which are overdue and be able to print this list out
* The system must be able to work out how much money the rental shop has made.
Design
. Overall system design
This system will work by the user logging into the system to have access to it. The log in process will consist of a username and a password which will act as a security feature which the user had wanted so only authorised user's can log in but before the user can log in to the system he must setup a username and a password. Once logged in the user will be able to register new customers with the shop. The shop clerk/user will give a form to the customer to fill in and return to him so that he can fill in the details into the system which will be stored in the 'Members Table' and the system will then also generate and assign a member id for the new member. The 'member table' will contain the entire customers which are registered with the shop.
When one of the customers wants to rent out a DVD, the user has to make sure that DVD is available to rent out so what I am going to do in this system is that I will not be displaying any DVD's which are already rented out but only those which aren't rented out will be displayed so that the user can only choose from a list of only those DVDs which aren't rented out to prevent him from renting out a DVD which isn't available. The shop clerk will then go into the stock room and obtain that DVD and give it to the customer he will then create a record in the 'Loans table' which will contain the member ID, Copy Number, the date borrowed, the return date and the rental cost. After this has been done the system will generate a receipt
The system will also be able to return DVD's. When the customer returns to the shop to return the DVD he or she borrowed he will have to quote his or her membership together with the ID of the DVD they borrowed. The user will then be able to search through a list of all the records within the Loans table and delete that record.
The system will also allow the shop clerk/user to add new DVD's to the existing selection. This will be done by the user manually entering the description of the DVD such as title, genre etc into a table called the 'films table' using a keyboard.
This system will also be able to come up with a list of all the loans which have been overdue so that the shop clerk can target those people for a fine upon returning the DVD which was really difficult to do when he was using a manual system as he had to go through the whole file. This will be done by coming up with a sequence of SQL which will be designed to search through the rentals table and retrieve those records which are more than 2 days over the date of borrowing the DVD's. This list of overdue loans can then be printed out by the user.
Systems Flow Chart Diagram
Registering Customers
Adding New DVD's
Renting Out A DVD
Returning A DVD
2. Modular structure of system (Top Down Design)
Membership Form - The member ship form will be used by the user to register new members with the shop. The data entered will be stored in the 'Members Table' It will also allow the user/clerk to edit or update the data of the members if necessary.
Add New DVD Form
The DVD form will allow the user to add DVDs to the existing catalogue by entering information such ass genre, title, Length etc This form will also allow the user to edit the information about the DVD's as well.
Rent Out a DVD Form
This form will allow the user to rent out a DVD to a certain member.
Overdue Loans Form
This form will allow the user to gather a list of all the loans which are overdue so that he can print them out and target those members for repayment.
3. Design Data Dictionary
* ER Diagram
Member can rent Film has one
many times or many copies
* Data Dictionary
Table: Members
Field Name
Data Type
Length
Validation
Example Data
Comment
MemberId
String
-
Must be numeric
4
This is the primary key - Uniquely identifies a member
Title
String
5 Characters Max
Must only be letters
Mr
The title of a member
Forename
String
5 Characters Max
Must Only Contain Letters
John
The forename of a member
Surname
String
5 Characters Max
Must Only Contain Letters
Smith
The surname of a member
AddressLine1
String
Must Only Contain Letters
4 Slade St
Where the member lives.
AddressLine2
String
Must Only Contain Letters
longsight
AddressLine3
String
Must Only Contain Letters
Manchester
AddressLine4
String
Must contain both letters and numbers
M15 0QJ
TelNumber
String
5 Characters Max
Must only be numbers
0161 256 7654
The telephone number of a member
DateJoined
Date
0 characters
Must only be numbers
0/09/2010
The date a member joined the club
Additional Notes
String
0 characters
Any other additional notes that are needed on the member
This table will contain all the members which have joined with the rental shop. It will be accessed using the primary key, MemberId. All new records will be placed at the end of the table.
Table: Films
Field Name
Data Type
Length
Validation
Example Data
Comment
DVDId
String
Variable
Must only Contain numbers
26
The ID of the DVD which is specific to every DVD movie
FilmTitle
String
Variable
The Matrix
The name of the DVD Film
Genre
String
20 Characters Max
Must only Contain letters
Horror
The genre of the film
Length
String
5 Characters
01.30
How long the film lasts for
AgeCertificate
4 Characters Max
...
This is a preview of the whole essay
Data Type
Length
Validation
Example Data
Comment
DVDId
String
Variable
Must only Contain numbers
26
The ID of the DVD which is specific to every DVD movie
FilmTitle
String
Variable
The Matrix
The name of the DVD Film
Genre
String
20 Characters Max
Must only Contain letters
Horror
The genre of the film
Length
String
5 Characters
01.30
How long the film lasts for
AgeCertificate
4 Characters Max
2
The minimum age you have to be to watch a DVD film
This table will contain all the DVD's which the rental shop contains. It will be accessed using the DVD ID which is the primary key. New DVD's can be added to the table which will be placed at the bottom of the table.
Table: Loans
Field Name
Data Type
Length
Validation
Example Data
Comment
Member ID
Number
Variable
Must only be a number
2
DVD ID
Number
Variable
Must only be a number
5
The ID of the DVD which is specific to every DVD movie
Date Borrowed
Date
Max 10 Char
2/05/2005
The date a DVD was Borrowed
DateBack
Date
Max 10 Char
6/14/2005
The date a DVD needs to be returned by
LoanID
Number
Variable
Must only be a number
6
The ID of a rental for a DVD
Price
Currency
6 Char
Must only be a number
£1.50
The price for renting a DVD
This table will contain all the records of those members who have rented out a DVD. Once the DVD is returned that specific record will be deleted off this table.
Table: Usernames And Passwords
Field Name
Data Type
Length
Validation
Example Data
Comment
Member ID
Number
Variable
Must only be a number
2
DVD ID
Number
Variable
Must only be a number
5
The ID of the DVD which is specific to every DVD movie
This table will contain all the usernames and passwords which will allow the user to enter into the system.
4. Storage media and format
The media I intend to use to store my programs on is a CD-ROM disc. I don't need all the capacity of a CD-ROM but I intend to use this rather than a Floppy disc is because the programs won't be able to get deleted accidentally or maliciously on CD but with a floppy disc this is possible but then a gain a CD may get scratched up making the data within it unreadable. I will use a CD burner to burn my system to a CD-R using burning software. Once the system has been burned to CD-R this will make it read only meaning the system can not be delete or either written over
All the databases will also need to be backed up to ensure that no data is accidentally lost or deliberately tampered with. All data will be backed up onto a CD every week and this disc will be kept in a safe place. Details of how to backup the data will be provided to the user.
The program will be saved onto the hard drive so that the user doesn't have to load the CD every time he wants to use the program which is better off.
5. Identification of processes and algorithms for data transformation
Login button on the Login Form:
Begin
If EdUsername.text = ['Username']
Then
Begin
If Edpassword.text = ['Password']
Then
Begin
FmmaninMenu.show;
End
Else
Showmessage ('Please enter a correct password')
End
Else
Showmesage ('Only Login If you are authorised to')
This algorithm is used to login into the system.
Rent Out Button
begin
Adoloans.open;
if adoloans.locate('dvdid',strtoint(DBEdit1.text),[]) then
showmessage('Already on loan')
else
begin
xmem:= strtoint(dblkcbxmembers.text);
adoqtoomany.Parameters[0].value:=xmem;
adoqtoomany.Open;
if ADOQtoomany.recordcount>=3 then
showmessage ('You Can Only Borrow A Maximum of 3 DVD''s')
end;
This algorithm will be used to draw up and display messages if a member is trying to borrow more than 3 DVDs or the DVD he or she wants to borrow is already on loan.
SQL
SELECT [Loans Table].MemberID, [Loans Table].DVDId, [Films Table].FilmTitle, [Loans Table].DateBorrowed, [Loans Table].DateBack, [Loans Table].LoanID, [Loans Table].Price
FROM [Members Table] INNER JOIN ([Films Table] INNER JOIN [Loans Table] ON [Films Table].DVDId = [Loans Table].DVDId) ON [Members Table].MemberId = [Loans Table].MemberID
WHERE ((([Loans Table].DateBack)<Date()));
This SQL sequence will be used to gather a list of all the overdue loans.
6. User Interface Design
My user interface will menu driven based. The menus will be accessed using buttons placed on forms with a label on each to indicate which button corresponds to which form.
The forms displayed, selected from the main menu will have titles on them to identify them. The forms will not be cluttered and the layout of the buttons must be suitable so that there are spaces and blanks. Items must be placed in a logical way in order to make it easier for the user and to make it look nice. The forms will have to be coloured so that they look good. The font, colour size and style must be selected in a way which makes it easy to read for the user. The button which links back to the main menu must be located in a common position on all forms which will make it easier for the user to remember recognise where a common button is. Textboxes, command buttons, labels, frames, should all be sized oppositely so that it is easier for the user to distinguish what each text says and be able to enter or click on the correct prompt.
Help facilities should be placed wherever required as the user is semi computer literate so hints would be useful.
The Forms Will Look Like This:
Setting up a Username and Password Form
This is the 'Setting up a Username and Password Form'. This is where the user will create a new username and a password which he or she will use to enter the system. The username and password will be saved in a table called the 'Usernames and Passwords' table.
Login Form
This is the main menu form which will allow the user to access the other forms.
Main Menu Form
This is the main menu form which will allow the user to access the other forms.
Register A Member Form
This is the form which the user will use to register a member with the shop.
Add New DVD's Form
This form will be used by the user to add DVD's to the catalogue
Rent Out A DVD Form
This form will be used by the user to rent out a DVD to a member and a record will be created in the loans table identifying who has rented what DVD out.
Return DVD Form
This form will be used by the user when a member wants to return a DVD. When a DVD is returned the record is deleted off the loans table.
Overdue Loans Form
This form will be used by the user to generate a list of all the members who have not yet returned their DVD back to the shop.
7. Security and Integrity Plan
I will try to keep the data as accurate as possible by using validation check and input masks..
I will implement a security feature on the Login Form which requires the correct username and password to prevent unauthorised access to the system. The validation check will be performed into the 'Login' button on the login form so that the validity of the username and password can be checked. This will limit the chance of invalid access to the system. So if an incorrect username or password has been entered an error message will pop up telling the user that the username and password is incorrect and to re-enter it correctly.
I will also use combo boxes where I think data doesn't really need to be typed into the system manually by the user but can be selected from a list to prevent anything inappropriate from being entered into the system which will help in increasing the integrity of the data entered..
I will also use input masks for things like the post code or telephone of a member as there all the post codes and telephone numbers are in one standard form for all members so this will also improve integrity.
The measures I am putting in place to prevent data loss or corruption is that I will be outlining to the user to make regular backups so that if in any circumstance the data becomes corrupt or lost he can retrieve the data from a backup. I will also outline to the user that backups should be made everyday Details of how to carry out backing up of data will be given to the user as well.
8. System Security (access control)
To prevent unauthorised access to the system I will provide a security feature which consists of a username and password. The user will first have to setup a username and password which once setup can be used to access the system.
The pitfalls of this is that the login system will not have a limit on the number or passwords and usernames entered meaning that an unauthorised person may guess the username and password and enter the system. The system has no way off knowing whether the user who has logged on is the person who is really authorised to use this system or not. An alternative method could be to use biometric recognition but implementing this requires a lot of money and may be time-consuming.
8. Test strategy
Once the system has finished I will test it in a methodological and structural way to make sure all process, buttons etc work correctly and efficiently. I will use testing
The order in which I will test the system is as follows:
Setup Username and Password Form - I will ensure that the button for saving the Username and password works and that they get saved to the 'Usernames and Paswords' table.
Login Form - I will ensure that only authorised users can log in and that if an incorrect username or password is entered the person can not log in without re-entering the correct username or password.
Register A Member Form - I will ensure that the details of the new member are saved to the table and that the input masks and combo boxes work as they should. I will also test the delete button for removing a member.
Add New DVD's Form - I will test the buttons for adding the details of the DVD to see if they are added to the table. I will test whether or not the same DVD can be added again. I will also test whether the delete button.
Rent Out A DVD Form - I will test whether the detail of the member who is renting the DVD is saved to the table and if a receipt can be printed out. I will also test whether a message pops if the DVD wanted is already on loan or not. Also I will test whether the system detects if that member has borrowed more than 3 DVD's. I will also test whether only DVD's that are not on loan are displayed. I will also test the buttons on that form.
Returning A DVD - I am going to test the buttons on this form and whether a record can be deleted using the delete button. I will also test whether the combo box displays only the lists off the members who are listed in the rentals table.
Loans Overdue Form - I will test whether the button for retrieving the list of all the overdue loans works and whether this can be printed.
Testing
Form
Description of test
Test Data Used
Expected outcome
Actual Outcome
Page of Report
Username and Password Form
Setting up a username and password
'Admin662'
'Xaverian'
Username and Password Saved
As expected
2
Username and Password Form
Username and Password fields left blank
'No Username'
'No Password'
Error message should pop up
As expected
3
Login Form
When an authorised user logs on
'Admin662'
'Xaverian'
Main menu should open up
As expected
4
Login Form
When a invalid username and an invalid password is entered
'No Username'
'No Password'
Error message should pop up
As expected
5
Login Form
When a valid username and an invalid password is entered
'Admin662'
'No Password'
Error message should pop up
As expected
6
Login Form
When a invalid username and a valid password is entered
'John'
'Xaverian'
Error message should pop up
As expected
7
Main Menu
Check all links
Correct forms open up
As expected
8
Register a Member
Registering a Member
Details of that member should be saved, Confirmation message should pop up.
As expected
9
Register a Member
Title left blank but rest of the fields are not
No Title
An error message should pop up
As Expected
0
Register a Member
Forename left blank but rest of the fields are not
No Forename
An error message should pop up
As Expected
1
Register a Member
Surname left blank but rest of the fields are not
No Surname
An error message should pop up
As Expected
2
Register a Member
House Number left blank but rest of the fields are not
No House Number
An error message should pop up
As Expected
3
Register a Member
Street Name left blank but rest of the fields are not
No Street Name
An error message should pop up
As Expected
4
Register a Member
Town left blank but rest of the fields are not
No Town
An error message should pop up
As Expected
5
Register a Member
Post Code left blank but rest of the fields are not
No Post Code
An error message should pop up
As Expected
6
Register a Member
Tel No left blank but rest of the fields are not
No Tel no
An error message should pop up
As Expected
Register a Member
Deleting a Member from the table
A confirmation message pops up and deletes member
As Expected
Add DVD's
Adding a DVD to the selection of DVD's available
DVD is added to the selection. Confirmation message should pop up
As expected
Add DVD's
Film Title Left blank but rest of Them Have not
'The Matrix'
'Rest left Blank'
An error message should pop up
As Expected
Add DVD's
Price Per Day field Left Blank and rest have not
'£3'
'Rest left Blank'
And Error message should pop up
As expected
Add DVD's
When the same Film Is added twice
An error message should pop up
As expected
22
Form
Description of test
Test Data Used
Expected outcome
Actual Outcome
Page of Report
23
Add DVD's
Removing A DVD
DVD should be deleted from the table
As expected
24
Rent Out A DVD
Renting Out A DVD to A Member
DVD is rented out and added to the loans table
As expected
25
Rent Out A DVD
When a member is not selected but the rest of the fields have data entered in them
And error message should pop up
As expected
26
Rent Out A DVD
When a DVD is not selected but the rest of the fields have data entered in them
And error message should pop up
As expected
27
Rent Out A DVD
When a Price for a DVD is left blank but the rest of the fields have data entered in them
And error message should pop up
As expected
28
Rent Out A DVD
When A Member is trying to rent out more than 3 DVDs
And error message should pop up
As Expected
29
Rent Out A DVD
Renting out a DVD that is already on loan
And error message should pop up
As Expected
30
Rent Out A DVD
Printing the receipt
A confirmation message pops up
As Expected
31
Returning A DVD
Returning A DVD
A confirmation message should pop up and the record should be deleted
As Expected
32
Returning A DVD
When a member has not been selected
An error message should pop up
As Expected
33
Loans Overdue
Testing whether the button to activate a query works.
A confirmation message should pop up and a list of all the overdue loans should be listed
As expected
34
Loans
Testing whether the overdue loans list prints out
A confirmation message should pop up and the overdue loans list should print out.
As expected
35
Register A Member
Testing whether the input masks work
The input mask should only accept the data in the format its setup to accept
A As expected
System maintenance
. System Overview
This is a DVD Rental System which is used by a user who owns a DVD renting shop.
Though a username and password facility the user/shop clerk is able register members to the shop giving them the opportunity to rent DVD's from his shop. It also allows the user to add DVD's to the selection of DVD's that he already has.
It also allows the user to assign DVD's to people who have rented them and also allows him to gain a list of all the members who have borrowed a DVD and have not returned them on time.
Using the programming software Delphi allowed me to use some of its ADO components which allowed me to link my system to a database in access.
The tables this system uses are the:
* Members Table - Contains all the members who are registered with the shop
* Films Table - Contains a list of all the DVD's available to rent at the shop
* Loans Table - Contains a list of all the members who have rented out DVD's
* Usernames and Passwords Table - Contains a list of all the usernames and passwords that can be used to access the system.
2. Brief summary of features used
Some of the components of Delphi I used were:
ADO table Function - This component allowed me to link a specific table in a database in Access to Delphi, which then allowed me to enter details into edit boxes on Delphi which then automatically updated in the tables in Access.
ADO Query Function - This function allowed me to create a query in Access and then allowed me to enter the SQL statement into this component and then displayed the results of this query in Delphi. I made a connection string to my Access database, selected the table I wanted to query, and then I wrote the SQL statement.
DB Grid Function - This function allowed me to display a table in a database in Access in Delphi.
DB Combo Box Function - This function allowed me to list the data of an Access table in the form of a combo box.
All the properties of these above components were set using the object inspector below:
Debugging Function - When there was a syntax error I used the debugging facility to help me fix the error.
The Access tables which I used were the:
Members Table (Design View)
Films Table (Design View)
Loans Table (Deign View)
Usernames and Passwords Table (Design View)
3. Details of SQL Used
Overdue Loans Query
SELECT [Loans Table].MemberID, [Loans Table].DVDId, [Films Table].FilmTitle, [Loans Table].DateBorrowed, [Loans Table].DateBack, [Loans Table].LoanID, [Loans Table].Price
FROM [Members Table] INNER JOIN ([Films Table] INNER JOIN [Loans Table] ON [Films Table].DVDId = [Loans Table].DVDId) ON [Members Table].MemberId = [Loans Table].MemberID
WHERE ((([Loans Table].DateBack)<Date()));
This query was used to gather a list of all the loans which are overdue. This is present on the Overdue Loans Form below on this ADO Query component.
4. Sample of detailed Algorithm Design
Setting Up Username and Password
procedure TFMSetupUserandPass.BtnSaveClick(Sender: TObject);
begin//begin
if//if
(EdUsername.text='') and (edPassword.text='') then//the text in edusername and edpassword is blank then
Begin//begin
showmessage('Please Enter A Username And A password')//show message please enter a username and password
end//end
else//otherwise
begin//begin
ADOuandpsetup.append;
ADOuandpsetup ['username']:=EdUsername.text;//take the text in edusername and place into the field called username in an access table
ADOuandpsetup ['Password']:=EdPassword.text take the text in edpasssword and place into the field called password in an access table
ADOuandpsetup.post;//send the text
Showmessage ('Your Username and Password has Been Saved');//showmessage username and password saved
end;
end;
end.
Adding a DVD to a Table
procedure TFmAddNewDvd.BtnAddDvdsClick(Sender: TObject);
var
FmAddNewDvd: TFmAddNewDvd;
DVDid:integer;
Begin//begin
if adofilms.recordcount=0 then//if the number of records in adofilms is 0 then
dvdid:=0//give the DVDID as 0
else//otherwise
begin//begin
adofilms.Open;//open adofilms
adofilms.last;
dvdid:=adofilms['dvdid'];// insert the value of the variable dvdid into the field DVDID in the access table
end;
DVDid:=DVDid+1;//add 1 to whatever value the variable DVDID is
ADOFilms.Append;
ADOFilms ['DVDId']:=DVDid;//insert the value of the variable dvdid into the field DVDID in the access table
ADOFilms ['filmtitle']:=LblEdFilmTitle.Text;//whatever is in the field lbledfilmtitle insert this into the field filmtitle in the access table
ADOFilms ['genre']:=CBgenre.Text; whatever is in the field cbgenre insert this into the field genre in the access table
ADOFilms ['Length']:=lbledLength.Text; whatever is in the field lbledlength insert this into the field length in the access table
ADOFilms ['AgeCertificate']:=CBAgeCert.Text; whatever is in the field cbagecert insert this into the field agecertificate in the access table
ADOFilms ['priceperday']:=LblEdPricePerDay.Text; whatever is in the field lbledpriceperday insert this into the field priceperday in the access table
adofilms.post;//send this to the table
showmessage ('DVD Has Been Added To The Selection')//show this message
end;
end;//end
end;
5. Procedures and Variables List
Procedures
Setting Up Username And Password Form
procedure TFMSetupUserandPass.BtnSaveClick(Sender: TObject);
This button is used to save the new username and password the user has selected to the usernames and passwords table.
Login Form
procedure TFMLogin.BtnLoginClick(Sender: TObject);
This procedure is used by the user to login to the system and gain access to the main menu
Main MenuForm
procedure TFmMenu.BtnRegAMemClick(Sender: TObject);
This procedure diplays the Regester A Member Form
procedure TFmMenu.BtnAddDVDClick(Sender: TObject);
This procedure displays the Add DVD Form
procedure TFmMenu.BtnRntDVDClick(Sender: TObject);
This procedure displays the Rent Out A DVD Form
procedure TFmMenu.BtnReturnDvdClick(Sender: TObject);
This procedure displays the Return DVD Form
procedure TFmMenu.BtnLoansOverdueClick(Sender: TObject);
This procedure displays the Loans Overdue Form
Register A Member Form
procedure TFmRegAMem.BtnNewMemberClick(Sender: TObject);
This procedure adds the details of a new member to the Members Table
procedure TFmRegAMem.BtnExitClick(Sender: TObject);
This procedure closes the form and returns back to the main menu
Add New DVD's Form
procedure TFmAddNewDvd.BtnAddDvdsClick(Sender: TObject);
This procedure adds the details of a DVD to the Films Table
procedure BtnExitClick(Sender: TObject);
This procedure exits the form and returns back to the manin menu form.
Rent Out A DVD Form
procedure TFMRentOutaDVD.BtnClick(Sender: TObject);
This procedure adds a record to the loans table outlining who has rented which DVD and at what price.
procedure TFMRentOutaDVD.BtnPrintClick(Sender: TObject);
This procedure is to print out a recipet after a customer has rented out a DVD
procedure TFMRentOutaDVD.BtnExitClick(Sender: TObject);
This procedure is to exit the form and return back to the main menu.
Return DVD Form
procedure TFmReturnedDvds.BtnRentClick(Sender: TObject);
This procedure retrns the DVD and deletes the record in the Loans Table
procedure TFmReturnedDvds.Button1Click(Sender: TObject);
This procedure closes the form and returns back to the main menu form
procedure TFmReturnedDvds.dblkcbxmembersClick(Sender: TObject);
This procedure
Overdue Loans Form
procedure TFmLoansOverdue.BtnActivateQueryClick(Sender: TObject);
This procedure actvates the query to gather all the loans which are overdue.
procedure TFmLoansOverdue.BtnPrintClick(Sender: TObject);
This procedure is to print out the overdue loans list
procedure TFmLoansOverdue.BtnExitClick(Sender: TObject);
This procedure is to exit the form and return back to the main menu.
Variables List
Register a Member Form
Variable
Global/Local
MemberID
Local
Add New DVD Form
Variable
Global/Local
DVDID
Local
Rent Out a DVD Form
Variable
Global/Local
Xmem
Local
dpmm
Local
Return DVD Form
Variable
Global/Local
Xmem
Local
Overdue Loans Form
Variable
Global/Local
dpmm
Local
row
Local
Annotated Listing of Program Code
unit USetupUserAndPass;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;
type
TFMSetupUserandPass = class(TForm)
Label1: TLabel;
Label2: TLabel;
EdUsername: TEdit;
EdPassword: TEdit;
BtnSave: TButton;
ADOuandpsetup: TADOTable;
DSuandpsetup: TDataSource;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
procedure BtnSaveClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FMSetupUserandPass: TFMSetupUserandPass;
implementation
{$R *.dfm}
procedure TFMSetupUserandPass.BtnSaveClick(Sender: TObject);
begin//begin
if//if
(EdUsername.text='') and (edPassword.text='') then//the text in edusername and edpassword is blank then
Begin//begin
showmessage('Please Enter A Username And A password')//show message please enter a username and password
end//end
else//otherwise
begin//begin
ADOuandpsetup.append;
ADOuandpsetup ['username']:=EdUsername.text;//take the text in edusername and place into the field called username in an access table
ADOuandpsetup ['Password']:=EdPassword.text take the text in edpasssword and place into the field called password in an access table
ADOuandpsetup.post;//send the text
Showmessage ('Your Username and Password has Been Saved');//showmessage username and password saved
end;
end;
end.
unit Ulogin;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;
type
TFMLogin = class(TForm)
EdUserName: TEdit;
EdPass: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Btnlogin: TButton;
ADOuandpsetup: TADOTable;
DSuandpsetup: TDataSource;
procedure BtnLoginClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FMLogin: TFMLogin;
implementation
uses Umenu;
{$R *.dfm}
procedure TFMLogin.BtnLoginClick(Sender: TObject);
begin
ADOUandPSetup.Open;//open the adouandpsetup
if ADOUandPSetup.locate('username',(edusername.text),[]) and //if the contents of the field in the edusername is identical to that in the usernames and password table in the field named 'usernames' and
ADOUandPSetup.locate('password',(edpass.text),[])// if the contents of the field in the edpassword is identical to that in the usernames and password table named the field 'password'
Then//then
Begin//begin
showmessage ('You Have Logged In Successfully');//show this message
fmmenu.show//and show this form
end
else//otherwise
showmessage ('You Have Either Entered and Inavalid Username And Password or Are Not Authorised to Use this System') //show this message
end;//end
end.
unit Umenu;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TFmMenu = class(TForm)
BtnRegAMem: TButton;
BtnRntDVD: TButton;
BtnAddDVD: TButton;
Label1: TLabel;
BtnExt: TButton;
BtnReturnDvd: TButton;
BtnLoansOverdue: TButton;
Image1: TImage;
BtnLogin: TButton;
BtnSetupUandP: TButton;
procedure BtnSetupUandPClick(Sender: TObject);
procedure BtnLoginClick(Sender: TObject);
procedure BtnExtClick(Sender: TObject);
procedure BtnRegAMemClick(Sender: TObject);
procedure BtnRntDVDClick(Sender: TObject);
procedure BtnAddDVDClick(Sender: TObject);
procedure BtnCreateReportClick(Sender: TObject);
procedure BtnReturnDvdClick(Sender: TObject);
procedure BtnLoansOverdueClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FmMenu: TFmMenu;
implementation
uses URegisterMember, UAddNewDVD, UCreateAReport, URentOutaDVD,
UReturnedDVDs, ULoansOverdue, Ulogin, USetupUserAndPass;
{$R *.dfm}
procedure TFmMenu.BtnExtClick(Sender: TObject);
begin
close;
end;
procedure TFmMenu.BtnRegAMemClick(Sender: TObject);
begin
FmRegAMem.show
end;
procedure TFmMenu.BtnRntDVDClick(Sender: TObject);
begin
FMRentOutaDVD.show
end;
procedure TFmMenu.BtnAddDVDClick(Sender: TObject);
begin
FmAddNewDvd.show
end;
procedure TFmMenu.BtnCreateReportClick(Sender: TObject);
begin
FmCreateAReport.show
end;
procedure TFmMenu.BtnReturnDvdClick(Sender: TObject);
begin
FmReturnedDvds.show
end;
procedure TFmMenu.BtnLoansOverdueClick(Sender: TObject);
begin
FmLoansOverdue.show;
end;
procedure TFmMenu.BtnLoginClick(Sender: TObject);
begin
fmlogin.show;
end;
procedure TFmMenu.BtnSetupUandPClick(Sender: TObject);
begin
fmsetupuserandpass.show;
end;
end.
unit URegisterMember;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, DB, ADODB, DBCtrls, Mask;
type
TFmRegAMem = class(TForm)
ADOMembers: TADOTable;
DSMembers: TDataSource;
DBMembers: TDBGrid;
LblEdForename: TLabeledEdit;
LblEdSurname: TLabeledEdit;
LblEdHouseNumber: TLabeledEdit;
LblEdStreetName: TLabeledEdit;
LblEdTown: TLabeledEdit;
LblEdAddNotes: TLabeledEdit;
BtnNewMember: TButton;
DBNavigator2: TDBNavigator;
Label1: TLabel;
Button1: TButton;
CBTitle: TComboBox;
Label2: TLabel;
LblEdPostCode: TMaskEdit;
Label4: TLabel;
LbledTelno: TMaskEdit;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
procedure BtnExitClick(Sender: TObject);
procedure BtnNewMemberClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FmRegAMem: TFmRegAMem;
memberid:integer;
implementation
uses Umenu;
{$R *.dfm}
procedure TFmRegAMem.BtnExitClick(Sender: TObject);
begin
Close;
end;
procedure TFmRegAMem.BtnNewMemberClick(Sender: TObject);
begin
if (cbtitle.Text='') then//if what is in cbtitle is blank then
begin
showmessage('Please Enter A Title')// show message 'please select a title'
end;
if (LblEdforename.Text='') then//the below code is similar to what I have written above
begin
showmessage('Please Enter A Forename')
end;
if (lbledSurname.Text='') then
begin
showmessage('Please Enter A Surname')
end;
if (lbledhousenumber.Text='') then
begin
showmessage('Please Enter A House Number')
end;
if (lbledStreetName.Text='') then
begin
showmessage('Please Enter A Street Name')
end;
if (lbledtown.Text='') then
begin
showmessage('Please Enter A Town')
end;
if (lbledpostcode.Text='') then
begin
showmessage('Please Enter A PostCode')
end;
if (lbledtelno.Text='') then
begin
showmessage('Please Enter A Telephone Number')
end
else
begin
begin
if adomembers.recordcount=0 then
memberid:=0
else
begin
adomembers.open;
adomembers.last;
memberid:=adomembers['memberid']
end;
memberid:=memberid+1;//add 1 to whatecer memberid is
ADOMembers.Append;//append the access table called members
ADOMembers ['memberId']:=memberid;
ADOMembers ['title']:=cbtitle.text;//whatever is in cbtitle, place that in the 'title' field in the members table
ADOMembers ['forename']:=LblEdforename.Text;//all the below code is similar to what I have written above
ADOMembers ['surname']:=lbledSurname.Text;
ADOMembers ['house number']:=lbledhousenumber.Text;
ADOMembers ['street name']:=lbledstreetname.Text;
ADOMembers ['Town']:=lbledtown.Text;
ADOMembers ['Tel number']:=LbledTelno.Text;
Adomembers ['Date Joined']:=date;
ADOMembers ['Post Code']:=lbledpostcode.Text;
ADOMembers ['Additional Notes']:=lbledaddnotes.Text;
showmessage ('Member Has Been Added');
adomembers.post;
end;
end;
end;
procedure TFmRegAMem.Button1Click(Sender: TObject);
begin
fmmenu.show;//show this form
end;
end.
unit UAddNewDVD;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, DB, ADODB, DBCtrls;
type
TFmAddNewDvd = class(TForm)
DSFilms: TDataSource;
ADOFilms: TADOTable;
DBFilms: TDBGrid;
LblEdFilmTitle: TLabeledEdit;
LblEdLength: TLabeledEdit;
CBGenre: TComboBox;
CBAgeCert: TComboBox;
BtnAddDvds: TButton;
BtnExit: TButton;
DBNavigator1: TDBNavigator;
LblEdPricePerDay: TLabeledEdit;
Label1: TLabel;
procedure BtnAddDvdsClick(Sender: TObject);
procedure BtnExitClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FmAddNewDvd: TFmAddNewDvd;
DVDid:integer;
implementation
uses Umenu;
{$R *.dfm}
procedure TFmAddNewDvd.BtnAddDvdsClick(Sender: TObject);
var
FmAddNewDvd: TFmAddNewDvd;
DVDid:integer;
Begin//begin
if adofilms.recordcount=0 then//if the number of records in adofilms is 0 then
dvdid:=0//give the DVDID as 0
else//otherwise
begin//begin
adofilms.Open;//open adofilms
adofilms.last;
dvdid:=adofilms['dvdid'];// insert the value of the variable dvdid into the field DVDID in the access table
end;
DVDid:=DVDid+1;//add 1 to whatever value the variable DVDID is
ADOFilms.Append;
ADOFilms ['DVDId']:=DVDid;//insert the value of the variable dvdid into the field DVDID in the access table
ADOFilms ['filmtitle']:=LblEdFilmTitle.Text;//whatever is in the field lbledfilmtitle insert this into the field filmtitle in the access table
ADOFilms ['genre']:=CBgenre.Text; whatever is in the field cbgenre insert this into the field genre in the access table
ADOFilms ['Length']:=lbledLength.Text; whatever is in the field lbledlength insert this into the field length in the access table
ADOFilms ['AgeCertificate']:=CBAgeCert.Text; whatever is in the field cbagecert insert this into the field agecertificate in the access table
ADOFilms ['priceperday']:=LblEdPricePerDay.Text; whatever is in the field lbledpriceperday insert this into the field priceperday in the access table
adofilms.post;//send this to the table
showmessage ('DVD Has Been Added To The Selection')//show this message
end;
end;//end
end;
procedure TFmAddNewDvd.BtnExitClick(Sender: TObject);
begin
fmmenu.show;
end;
end.
unit URentOutaDVD;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DBCtrls, DB, ADODB, StdCtrls, Grids, DBGrids, Mask,printers, ExtCtrls;
type
TFMRentOutaDVD = class(TForm)
DSFilms: TDataSource;
ADOFilms: TADOTable;
ADOMembers: TADOTable;
DSMembers: TDataSource;
dblkcbxdvd: TDBLookupComboBox;
dblkcbxmembers: TDBLookupComboBox;
DSLoans: TDataSource;
ADOLoans: TADOTable;
DBGrid1: TDBGrid;
BtnRent: TButton;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
Label1: TLabel;
Label2: TLabel;
ADOQtoomany: TADOQuery;
DSquery: TDataSource;
LblPrice: TLabel;
edPrice: TEdit;
DBGrid2: TDBGrid;
Button2: TButton;
Label4: TLabel;
Button1: TButton;
DBNavigator1: TDBNavigator;
procedure BtnClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FMRentOutaDVD: TFMRentOutaDVD;
implementation
uses UCalcPrice, Umenu;
{$R *.dfm}
procedure TFMRentOutaDVD.BtnClick(Sender: TObject);
var xmem:integer;
begin
if (dblkcbxmembers.Text='') then//if the contents of dblkcbxmembers is blank then
show message 'please select a member'
showmessage('Please Select A Member');
if (dblkcbxdvd.Text='') then//if dblkcbxdvd is empty then
showmessage('Please Select A DVD To Rent Out');//show message 'pleasae select a DVD
if (edPrice.Text='') then//if the edprice field is left blank
then
showmessage('Please Check The Rental Price Per Day of The DVD On The Table on The Right and Enter This In the Price Of DVD Field');//show the message 'Please Check The Rental Price Per Day of The DVD On The Table on The Right and Enter This In the Price Of DVD'
begin
Adoloans.open;//open adoloans
if adoloans.locate('dvdid',strtoint(DBEdit1.text),[]) then//if the content of dbedit1 is equal to that in the loans table then
showmessage('Already on loan')//show the message 'already on loan'
else//else
begin//begin
xmem:= strtoint(dblkcbxmembers.text);//
adoqtoomany.Parameters[0].value:=xmem;
adoqtoomany.Close;
adoqtoomany.Open;
if ADOQtoomany.recordcount>=3 then
showmessage ('You Can Only Borrow A Maximum of 3 DVD''s')
else
begin
ADOLoans.Append;//append the loans table
ADOloans ['memberId']:=strtoint(dblkcbxmembers.text);//add whatever is in the dblkcbmembers field into the field named 'memberid' in the access table called loans
ADOloans ['DVDid']:=strtoint(dbedit1.text);//add whatver is in dbedit1 to the access table called loans in the field 'dvdid'
AdoLoans ['DateBorrowed']:=date;
AdoLoans ['price']:=2*adofilms['priceperday'];
AdoLoans ['DateBack']:=date+2;//add 2 to the 'dateback' field
showmessage('DVD Has Been Rented');
Adoloans.post;
Adoloans.close;
Adoloans.open;
end;
end;
end;
end;
procedure TFMRentOutaDVD.Button1Click(Sender: TObject);
begin
fmmenu.show;
end;
procedure TFMRentOutaDVD.Button2Click(Sender: TObject);
var dpmm:integer;
begin
//now print out confirmation recipet.
with printer do
begin
dpmm:=pagewidth div 210;
begindoc;
with canvas do
begin
font.size:=16;//font size to be printed
font.name:='comic sans MS';//font type
font.style:=[fsbold];
textout(20*dpmm,20*dpmm,'K Rentals - Recipt **Customer copy**');
font.size:=14;
font.style:=[];
adoloans.Last;
textout(20*dpmm,30*dpmm,'Member ID :'+dblkcbxmembers.Text);
in that position on the paper display 'member id'
textout(20*dpmm,40*dpmm,'Member Name:'+DBEdit2.Text);
in that position on the paper display 'member name'
textout(20*dpmm,50*dpmm,'DVD Tittle :'+dblkcbxdvd.text);
in that position on the paper display 'dvd title'
textout(20*dpmm,60*dpmm,'DVD ID :'+DBEdit1.text);
textout(20*dpmm,70*dpmm,'Date Borrowed :' +datetostr(adoloans['dateborrowed']));
textout(20*dpmm,80*dpmm,'Return Date :' +datetostr(adoloans['dateback']));
textout(20*dpmm,90*dpmm,'Price Of DVD : £' +currtostr(adoloans['price']));
showmessage ('Recipt Is Being Printed')
end;
enddoc;
end;
end;
end.
unit UReturnedDVDs;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls, Mask, DBCtrls, Grids, DBGrids;
type
TFmReturnedDvds = class(TForm)
BtnRent: TButton;
DBGrid1: TDBGrid;
Label2: TLabel;
DSFilms: TDataSource;
ADOFilms: TADOTable;
ADOMembers: TADOTable;
DSMembers: TDataSource;
DSLoans: TDataSource;
ADOLoans: TADOTable;
dblkcbxmembers: TDBLookupComboBox;
DBEdit1: TDBEdit;
Label1: TLabel;
Label3: TLabel;
Button1: TButton;
DBEdit2: TDBEdit;
Label4: TLabel;
procedure dblkcbxmembersClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure BtnRentClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FmReturnedDvds: TFmReturnedDvds;
implementation
uses Umenu;
{$R *.dfm}
procedure TFmReturnedDvds.BtnRentClick(Sender: TObject);
var xmem:string;
begin
if(dblkcbxmembers.text='') then//if the content of dblkcbmembers is empty
showmessage ('Please Select A Member')//showmessage 'please select a member'
else//otherwise
begin//begin
xmem:=dblkcbxmembers.text;//if assign dblkcbxmembers to the variable xmem
adoloans.locate('memberid',xmem,[]);//loacate the field in access table loans called 'memberid'
adoloans.Delete;//then delete that record from the table
showmessage ('DVD Has Been Returned')//show message 'DVD has been returned'
end;
end;
procedure TFmReturnedDvds.Button1Click(Sender: TObject);
begin
fmmenu.show;
end;
procedure TFmReturnedDvds.dblkcbxmembersClick(Sender: TObject);
begin
begin
adofilms.locate('DVDid',dbedit1.Text,[]);
// edit1.Text:=adofilms['filmtitle'];
end;
end;
end.
unit ULoansOverdue;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, Grids, DBGrids,printers, ADODB;
type
TFmLoansOverdue = class(TForm)
ADOQuery1: TADOQuery;
DBGrid1: TDBGrid;
DSQuery: TDataSource;
Button1: TButton;
BtnActivateQuery: TButton;
Label1: TLabel;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure BtnActivateQueryClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FmLoansOverdue: TFmLoansOverdue;
implementation
uses Umenu;
{$R *.dfm}
procedure TFmLoansOverdue.Button1Click(Sender: TObject);
var dpmm,row:integer;
begin
//now print out confirmation recipet.
with printer do
begin
dpmm:=pagewidth div 210;
begindoc;
with canvas do
begin
font.size:=16;
font.name:='comic sans MS';
font.style:=[fsbold];
textout(05*dpmm,01*dpmm,'K Rentals - Overdue Loans');
font.size:=12;
font.style:=[];
adoquery1.open;
adoquery1.First;
row:=30;
textout(08*dpmm,20*dpmm,'Member ID ');
textout(35*dpmm,20*dpmm,'DVD ID ');
textout(60*dpmm,20*dpmm,'Date Rented ');
textout(92*dpmm,20*dpmm,'Date Back ');
textout(120*dpmm,20*dpmm,'Film Title ');
textout(180*dpmm,20*dpmm,'Loan ID :');
while not adoquery1.eof do
begin
textout(20*dpmm,row*dpmm,inttostr(adoquery1['memberid']));
textout(40*dpmm,row*dpmm,inttostr(adoquery1['DVDId']));
textout(60*dpmm,row*dpmm,datetostr(adoquery1['Dateborrowed']));
textout(90*dpmm,row*dpmm,datetostr(adoquery1['Dateback']));
textout(120*dpmm,row*dpmm,adoquery1['FilmTitle']);
textout(182*dpmm,row*dpmm,inttostr(adoquery1['LoanID']));
adoquery1.next;
row:=row+10;
showmessage ('The List is Being Printed')
end;
end;
enddoc;
end;
end;
procedure TFmLoansOverdue.BtnActivateQueryClick(Sender: TObject);
begin
ADOQuery1.Active:=true;//actuvates the adoquery1
showmessage ('All Overdue Loans Have Been Gathered')
end;
procedure TFmLoansOverdue.FormActivate(Sender: TObject);
begin
ADOQuery1.Active:=false;
end;
procedure TFmLoansOverdue.Button2Click(Sender: TObject);
begin
fmmenu.show;
end;
end.
User Manual
. Brief Introduction
This system was designed to aid the renting of DVDs at a DVD rental shop. It allows customer details and DVD details to be recorded in a database with a member ID and DVD ID generated and assigned with them. It also allows the user to rent out DVDs to members and while doing so a record is created on who borrowed the DVD and what that DVD was called and also calculates the rental price. After a rental has been made it allows the user to print out a receipt for the customer. It restricts also the number of DVD's a member can borrow and tells the member whether a certain DVD is in stock or not. The system can also generate a list of all the rentals which are overdue so that the user/shop owner can give them a late fine. This list can also be printed out.
2. Installation Instructions
To install the system you first insert the CD-R with the system on it into the CD drive and then click on 'My Computer which looks like this:
Clicking on this, will open a window, you then click the CD-Rom drive, this will then show you the contents if the CD-R. Then you copy the.exe file to the local drive. Then create a new folder named 'DVD Rental System' and copy the PrDVDRentalsystem.exe into this folder. Then right click this icon and click on create a shortcut to the desktop. In future you can then use this icon to directly open up the system and use it. Also make sure you have the software Microsoft Access installed on your computer as for this system to function, this is required.
3. Tutorial Guide
Setting up a Username and Password Form
First of all to have access to the system you will have setup a username and password. This should be carried out when you first run the program. A form like the one below should appear:
You then enter the username you want and the password you want. When you have finished choosing you username and password you then click on the 'Save Username and Password' button. This will then save your username and password to the 'Usernames and Passwords' table. Now you will be able to log in to the system.
Login Form
Now that you have setup a username and password, you can now login to the system by entering your new username and password, which has to be valid into the Login Form. This is displayed below.
Main Menu Form
Once you have logged into the system with a valid username and password you will see the 'Main Menu' Form, which is displayed below:
From this form you will be able to access the different functions of this system by clicking on the buttons which displayed that specific form. These functions/forms include:
* Register A Member
* Add New DVD's
* Rent Out a DVD
* Gather Overdue Loans
(Note. These functions can only be accessed if you have been cleared through the login page with a valid username and password)
Register a Member
The register a member function can be accessed by the user via the main menu form by clicking on the 'register a member' button. On this form the user can register a new member with the shop with all the details of that new member, such as forename, surname, address etc saved into the 'Members' table.
All the fields that have a * must be entered otherwise the system will not add the data to the database and will display an error message
Also if the user wanted to delete a member from the shop, he could do this by using the minus button found on the navigator bar.
If the user wanted to return to the main menu, he or she can access this by click on the 'return to main menu' button.
.
Add New DVD's Form
The adding a new DVD function can be accessed by the user via the main menu form by clicking on the 'Add New DVD' button. On this form the user can enter the details of the DVD, such as film title, genre, length etc that they are adding to the existing catalogue and save this in the 'Films Table'
If the user wants to remove a DVD from the catalogue they can do this using the minus button found on the navigator bar.
If the 'Film title' field and the 'Price per Day' field aren't entered an error message will pop up asking the user to enter these fields as they are mandatory.
Rent Out a DVD Form
If a user wanted to rent out a DVD to a member, this form should be accessed via the main menu. The user should then select the ID of the member who wishes to borrow a DVD and also select the ID of the DVD the member wishes to borrow. This can be selected in the combo boxes on the form. The user should enter the rental price of that DVD by gaining the price information of that DVD using the grid on the right. This outlines to the user how much a certain DVD is going to cost the member to borrow.
Once a member ID and DVD ID has been selected then the user should click on the 'Rent' button. This button will save the details to the 'Loans' table and a receipt can be printed and given to the member using the 'Print' button.
If the member who wishes to borrow a DVD has 3 DVDs already on loan then he or she cannot borrow any more DVDs until those DVDs are brought back to the shop and the loan record deleted.
Also if a specific DVD is already on loan to another member then a message will pop up to tell the user that this DVD is 'Already on Loan'.
Return DVD Form
This function is used when a member returns a DVD back to the shop. The user selects the ID of that member from the combo box and then clicks on the 'Return' button. This button then removes the record for that loan from the 'Loans' table.
Loans Overdue Form
This function can be used by the user to gather a list of all the loans which are overdue so that the user can fine the member who has not brought back the DVD on time. The list can be gathered using 'Click to gather a list of all overdue loans'. The list can then be printed off.
4. Error Messages
This error message occurs if the user has entered the wrong username or password or an unauthorised person is trying to log into the system. If this error message occurs then the user should make sure that he or she has entered the correct username and password.
This error message pops up when the user hasn't typed in the film title of the DVD he is trying to add to the catalogue. To solve this he should enter the title of the DVD into that field.
This error message is displayed when a member who wants to borrow a DVD already has a maximum of 3 DVD's on loan so he or she cannot borrow anymore DVDs until they have brought those back. To overcome this problem the user must get the member to bring that DVD and return it to the shop.
This error message is displayed when the user tries to rent out a DVD to a member that is already on loan.
Feasibility of potential Solution
There a number of alternative solutions to come up with a suitable solution for this problem. These can include:
Program solution
I could come up with a bespoke program for the shop clerk to use. This could be programmed using Delphi which I have decent knowledge of.
I could create menus with buttons and use text boxes for entering data. I could then create files of records to store data which could then be manipulated.
The advantages of using Delphi are:
* Increased flexibility allowing me to be able to fulfil the user requirements more easily.
* The user interfaces can be very similar to the widely used 'windows' style
* Files can be created to store data
* Hint messages and error messages are available to help when errors occur.
* Formatted designs can be designed and printed easily.
* The user doesn't need to buy the software, the .exe file can just be saved
The disadvantages of using Delphi are:
* You need to have a decent knowledge of the programming language to be able to be able to come up with an efficient solution
* Takes longer to do the file handling
* More error prone with incorrect syntax's in code
Application Package
The problem could be tackled using a database package such as Microsoft Access. The software would have bought and installed on the system though.
I could create table and link them with key fields. Then create forms and use them as the user interface, they would have buttons on them to access the next form. The menu form would be created using a switchboard
The advantages of using Access are:
* Can add and delete data easily
* Can link tables together using foreign keys
* Data entry is simplified using forms
* Quicker access to data using indexing
The disadvantages of using Access are:
* :limited programming capabilities
* Les control on how the system will look visually
* Limitations to control how the files of records are handled. Have e to specify certain criteria
* The user would also need to buy the software rights to use th system which is costly.
Mix of Delphi and Access
I could use both an application package and a software developing program. This will allow me to use the benefits of both solutions.
* Setup tables in Access and relate to the Delphi program
* Create fields and adjust them easily in Access, an also create validation rules.
* It will give me more contrail with the Delphi programming language to carry out complicated tasks.
* More freedom with display and layout of the program in Delphi.
* Don't have to worry about complex file handling
The disadvantages:
* Will still need to purchase a copy of Microsoft Access
* Need to know how to link both programs together
Justification of Chosen Solution
The solution I've decided to use is to use both the software developing program together with Microsoft Access. I reached my decision after concluding with the shop clerk who said this was the better than the other 2 solutions. Using this solution will give me more control on the size and layout of the system. It will give me the opportunity to make it user friendly and make it easier to use. Delphi will allow me to use more programming code and I will be able create much more complicated processes using this programming language. Using an application package would give me limited control on the layout and structure of the program which in turn will reduce the user friendliness of the system, but how ever this could be overcome this using Delphi. I can use the application package to easily create related tables with the required fields and then link them to the Delphi program. I will need to create tables which will store member details, DVD details, and Loan details. Handling the tables and validating is easier and simpler in Access. I can use the inbuilt validation options in Access to make sure data is valid before it's stored in the tables. So in conclusion I think using a mix of Access and Delphi I will be able to come up with a solution which best meets the user's requirements.
AQA Computing Coursework
Kamrul Hassan