├── CarRental ├── available.php ├── book.html ├── cars.html ├── chauffeur.html ├── customer.html ├── images │ ├── 1.jpg │ ├── 2.jpg │ ├── 3.jpg │ ├── 4.jpg │ ├── 44.jpg │ ├── 45.jpg │ ├── 5.jpeg │ ├── 6.jpg │ ├── menuBackground.png │ └── pageBackground.jpg ├── index.html ├── pstyles.css ├── regchauffeur.php ├── regcustomer.php ├── registercar.php ├── report.html ├── report.php ├── report1.php ├── report2.php ├── return.html ├── return.php ├── styles.css ├── update.php ├── viewcar.php ├── viewchauffeur.php ├── viewcustomer.php └── viewrental.php ├── Create_Tables.sql ├── README.md └── Schema_Diagram.pdf /CarRental/available.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 22 | =1) { 27 | $num=$Noweeks*7; 28 | $D2=date('Y-m-d', strtotime($Sdate. ' + $num days')); 29 | } 30 | 31 | if ((mysqli_num_rows($result) > 0) || (strtotime($Sdate) > strtotime($D2))) { 32 | echo "

Congrats Vehicle is available


"; 33 | echo "

List of Available vehicles


"; 34 | while($row = mysqli_fetch_assoc($result)) 35 | { 36 | echo ""; echo ""; 37 | echo ""; 38 | } 39 | } 40 | else 41 | echo "Car is not available"; 42 | ?> 43 |
Vehicle ID
" . $row["vehicle_id"] . "
44 | 53 | 54 |
Active & Scheduled Rentals

"; 58 | ?> 59 |
60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 0) { 73 | while($row2 = mysqli_fetch_assoc($result2)) 74 | { 75 | echo ""; 76 | echo ""; 77 | echo ""; 78 | echo ""; 79 | echo ""; 80 | echo ""; 81 | echo ""; 82 | echo ""; 83 | echo ""; 84 | echo ""; 85 | } 86 | } 87 | ?> 88 |
RIDCustomer IDVehicle idCar typeRent typeStart DateNo of daysNo of weeks
" . $row2["Rid"] . "" . $row2["Cid"] . "" . $row2["Vehicle_id"] . "" . $row2["Ctype"] . "" . $row2["Rtype"] . "" . $row2["Sdate"] . "" . $row2["Nodays"] . "" . $row2["Noweeks"] . "
89 | 90 | -------------------------------------------------------------------------------- /CarRental/book.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | Car Rental 9 | 10 | 11 | 12 | 13 |

This Christmas 25% OFF on SUVs. Free Rides on first booking. Hurry Now

14 |
15 | 16 | 17 |
18 | 29 | 30 |
31 |
32 |

BOOK A CAR



33 | Enter Customer ID:

34 | Enter date yyyy-mm-dd:

35 | Select Car type:

43 | Rent type:

47 | No of days :

50 | No of weeks :

53 |

54 | 55 | Enter Vehicle id:

56 | 57 |
58 | 59 |
60 |
61 |

VIEW ACTIVE & SCHEDULED RENTALS

62 | 63 |
64 |
65 | 66 | 67 |
68 | 110 | 111 |
112 | 113 |
114 | 115 |
Back Next 116 | 117 | 118 |
119 | 120 | 121 | -------------------------------------------------------------------------------- /CarRental/cars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | Car Rental 9 | 10 | 11 | 12 | 13 |

This Christmas 25% OFF on SUVs. Free Rides on first booking. Hurry Now

14 |
15 | 16 | 17 |
18 | 29 | 30 |
31 |
32 |

ADD CAR

33 | License No:

34 | Model:

35 | Year :

36 | Car type:

44 | Car Owner:

49 |

Enter Owner Details :


50 | Unique ID:

51 | Name:

52 | City :

53 | 54 |
55 |
56 | 57 | 58 |
59 |

VIEW CARS & RATES

60 |
61 | Select Car type to view: 69 | 70 |
71 | 72 |



73 | 74 |

UPDATE RENTAL RATES

75 |
76 | Select Car type to update:

84 | Daily Rate:

85 | Weekly Rate:

86 | 87 |
88 |
89 | 90 | 91 | -------------------------------------------------------------------------------- /CarRental/chauffeur.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | Car Rental 9 | 10 | 11 | 12 | 13 |

This Christmas 25% OFF on SUVs. Free Rides on first booking. Hurry Now

14 |
15 | 16 | 17 |
18 | 29 |
30 |
31 |

ADD CHAUFFEUR

32 | First Name:

33 | Last Name:

34 | Age :

35 | Mobile:

36 | Driving License No:

37 | 38 | 39 |
40 |
41 | 42 | 43 |
44 |
45 |

VIEW CHAUFFEURS

46 | 47 |
48 |
49 | 50 | 51 | -------------------------------------------------------------------------------- /CarRental/customer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | Car Rental 9 | 10 | 11 | 12 | 13 |

This Christmas 25% OFF on SUVs. Free Rides on first booking. Hurry Now

14 |
15 | 16 | 17 |
18 | 29 |
30 |
31 |

ADD CUSTOMER

32 | First Name:

33 | Last Name:

34 | Age :

35 | Mobile:

36 | Driving License No:

37 | Insurance No:

38 | 39 |
40 |
41 | 42 | 43 |
44 |
45 |

VIEW CUSTOMERS

46 | 47 |
48 |
49 | 50 | 51 | -------------------------------------------------------------------------------- /CarRental/images/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhanukarajat/car-rental/33eefab4e1626140cc19433e8872a2964ef68ee2/CarRental/images/1.jpg -------------------------------------------------------------------------------- /CarRental/images/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhanukarajat/car-rental/33eefab4e1626140cc19433e8872a2964ef68ee2/CarRental/images/2.jpg -------------------------------------------------------------------------------- /CarRental/images/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhanukarajat/car-rental/33eefab4e1626140cc19433e8872a2964ef68ee2/CarRental/images/3.jpg -------------------------------------------------------------------------------- /CarRental/images/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhanukarajat/car-rental/33eefab4e1626140cc19433e8872a2964ef68ee2/CarRental/images/4.jpg -------------------------------------------------------------------------------- /CarRental/images/44.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhanukarajat/car-rental/33eefab4e1626140cc19433e8872a2964ef68ee2/CarRental/images/44.jpg -------------------------------------------------------------------------------- /CarRental/images/45.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhanukarajat/car-rental/33eefab4e1626140cc19433e8872a2964ef68ee2/CarRental/images/45.jpg -------------------------------------------------------------------------------- /CarRental/images/5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhanukarajat/car-rental/33eefab4e1626140cc19433e8872a2964ef68ee2/CarRental/images/5.jpeg -------------------------------------------------------------------------------- /CarRental/images/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhanukarajat/car-rental/33eefab4e1626140cc19433e8872a2964ef68ee2/CarRental/images/6.jpg -------------------------------------------------------------------------------- /CarRental/images/menuBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhanukarajat/car-rental/33eefab4e1626140cc19433e8872a2964ef68ee2/CarRental/images/menuBackground.png -------------------------------------------------------------------------------- /CarRental/images/pageBackground.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhanukarajat/car-rental/33eefab4e1626140cc19433e8872a2964ef68ee2/CarRental/images/pageBackground.jpg -------------------------------------------------------------------------------- /CarRental/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | Car Rental 10 | 11 | 12 | 13 | 14 |

This Christmas 25% OFF on SUVs. Free Rides on first booking. Hurry Now

15 | 16 | 17 |
18 |
19 | 20 | 38 | 39 | 40 |
41 | 42 | 47 | 48 |
49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /CarRental/pstyles.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin:0; 3 | padding:0; 4 | } 5 | body { 6 | font-family:Arial, Helvetica, sans-serif; 7 | font-size:12px; 8 | background:#000000 no-repeat center top; 9 | color: #ffffff; 10 | } 11 | a { 12 | color:#ff9c00; 13 | text-decoration:underline; 14 | } 15 | a:hover { 16 | color:#ff9c00; 17 | text-decoration:none; 18 | } 19 | #container { 20 | width: 100%; 21 | } 22 | #header { 23 | width:100%; 24 | } 25 | .logoBackground { 26 | background:#000000; 27 | width:300px; 28 | } 29 | .logo { 30 | color:#ff9c00; 31 | font-size:60px; 32 | padding:10px 0 0 30px; 33 | } 34 | .author { 35 | padding:0 0 10px 30px; 36 | color:#707070; 37 | } 38 | .author a { 39 | color:#707070; 40 | } 41 | .menu { 42 | background:url(images/menuBackground.png) repeat-x left top; 43 | height:103px; 44 | text-align:center; 45 | 46 | } 47 | .menu ul { 48 | margin:0; 49 | padding-top:32px; 50 | } 51 | .menu li { 52 | list-style:none; 53 | display:inline; 54 | padding:20px 15px 0 15px; 55 | } 56 | .menu li a { 57 | color:#ffffff; 58 | font-size:24px; 59 | text-decoration:none; 60 | } 61 | .menu li a:hover { 62 | color:#ff9c00; 63 | font-size:24px; 64 | text-decoration:none; 65 | } 66 | .menu #active a { 67 | color:#ff9c00; 68 | font-size:24px; 69 | text-decoration:none; 70 | } 71 | .allContent { 72 | width:800px; 73 | margin:0 auto; 74 | padding:130px 0 0 0; 75 | } 76 | .leftContent p, .rightContent p { 77 | padding:40px; 78 | } 79 | .leftContent { 80 | float:left; 81 | width:400px; 82 | background:url(images/leftContent.png) repeat-y left top; 83 | } 84 | .rightContent { 85 | margin-left:436px; 86 | width:364px; 87 | background:url(images/rightContent.png) repeat-y left top; 88 | } 89 | .rightContent ul { 90 | margin:0; 91 | padding:0 40px; 92 | } 93 | .rightContent li { 94 | list-style:none; 95 | padding:0 0 20px 0; 96 | } 97 | #footer { 98 | text-align:center; 99 | color:#707070; 100 | padding:30px 0; 101 | } 102 | .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */ 103 | clear:both; 104 | height:0; 105 | font-size: 1px; 106 | line-height: 0px; 107 | } -------------------------------------------------------------------------------- /CarRental/regchauffeur.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | New chauffeur has been successfully added

"; 22 | ?> 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /CarRental/regcustomer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | New customer has been successfully added

"; 22 | ?> 23 | Customer ID is :".$row["Cid"]; 29 | } 30 | ?> 31 | 32 | 33 | -------------------------------------------------------------------------------- /CarRental/registercar.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | New car has been successfully added"; 29 | 30 | if($Name1=="Individual") { 31 | $result="INSERT INTO individual(Ssn,Name,City) VALUES('$Ssn','$Name','$City')"; 32 | } 33 | else if($Name1=="Bank") { 34 | $result="INSERT INTO bank(Bid,Bname,City) VALUES('$Bid','$Bname','$City')"; 35 | } 36 | else { 37 | $result="INSERT INTO company(Compid,Cname,City) VALUES('$Compid','$Cname','$City')"; 38 | } 39 | mysqli_query($connection,$result) or die(mysqli_error($connection)); 40 | echo "

New owner has been successfully added

"; 41 | ?> 42 | Vehicle ID is :".$row1["Vehicle_id"]; 47 | $Vehicle_id=$row1["Vehicle_id"]; } 48 | 49 | if($Name1=="Individual") { 50 | $res1="SELECT Owner_id from individual where Ssn='$Ssn'"; 51 | $result3=mysqli_query($connection,$res1); 52 | while($row2 = mysqli_fetch_assoc($result3)) { 53 | echo "

Owner ID is :

".$row2["Owner_id"]; 54 | $Owner_id=$row2["Owner_id"];} 55 | } 56 | else if($Name1=="Bank") { 57 | $res1="SELECT Owner_id from bank where Bid='$Bid'"; 58 | $result3=mysqli_query($connection,$res1); 59 | while($row2 = mysqli_fetch_assoc($result3)) { 60 | echo "

Vehicle ID is :

".$row2["Owner_id"]; 61 | $Owner_id=$row2["Owner_id"];} 62 | } 63 | else { 64 | $res1="SELECT Owner_id from company where Compid='$Compid'"; 65 | $result3=mysqli_query($connection,$res1); 66 | while($row2 = mysqli_fetch_assoc($result3)) { 67 | echo "

Vehicle ID is :

".$row2["Owner_id"]; 68 | $Owner_id=$row2["Owner_id"];} 69 | } 70 | 71 | $result1="INSERT INTO owns(Vehicle_id,Owner_id,Ctype) VALUES('$Vehicle_id','$Owner_id','$Ctype')"; 72 | mysqli_query($connection,$result1) or die(mysqli_error($connection)); 73 | ?> 74 | 75 | 76 | -------------------------------------------------------------------------------- /CarRental/report.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | Car Rental 9 | 10 | 11 | 12 | 13 |

This Christmas 25% OFF on SUVs. Free Rides on first booking. Hurry Now

14 |
15 | 16 | 17 |
18 | 29 | 30 |
31 |
32 |

View profits for owners :


33 | 34 |
35 |

36 |
37 |

View profits for Car types :


38 | 39 |
40 |

41 |
42 |

View profits for individual car units :


43 | 44 |
45 | 46 | 47 | -------------------------------------------------------------------------------- /CarRental/report.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
Profits according to owners

"; 18 | ?> 19 |
20 | 21 | 22 | 23 | 24 | 25 | 0) { 27 | while($row = mysqli_fetch_assoc($result)) 28 | { 29 | echo ""; 30 | echo ""; 31 | echo ""; 32 | echo ""; 33 | } 34 | } 35 | ?> 36 |
Owner idAmount
" . $row["Owner_id"] . "" . $row["Amount"] . "
37 | 38 | -------------------------------------------------------------------------------- /CarRental/report1.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
Profits according to car types

"; 18 | ?> 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 0) { 28 | while($row = mysqli_fetch_assoc($result)) 29 | { 30 | echo ""; 31 | echo ""; 32 | echo ""; 33 | echo ""; 34 | echo ""; 35 | } 36 | } 37 | ?> 38 |
Owner idCategoryEarnings
" . $row["Owner_id"] . "" . $row["Category"] . "" . $row["Earnings"] . "
39 | 40 | -------------------------------------------------------------------------------- /CarRental/report2.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
Profits according to individual cars

"; 19 | ?> 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 0) { 30 | while($row = mysqli_fetch_assoc($result)) 31 | { 32 | echo ""; 33 | echo ""; 34 | echo ""; 35 | echo ""; 36 | echo ""; 37 | echo ""; 38 | } 39 | } 40 | ?> 41 |
Owner idVehicle idAmountCar type
" . $row["Owner_id"] . "" . $row["Vid"] . "" . $row["Amount"] . "" . $row["Category"] . "
42 | 43 | -------------------------------------------------------------------------------- /CarRental/return.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | Car Rental 9 | 10 | 11 | 12 | 13 |

This Christmas 25% OFF on SUVs. Free Rides on first booking. Hurry Now

14 |
15 | 16 | 17 |
18 | 29 | 30 |
31 |
32 |

RENTAL BILL



33 | Enter Rental ID:

34 | 35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /CarRental/return.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
Amount due

"; 21 | $row1 = mysqli_fetch_assoc($result1); 22 | echo "

USD ".$row1["Amount"]."

"; 23 | } 24 | else{ 25 | $res2="select rental.Noweeks*rates.Wrate AS Amount FROM rental, rates where rental.rid='$Rid' and rental.Ctype=rates.Ctype"; 26 | $result2=mysqli_query($connection,$res2); 27 | echo "

Amount due



"; 28 | $row2 = mysqli_fetch_assoc($result2); 29 | echo "

USD ".$row2["Amount"]."

"; 30 | } 31 | ?> 32 | 33 | -------------------------------------------------------------------------------- /CarRental/styles.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin:0; 3 | padding:0; 4 | } 5 | body { 6 | font-family:Arial, Helvetica, sans-serif; 7 | font-size:12px; 8 | background:#000000 url(images/pageBackground.jpg) no-repeat center top; 9 | color: #ffffff; 10 | } 11 | a { 12 | color:#ff9c00; 13 | text-decoration:underline; 14 | } 15 | a:hover { 16 | color:#ff9c00; 17 | text-decoration:none; 18 | } 19 | #container { 20 | width: 100%; 21 | } 22 | #header { 23 | width:100%; 24 | } 25 | .logoBackground { 26 | background:#000000; 27 | width:300px; 28 | } 29 | .logo { 30 | color:#ff9c00; 31 | font-size:60px; 32 | padding:10px 0 0 30px; 33 | } 34 | .author { 35 | padding:0 0 10px 30px; 36 | color:#707070; 37 | } 38 | .author a { 39 | color:#707070; 40 | } 41 | .menu { 42 | background:url(images/menuBackground.png) repeat-x left top; 43 | height:103px; 44 | text-align:center; 45 | margin-top:265px; 46 | } 47 | .menu ul { 48 | margin:0; 49 | padding-top:32px; 50 | } 51 | .menu li { 52 | list-style:none; 53 | display:inline; 54 | padding:20px 15px 0 15px; 55 | } 56 | .menu li a { 57 | color:#ffffff; 58 | font-size:24px; 59 | text-decoration:none; 60 | } 61 | .menu li a:hover { 62 | color:#ff9c00; 63 | font-size:24px; 64 | text-decoration:none; 65 | } 66 | .menu #active a { 67 | color:#ff9c00; 68 | font-size:24px; 69 | text-decoration:none; 70 | } 71 | .allContent { 72 | width:800px; 73 | margin:0 auto; 74 | padding:130px 0 0 0; 75 | } 76 | .leftContent p, .rightContent p { 77 | padding:40px; 78 | } 79 | .leftContent { 80 | float:left; 81 | width:400px; 82 | background:url(images/leftContent.png) repeat-y left top; 83 | } 84 | .rightContent { 85 | margin-left:436px; 86 | width:364px; 87 | background:url(images/rightContent.png) repeat-y left top; 88 | } 89 | .rightContent ul { 90 | margin:0; 91 | padding:0 40px; 92 | } 93 | .rightContent li { 94 | list-style:none; 95 | padding:0 0 20px 0; 96 | } 97 | #footer { 98 | text-align:center; 99 | color:#707070; 100 | padding:30px 0; 101 | } 102 | .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */ 103 | clear:both; 104 | height:0; 105 | font-size: 1px; 106 | line-height: 0px; 107 | } -------------------------------------------------------------------------------- /CarRental/update.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
".$Ctype." Rates updated

"; 20 | ?> 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /CarRental/viewcar.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
".$Ctype." Cars

"; 18 | ?> 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 0) { 31 | while($row = mysqli_fetch_assoc($result)) 32 | { 33 | echo ""; 34 | echo ""; 35 | echo ""; 36 | echo ""; 37 | echo ""; 38 | echo ""; 39 | echo ""; 40 | echo ""; 41 | } 42 | } 43 | ?> 44 |
Vehicle IDLicense NoModelYearDaily RateWeekly Rate
" . $row["Vehicle_id"] . "" . $row["License_no"] . "" . $row["Model"] . "" . $row["Year"] . "" . $row["Daily_Rate"] . "" . $row["Weekly_Rate"] . "
45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /CarRental/viewchauffeur.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
Chaufffeurs

"; 15 | ?> 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 0) { 29 | while($row = mysqli_fetch_assoc($result)) 30 | { 31 | echo ""; 32 | echo ""; 33 | echo ""; 34 | echo ""; 35 | echo ""; 36 | echo ""; 37 | echo ""; 38 | 39 | echo ""; 40 | } 41 | } 42 | ?> 43 |
IDFNameLnameAgeMobileDl No.
" . $row["Chid"] . "" . $row["Fname"] . "" . $row["Lname"] . "" . $row["Age"] . "" . $row["Mobile"] . "" . $row["Dlno"] . "
44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /CarRental/viewcustomer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
Customers

"; 15 | ?> 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 0) { 28 | while($row = mysqli_fetch_assoc($result)) 29 | { 30 | echo ""; 31 | echo ""; 32 | echo ""; 33 | echo ""; 34 | echo ""; 35 | echo ""; 36 | echo ""; 37 | echo ""; 38 | } 39 | } 40 | ?> 41 |
FNameLnameAgeMobileDl No.Insurance No.
" . $row["Fname"] . "" . $row["Lname"] . "" . $row["AGE"] . "" . $row["Mobile"] . "" . $row["Dlno"] . "" . $row["InsNo"] . "
42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /CarRental/viewrental.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 |
Active & Scheduled Rentals

"; 18 | ?> 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 0) { 33 | while($row2 = mysqli_fetch_assoc($result2)) 34 | { 35 | echo ""; 36 | echo ""; 37 | echo ""; 38 | echo ""; 39 | echo ""; 40 | echo ""; 41 | echo ""; 42 | echo ""; 43 | echo ""; 44 | echo ""; 45 | } 46 | } 47 | ?> 48 |
RIDCustomer IDVehicle idCar typeRent typeStart DateNo of daysNo of weeks
" . $row2["Rid"] . "" . $row2["Cid"] . "" . $row2["Vehicle_id"] . "" . $row2["Ctype"] . "" . $row2["Rtype"] . "" . $row2["Sdate"] . "" . $row2["Nodays"] . "" . $row2["Noweeks"] . "
-------------------------------------------------------------------------------- /Create_Tables.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE CAR_RENTAL; 2 | 3 | USE CAR_RENTAL; 4 | 5 | CREATE TABLE IF NOT EXISTS CAR( 6 | Vehicle_id INT(10) NOT NULL , 7 | License_no VARCHAR(20), 8 | Model VARCHAR(20), 9 | Year DATE, 10 | Ctype VARCHAR(20), 11 | Drate INT(10), 12 | Wrate INT(10), 13 | Status VARCHAR(20), 14 | PRIMARY KEY (Vehicle_id), 15 | UNIQUE (License_no) 16 | ); 17 | 18 | CREATE TABLE IF NOT EXISTS CUSTOMER ( 19 | Cid INT(10) NOT NULL , 20 | Fname VARCHAR(1), 21 | Lname VARCHAR(20), 22 | Mobile INT(12), 23 | Dno INT(10), 24 | Vehicle_id INT(10), 25 | FOREIGN KEY (Dno) REFERENCES DRIVER(Dno) ON UPDATE CASCADE, 26 | FOREIGN KEY (Vehicle_id) REFERENCES CAR(Vehicle_id) ON UPDATE CASCADE, 27 | PRIMARY KEY (Cid) 28 | ); 29 | 30 | CREATE TABLE IF NOT EXISTS MEMBERS ( 31 | Mid INT(10) NOT NULL , 32 | Mtype VARCHAR(20), 33 | Discount INT(10), 34 | Duration VARCHAR(10), 35 | Cid INT(10), 36 | PRIMARY KEY (Mid), 37 | FOREIGN KEY (Cid) REFERENCES CUSTOMER(Cid) ON UPDATE CASCADE 38 | ); 39 | 40 | CREATE TABLE IF NOT EXISTS CUSTOMER_SERVICE( 41 | Empid INT(10) NOT NULL , 42 | Name VARCHAR(20), 43 | Mobile INT(12), 44 | PRIMARY KEY (Empid) 45 | ); 46 | 47 | CREATE TABLE IF NOT EXISTS FEEDBACK( 48 | Fid INT(10) NOT NULL , 49 | Message VARCHAR(140), 50 | Email VARCHAR(50), 51 | Empid INT(10), 52 | Cid INT(10), 53 | PRIMARY KEY (Fid), 54 | FOREIGN KEY (Empid) REFERENCES CUSTOMER_SERVICE(Empid) ON UPDATE CASCADE, 55 | FOREIGN KEY (Cid) REFERENCES CUSTOMER(Cid) ON UPDATE CASCADE, 56 | ); 57 | 58 | CREATE TABLE IF NOT EXISTS DRIVER( 59 | Dno INT(10) NOT NULL, 60 | PRIMARY KEY (Dno), 61 | ); 62 | 63 | CREATE TABLE IF NOT EXISTS SELF ( 64 | Dlno INT(10) NOT NULL, 65 | Name VARCHAR(20), 66 | Insurance_no INT(12), 67 | Dno INT(10), 68 | PRIMARY KEY (Dlno), 69 | FOREIGN KEY (Dno) REFERENCES DRIVER(Dno) ON UPDATE CASCADE, 70 | ); 71 | 72 | CREATE TABLE IF NOT EXISTS CHAUFFEUR ( 73 | Chid INT(10) NOT NULL, 74 | Name VARCHAR(20), 75 | Gender Varchar(10), 76 | Status VARCHAR(20), 77 | Mobile INT(12), 78 | Dno INT(10), 79 | PRIMARY KEY (Chid), 80 | FOREIGN KEY (Dno) REFERENCES DRIVER(Dno) ON UPDATE CASCADE, 81 | ); 82 | 83 | CREATE TABLE IF NOT EXISTS RENTAL ( 84 | Rid INT(10) NOT NULL , 85 | Rdate DATE, 86 | Amount INT(10), 87 | Dno INT(10), 88 | Vehicle_id INT(10), 89 | PRIMARY KEY (Rid), 90 | FOREIGN KEY (Vehicle_id) REFERENCES CAR(Vehicle_id) ON UPDATE CASCADE, 91 | FOREIGN KEY (Dno) REFERENCES DRIVER(Dno) ON UPDATE CASCADE, 92 | ); 93 | 94 | CREATE TABLE IF NOT EXISTS DAILY ( 95 | Rid INT(10) NOT NULL, 96 | Sdate DATE, 97 | Amount INT(10), 98 | Nodays INT(10), 99 | Vehicle_id INT(10), 100 | Dno INT(10), 101 | PRIMARY KEY (Rid), 102 | FOREIGN KEY (Rid) REFERENCES RENTAL(Rid) ON UPDATE CASCADE, 103 | FOREIGN KEY (Vehicle_id) REFERENCES CAR(Vehicle_id) ON UPDATE CASCADE, 104 | FOREIGN KEY (Dno) REFERENCES DRIVER(Dno) ON UPDATE CASCADE, 105 | ); 106 | 107 | CREATE TABLE IF NOT EXISTS WEEKLY( 108 | Rid INT(10) NOT NULL, 109 | Sdate DATE, 110 | Amount INT(10), 111 | Noweeks INT(10), 112 | Vehicle_id INT(10), 113 | Dno INT(10), 114 | PRIMARY KEY (Rid), 115 | FOREIGN KEY (Rid) REFERENCES RENTAL(Rid) ON UPDATE CASCADE, 116 | FOREIGN KEY (Vehicle_id) REFERENCES CAR(Vehicle_id) ON UPDATE CASCADE, 117 | FOREIGN KEY (Dno) REFERENCES DRIVER(Dno) ON UPDATE CASCADE 118 | ); 119 | 120 | CREATE TABLE IF NOT EXISTS BILL ( 121 | Bno INT(10) NOT NULL, 122 | BDate DATE, 123 | Advance INT(10), 124 | Discount INT(10), 125 | Drivercharge INT(10), 126 | Famount INT(10), 127 | Rid INT(10), 128 | Cid INT(10), 129 | PRIMARY KEY (Bno), 130 | FOREIGN KEY (Rid) REFERENCES RENTAL(Rid) ON UPDATE CASCADE, 131 | FOREIGN KEY (Cid) REFERENCES CUSTOMER(Cid) ON UPDATE CASCADE 132 | ); 133 | 134 | CREATE TABLE IF NOT EXISTS OWNS ( 135 | Owner_id INT(10) NOT NULL, 136 | Vehicle_id INT(10), 137 | PRIMARY KEY (Owner_id), 138 | FOREIGN KEY (Owner_id) REFERENCES OWNER(Owner_id) ON UPDATE CASCADE, 139 | ); 140 | 141 | CREATE TABLE IF NOT EXISTS OWNER ( 142 | Owner_id INT(10) NOT NULL, 143 | PRIMARY KEY (Owner_id) 144 | ); 145 | 146 | CREATE TABLE IF NOT EXISTS INDIVIDUAL ( 147 | Ssn INT(10) NOT NULL, 148 | Name VARCHAR(20), 149 | Owner_id INT(10), 150 | PRIMARY KEY (Ssn), 151 | FOREIGN KEY (Owner_id) REFERENCES OWNER(Owner_id) ON UPDATE CASCADE 152 | ); 153 | 154 | CREATE TABLE IF NOT EXISTS BANK ( 155 | Bid INT(10) NOT NULL, 156 | Bname VARCHAR(20), 157 | City VARCHAR(20), 158 | Owner_id INT(10), 159 | PRIMARY KEY (Bid), 160 | FOREIGN KEY (Owner_id) REFERENCES OWNER(Owner_id) ON UPDATE CASCADE 161 | ); 162 | 163 | CREATE TABLE IF NOT EXISTS COMPANY ( 164 | Compid INT(10) NOT NULL, 165 | Cname VARCHAR(20), 166 | Owner_id INT(10), 167 | PRIMARY KEY (Compid), 168 | FOREIGN KEY (Owner_id) REFERENCES OWNER(Owner_id) ON UPDATE CASCADE 169 | ); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ##Online Car Rental System## 2 | **Database Systems Project** 3 | 4 | Technologies: MySQL, PHP, HTML and CSS 5 | 6 | Design and implement a database for keeping track of information about a car rental company. 7 | 8 | Following tasks were achieved: 9 | 10 | The following are the tasks for the third part of the project: 11 | 12 | 1. Load some initial data (as discussed above) into the database tables. You can either write a loading program, or use SQL/PLUS (insert command), or use SQL/FORMS. Your data should be kept in files so that it can easily be reloaded during debugging. The data format should be designed by you. 13 | 14 | 2. Write queries to retrieve and print all the data you entered. Try to print the data so that it is easy to understand (for example, print appropriate headings, such as: Customers, Compact Cars, SUVs, Current Rentals, etc.). 15 | 16 | 3. Write a query that will prepare a report for weekly earnings by owner, by car type and per car unit that owner owns within that car type. 17 | 18 | 4. Write the following database update transactions using either PRO*C or JAVA/JDBC or PHP or some other programming language or scripting language. 19 | 20 | 4.1 The first transaction is to add information about a new CUSTOMER. 21 | 22 | 4.2 The second transaction is to add all the information about a new CAR. 23 | 24 | 4.3 The third transaction is to add all the information about a new RENTAL reservation (this must find a free car of the appropriate type for the rental period). 25 | 26 | 4.4 The fourth transaction is to handle the return of a rented car. This transaction should print the total customer payment due for the rental, and enter it in the database. 27 | 28 | 4.5 The fifth transaction is to enter or update the rental rates (daily and weekly) for a type of car. 29 | 30 | 5. Each transaction should have a user friendly interface to enter the information needed by the transaction. This can either be a Web-based interface, a command line interface, or a forms interface. 31 | 32 | 6. Test your transactions by adding a few new customers, cars, reservations, by changing some rental rates and reservations rates. 33 | 34 | 35 | **Assumptions for EER Diagram:** 36 | - One customer can rent one car at a time so the cardinality ratio will be 1:1. 37 | - A car is divided into different types of disjoint entities with attribute type. 38 | - A single owner may own multiple cars. 39 | - Each customer pays for their respective rentals . 40 | - The customer might pay an advance or security deposit which is used in calculating final amount. 41 | - Discount is given for membership customers 42 | - Driver charge also added if customer opted for chauffeur. 43 | - Each rental will be divided into two distinct entities Daily and weekly. 44 | - Amount can be derived using the CAR attributes Drate and Wrate. 45 | - Return date is also a derived attribute, which can be derived from Start Date and No of Days/weeks. 46 | - A single owner can own multiple vehicles so we consider this is a 1:n relation towards the car entity from the owner entity. 47 | - A customer can provide feedback which can be referred by the Customer service Department for better service in future. 48 | - A customer has a choice to either hire a chauffeur or choose self-drive option. 49 | 50 | 51 | **RELATIONAL SCHEMA MAPPING** : 52 | - Relationship between CAR and OWNER is 1:N , so we have created a new Relation OWNS which consists of foreign key attributes to CAR and OWNER relations. 53 | - RENTAL entity has two disjoint subclasses – DAILY and WEEKLY . While mapping we have created two relations DAILY and WEEKLY which have foreign key attributes to RENTAL relation. 54 | - DRIVER class has two super classes CHAUFFEUR and SELF. Customer can select any mode of driving. It has foreign key attribute to DRIVER crelation. 55 | - CAR entity has six disjoint subclasses (Specialization) which has been done on Type attribute. Single Relation Mapping technique has been used here. 56 | - All 1:1 relationships has been mapped using foreign key technique. 57 | Note: The Schema Diagram is present in the folder as Schema_Diagram.pdf 58 | 59 | 60 | -------------------------------------------------------------------------------- /Schema_Diagram.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dhanukarajat/car-rental/33eefab4e1626140cc19433e8872a2964ef68ee2/Schema_Diagram.pdf --------------------------------------------------------------------------------