Beruflich Dokumente
Kultur Dokumente
In
Database Management
System
CAR RENTAL SYSTEM DOCUMENTATION
Submitted By:
Cabunot, Joanna Marie
Lubrico, Janen
Magallanes, Mary Cris
Nahudan, Eiman
Submitted To:
Ms. Marinella T. Tose
Car Rental System Analysis
deposit and the no_of_days are kept. In returning the car the
N N
Cus_Id
Deposit RENTS N Lastname
RETURN
N Date_rented
Date_rent Firstname
Date_returned
No_of_days Birthdate
Processed_By
Amount Telephone_No
Car_Id *
Car_Id* Address
Cus_Id*
Cus_Id* N
N
Car_Id
Plate_no
Car_name
Brand
Color
Speed
Rental
ISSUED BY
Car_Id*
Emp_Id Emp_Id
1
Lastname
Firstname
Address
Position
Birthdate
Telephon
e_no
Cellphone
_no
customertable
Cus_ Lastna Firstna Cellphone_
Address Telephone_no Birthdate
Id me me no
1 Magallan Marycris caumpang 584641976 4545485 12/25/2008
es
2 Bacus Ricky RQEREQR 56624 776 10/6/2008
3 ColumbrRheanet XFGVSZDV 65378 5464563 9/30/2008
es te
4 De asisShiella sdjfsadkjfsd 992 0918 10/6/2008
5 Ablao Gian SDFASDFDS 9919191 0919 3/18/1989
Carlo
6 Gubante Ferr jdafsda 9912345 0905123456 9/29/2008
s Jane
employeetable
Emp_ Firstnam Addre Telephone cellphone Birthdat Date_hir MyPositi
Lastname
Id e ss _no _no e ed on
1 LUBRICO JANEN FDGH 756765765 5475456 10/14/20 10/6/200 Cashier
DF 08 8
2 TWIEUTIWR TIRUTIR TWTW 4545 4545 9/30/200 12:00:00 cashier
UT T 8 AM
3 DACAY SHEENAM TABUK 993 90512345 10/6/200 12:00:00 manager
AE 8 AM
4 PANDAY HAZEL CHCO 993 90765432 10/22/20 12:00:00 cashier
21 08 AM
renttable
Cus_ Date_Ren No_of_da
Car_Id Amount Deposit Status
Id ted ys
1 2 10/15/200 2 1500 1500 2
8
returntable
Lastna Firstna Plate_ Carna
Date_Rented Date_Returned Process_by
me me No me
Magallan Marycris QQQ CRV 10/05/2008 10/07/2008 Janen
es 123
CARRENTAL
When a record is
successfully saved, this dialog box will appear.
FRMCUSTBL
did = DataGrid1.Columns(0).Text
If Not did = "" Then
custid = did
cust_opt = 2
frmnewcust.cmd_save.Caption = "Update"
frmnewcust.Show (1)
End If
End Sub
Call connectme
conn.Open
pr = InputBox("Please Enter Any Key to Search!" & Chr(10) & Chr(13) & "CUS
ID/LASTNAME/FIRSTNAME", "Searching...")
If pr = "" Then
Else
query = "SELECT * FROM customertable WHERE Lastname LIKE '" & pr & "%' or Firstname
LIKE '" & pr & "%' ORDER BY Lastname"
rs.Open query, conn
Set DataGrid1.DataSource = rs
End If
End Sub
did = DataGrid1.Columns(0).Text
Call myquery
If userlevel = 3 Then
Command1.Enabled = False
Command2.Enabled = False
Command4.Enabled = False
Else
Command1.Enabled = True
Command2.Enabled = True
Command4.Enabled = True
End If
End Sub
End Sub
FRMEMPTBL
did = DataGrid1.Columns(0).Text
If Not did = "" Then
empid = did
emp_opt = 2
frmnewemp.cmd_save.Caption = "Update"
frmnewemp.Show (1)
End If
End Sub
Call connectme
conn.Open
pr = InputBox("Please Enter Any Key to Search!" & Chr(10) & Chr(13) & "EMP
ID/LASTNAME/FIRSTNAME", "Searching...")
If pr = "" Then
Else
query = "SELECT * FROM employeetable WHERE Lastname LIKE '" & pr & "%' or
Firstname LIKE '" & pr & "%' ORDER BY Lastname"
rs.Open query, conn
Set DataGrid1.DataSource = rs
End If
End Sub
did = DataGrid1.Columns(0).Text
Call myquery
''************ USER LEVEL
If userlevel = 1 Then
Command1.Enabled = True
Command2.Enabled = True
Command4.Enabled = True
Else
Command1.Enabled = False
Command2.Enabled = False
Command4.Enabled = False
End If
End Sub
Call connectme
conn.Open
End Sub
Public Sub datgrid()
DataGrid1.Font.Size = 11
DataGrid1.Font.Name = "Arial"
DataGrid1.HeadFont.Size = 11
DataGrid1.HeadFont.Bold = True
DataGrid1.HeadFont.Name = "Arial"
DataGrid1.Columns(0).Caption = "Emp ID"
DataGrid1.Columns(0).Width = 1000
DataGrid1.Columns(4).Caption = "Telephone No."
DataGrid1.Columns(4).Width = 1700
DataGrid1.Columns(5).Caption = "CellPhone No."
DataGrid1.Columns(5).Width = 1600
DataGrid1.Columns(7).Caption = "Date Hired"
DataGrid1.Columns(7).Width = 1600
End Sub
FRMLOGIN
Call connectme
conn.Open
ssql = "SELECT * FROM myusers WHERE myusername='" & txt_user.Text & "' AND
mypassword='" & txt_pass.Text & "'"
rs.Open ssql, conn
If Not rs.EOF Then
With rs
userlevel = !user_level
myuser = txt_user.Text
frmcarrental.Enabled = True
Unload Me
End With
Else
MsgBox "Invalid username and password !", vbCritical, "KRIN"
txt_user.SetFocus
frmcarrental.Enabled = False
End If
conn.Close
End Sub
FRMNEWCUST
Else
If cust_opt = 1 Then
Call addrec
MsgBox "Record was successfully saved!", vbInformation, "KRIN"
Unload Me
ElseIf cust_opt = 2 Then
Call editrec
MsgBox "Record was successfully updated!", vbInformation, "KRIN"
End If
Call frmcustbl.myquery
End If
End Sub
Call connectme
If cust_opt = 2 Then
conn.Open
ssqlsub = "SELECT * FROM customertable WHERE Cus_Id=" & custid
rs2.Open ssqlsub, conn
End With
End If
conn.Close
End If
End Sub
Public Sub addrec()
End Sub
Public Sub editrec()
End Sub
FRMNEWEMP
Else
If emp_opt = 1 Then
Call addrec
MsgBox "Record was successfully saved!", vbInformation, "KRIN"
Unload Me
ElseIf emp_opt = 2 Then
Call editrec
MsgBox "Record was successfully updated!", vbInformation, "KRIN"
End If
Call frmemptbl.myquery
End If
End Sub
Call connectme
If emp_opt = 2 Then
conn.Open
ssqlsub = "SELECT * FROM employeetable WHERE Emp_Id=" & empid
rs2.Open ssqlsub, conn
End With
End If
conn.Close
End If
End Sub
Public Sub addrec()
End Sub
Public Sub editrec()
End Sub
FRMNEWRENT
Else
If rent_opt = 1 Then
Call addrec
MsgBox "Record was successfully saved!", vbInformation, "KRIN"
Unload Me
ElseIf rent_opt = 2 Then
Call editrec
MsgBox "Record was successfully updated!", vbInformation, "KRIN"
End If
Call frmrenttbl.myquery
End If
End Sub
End If
End Sub
Call connectme
conn.Open
If rent_opt = 2 Then
End With
txt_days.Text = !No_of_days
txt_due.Text = !Amount
txt_deposit.Text = !Deposit
End With
End If
End If
End Sub
Public Sub addrec()
End Sub
Public Sub editrec()
End Sub
Private Sub txt_days_Change()
If Not txt_days.Text = "" Then
txt_due.Text = Val(txt_rental.Text) * Val(txt_days.Text)
txt_due.Text = Format(txt_due.Text, "#########.00")
End If
End Sub
End If
End Sub
Public Sub clearme()
txt_carid.Text = ""
txt_carname.Text = ""
txt_color.Text = ""
txt_rental.Text = ""
End Sub
FRMRENTBL
did = DataGrid1.Columns(0).Text
If Not did = "" Then
rentid = did
rent_opt = 1
frmnewrent.cmd_save.Caption = "Update"
frmnewrent.Show (1)
End If
End Sub
Call connectme
conn.Open
pr = InputBox("Please Enter Any Key to Search!" & Chr(10) & Chr(13) & "PLATE
NO./CUSTOMER ", "Searching...")
If pr = "" Then
End Sub
did = DataGrid1.Columns(0).Text
lastname = DataGrid1.Columns(1).Text
firstname = DataGrid1.Columns(2).Text
plateno = DataGrid1.Columns(3).Text
carname = DataGrid1.Columns(4).Text
daterent = DataGrid1.Columns(5).Text
dateret = Format(Now, "mm/dd/yyyy")
If Not did = "" Then
confirm = MsgBox("This will RETURN the Car Now?..proceed anyway!", vbOKCancel +
vbExclamation, "Warning!")
If confirm = vbOK Then
Call connectme
conn.Open
conn.Execute "Update cartable set Status='1' WHERE Plate_no='" & plateno & "'"
conn.Execute "Update renttable set Status='2' WHERE Rent_Id=" & did
conn.Execute "Insert into
returntable(Rent_Id,lastname,firstname,Plate_No,Carname,Date_Rented,Date_Returned,Proc
ess_by) VALUES ('" & did & "','" & lastname & "','" & firstname & "','" & plateno & "','" &
carname & "','" & daterent & "','" & dateret & "','" & myuser & "')"
MsgBox "The Return Transaction was successfully saved!", vbInformation
conn.Close
Call myquery
End If
Else
MsgBox "There are no records to delete!", vbCritical
End If
End Sub
If userlevel = 3 Then
Command1.Enabled = False
Command2.Enabled = False
Command4.Enabled = False
Else
Command1.Enabled = True
Command2.Enabled = True
Command4.Enabled = True
End If
End Sub
Call connectme
conn.Open
query = "SELECT
c.Rent_ID,a.lastname,a.firstname,b.Plate_No,b.Brand,c.Date_Rented,c.No_of_days FROM
customertable a, cartable b, renttable c WHERE a.Cus_Id = c.Cus_Id AND b.Car_Id =
c.Car_Id AND c.Status='1' ORDER BY c.Date_Rented DESC"
rs.Open query, conn
Set DataGrid1.DataSource = rs
End Sub
Public Sub datgrid()
DataGrid1.Font.Size = 11
DataGrid1.Font.Name = "Arial"
DataGrid1.HeadFont.Size = 11
DataGrid1.HeadFont.Bold = True
DataGrid1.HeadFont.Name = "Arial"
DataGrid1.Columns(0).Caption = "Rent ID"
DataGrid1.Columns(0).Width = 1000
DataGrid1.Columns(1).Caption = "Lastname"
DataGrid1.Columns(1).Width = 2000
DataGrid1.Columns(2).Caption = "Firstname"
DataGrid1.Columns(2).Width = 2000
DataGrid1.Columns(3).Caption = "Plate NO."
DataGrid1.Columns(3).Width = 1200
DataGrid1.Columns(4).Caption = "Car Name"
DataGrid1.Columns(4).Width = 2400
DataGrid1.Columns(5).Caption = "Date Rented"
DataGrid1.Columns(5).Width = 1200
DataGrid1.Columns(6).Caption = "No.Days"
DataGrid1.Columns(6).Width = 1200
End Sub
FRMRETURNTBL
query = "SELECT * FROM returntable WHERE Date_Returned='" & dtsearch.Value & "'
ORDER BY lastname"
rs.Open query, conn
Set DataGrid1.DataSource = rs
Call datgrid
End Sub
Call connectme
conn.Open
pr = InputBox("Please Enter Any Key to Search!" & Chr(10) & Chr(13) &
"LASTNAME/FIRSTNAME", "Searching...")
If pr = "" Then
ElseIf Val(pr) >= 1 Then
Else
query = "SELECT * FROM returntable WHERE Lastname LIKE '" & pr & "%' or Firstname
LIKE '" & pr & "%'"
rs.Open query, conn
Set DataGrid1.DataSource = rs
End If
End Sub
Private Sub Command5_Click()
Unload Me
End Sub
Private Sub Form_Load()
Call myquery
End Sub
Call connectme
conn.Open
End Sub
Public Sub datgrid()
DataGrid1.Font.Size = 11
DataGrid1.Font.Name = "Arial"
DataGrid1.HeadFont.Size = 11
DataGrid1.HeadFont.Bold = True
DataGrid1.HeadFont.Name = "Arial"
DataGrid1.Columns(0).Caption = "Ret. ID"
DataGrid1.Columns(0).Width = 1000
DataGrid1.Columns(1).Width = 0
DataGrid1.Columns(2).Width = 3200
End Sub
Else
If car_opt = 1 Then
Call addrec
MsgBox "Record was successfully saved!", vbInformation, "KRIN"
Unload Me
ElseIf car_opt = 2 Then
Call editrec
MsgBox "Record was successfully updated!", vbInformation, "KRIN"
Unload Me
End If
Call frmcartbl.myquery
End If
End Sub
Call connectme
If car_opt = 2 Then
conn.Open
ssqlsub = "SELECT * FROM cartable WHERE Car_Id=" & carid
rs2.Open ssqlsub, conn
End Sub
Public Sub addrec()
End Sub
Public Sub editrec()
End Sub
Class Module
Global variable
Public userlevel
Public myuser
Public rent_opt
Public rentid
Public emp_opt
Public empid
Public cust_opt
Public custid
Public car_opt
Public carid
Option Explicit
Public conn As ADODB.Connection
Public rs As ADODB.Recordset
End Function