├── favicon.ico ├── connect.php ├── bitnami.css ├── index.html ├── mainpage ├── login.php ├── page2 ├── README.md ├── page2.php ├── mainpage.php ├── mainpage.html ├── temp ├── applications.html ├── page1.php ├── page3.php └── restaurant.sql /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajvi-patel-22/Restaurant-Management-System-DBMS-project/HEAD/favicon.ico -------------------------------------------------------------------------------- /connect.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bitnami.css: -------------------------------------------------------------------------------- 1 | .module_top, .module_bottom{ 2 | visibility: hidden; 3 | } 4 | 5 | table { 6 | border: 0px !important; 7 | } 8 | 9 | .module_content img{ 10 | min-width: 70px; 11 | } 12 | 13 | .module_content h2{ 14 | font-size: 30px; 15 | } 16 | 17 | 18 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Welcome to the Khana Khazana Restaurant 4 | 5 | 6 | 7 |
8 | Username : 9 |
10 | Password : 11 |
12 | 13 |
14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /mainpage: -------------------------------------------------------------------------------- 1 | 2 | 3 | Welcome to the Khana Khazana Restaurant 4 | 5 | 6 | 7 |
8 | Username : 9 |
10 | Password : 11 |
12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /login.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /page2: -------------------------------------------------------------------------------- 1 | query($sql); 7 | ?> 8 | 9 | 10 | 11 |

Order status

12 | 13 | 14 | 15 | 16 | 17 | num_rows > 0){ 20 | while($row = $result->fetch_assoc()){ 21 | ?> 22 | 23 | 24 | 25 | 26 | 32 | 33 | 34 | 35 | 38 |
Order IDServe Status
There's No data found!!!
39 | 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Restaurant-Management-System-DBMS-project 2 | Our project is restaurant management system, where we provide all the details that a manager needs to run the restaurant from ordering the food to generating bill and payment. In our project only an authorised person i.e. manager can login, He can see the data of customers and employee. He can also add, update or delete customer. We have table masters who assigns table to the customers and chef who prepares food, also main feature is we calculate the time taken to serve customer food after order is placed. And we also have preparation time for each food individually. Chef also gets bonus if he prepares food early than expected, and customers are given more discount if food is delivered to them late as reward for their patience. We allocate table based on members and table masters does that job, also customer can prebook their table. Also, we keep a record of the employee who have left their table, like which employee left and when. Menu is displayed based on categories, like food with same category are displayed together. We also have record of increase in the price or ratings, like if food price is increased then old price and new price, and also ratings of food, like which food is trending and hitting our restaurant or which food is not doing well And we generate bill automatically based on order items, and we have got many payment options like cash, card, paytm, etc. 3 | -------------------------------------------------------------------------------- /page2.php: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 18 | 19 |
20 |

View Menu

To View Menu click here.. 21 | 22 |

Book Table :

23 | Customer Id: 24 | Members : 25 | 26 | 27 |

Place Order :

28 | Customer Id: 29 | Food name : 30 | Quantity : 31 | Jain? : 32 | 33 | 34 | 35 | 36 |

Track Order status

37 | 38 | 39 | 40 | 41 | 42 | 43 | 48 | 49 | 50 | 51 | 52 | 58 | 59 | 60 | 61 | 64 |
Order IDServe Status
There's No data found!!!
65 |

Update Status:

66 | Order Id: 67 | 68 |

Discount Calculation

69 | Order Id: 70 | 71 |

Bill Calculation

72 | Order Id: 73 | 74 |

Pay Bill

75 | Bill no: 76 | Method: 77 | 78 |

Get Employee basic data

79 | 80 |

Price variation of food :

81 | 82 |

Left employee :

83 | 84 |
85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /mainpage.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Welcome to the Khana Khazana Restaurant 5 | 51 | 52 | 53 | 54 |
55 |


View Menu

56 |
57 |

Data of Employee :


58 |
59 |
71 |
72 | 73 | 74 | 75 |
76 |
77 | 78 |
79 |

Data of Customer :


80 |
81 |
91 |
92 | 93 | 94 |




95 | 96 | 97 |
98 |
99 |
100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /mainpage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Welcome to the Khana Khazana Restaurant 5 | 51 | 52 | 53 | 54 |
55 |


View Menu

56 |
57 |

Data of Employee :


58 |
59 |
72 |
73 | 74 | 75 | 76 |
77 |
78 | 79 |
80 |

Data of Customer :


81 |
82 |
92 |
93 | 94 | 95 |




96 | 97 | 98 |
99 |
100 |
101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /temp: -------------------------------------------------------------------------------- 1 | category_id: " .$row['category_id']; 27 | echo "
category name: " .$row['category_name']; 28 | echo "
food id : ".$lname=$row['Food_id']; 29 | echo "
food name: ".$city=$row['Food_name']; 30 | echo "
price: ".$address=$row['Price']; 31 | echo "
rate: ".$pcode=$row['Rate']; 32 | echo "
prep_time: ".$cno=$row['Prep_time']; 33 | echo "
spice_level: ".$salary=$row['Spice_level']; 34 | echo "
is_jain: ".$state=$row['Is_Jain']; 35 | echo "
food_description: ".$state=$row['Food_description']; 36 | 37 | } 38 | 39 | } 40 | else 41 | { 42 | echo 'Data is not found ...!!'; 43 | } 44 | header("refresh:5; url=page1.html"); 45 | } 46 | else if(isset($_POST['book'])) 47 | { 48 | $var1= $_POST['custid']; 49 | $var2= $_POST['mem']; 50 | $con = mysqli_connect('localhost','root',''); 51 | if(!$con) 52 | { 53 | die('Unable to connect..!!'); 54 | } 55 | mysqli_select_db($con,'restaurant'); 56 | 57 | 58 | $query2 = "call Table_allocation('$var1','$var2')"; 59 | $result2=mysqli_query($con,$query2); 60 | 61 | if(mysqli_num_rows($result2)) 62 | { 63 | while($row1=mysqli_fetch_array($result2)) 64 | { 65 | echo "
Your Table id is: " .$row1['Table_id']; 66 | 67 | } 68 | 69 | } 70 | else 71 | { 72 | echo 'Data is not found ...!!'; 73 | } 74 | header("refresh:2; url=page1.html"); 75 | } 76 | ?> 77 | 78 | 79 | 80 | 86 | 87 |
88 |

View Menu

89 | 90 |

Book Table :

91 | Customer Id:

92 | Members : 93 | 94 | 95 | 96 |

Track Order status

97 | 98 | 99 | 100 | 101 | 102 | 103 | 108 | 109 | 110 | 111 | 112 | 118 | 119 | 120 | 121 | 124 |
Order IDServe Status
There's No data found!!!
125 |

Update Status:

126 | Order Id: 127 | 128 |

Discount Calculation :

129 | Order Id: 130 | 131 |

Bill Calculation :

132 | Order Id: 133 | 134 | 135 |
136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /applications.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Bitnami: Open Source. Simplified 6 | 7 | 8 | 9 | 10 |
11 | 34 |
35 |
36 |
37 |
38 |
39 |

Apache Friends and Bitnami are cooperating to make dozens of open source applications available on XAMPP, for free. Bitnami-packaged applications include Wordpress, Drupal, Joomla! and dozens of others and can be deployed with one-click installers. Visit the Bitnami XAMPP page for details on the currently available apps.


40 |

Check out our Bitnami for XAMPP Start Guide for more information about the applications installed.


41 |

We are working on making Bitnami add-ons available for PHP 7, it is possible the current add-ons do not work well with this version.

42 |
43 |
44 |
45 |
46 |
47 | 48 |
49 |
50 |
51 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /page1.php: -------------------------------------------------------------------------------- 1 | 0) 24 | { 25 | echo 'Data inserted Successfully...!!'; 26 | } 27 | else 28 | { 29 | echo 'Data is not inserted ...!!'; 30 | } 31 | header("refresh:1; url=mainpage.html"); 32 | } 33 | 34 | else if(isset($_POST['employeedelete'])) 35 | { 36 | $con = mysqli_connect('localhost','root',''); 37 | if(!$con) 38 | { 39 | die('Unable to connect..!!'); 40 | } 41 | mysqli_select_db($con,'restaurant'); 42 | $f12= $_POST['id']; 43 | 44 | $q2 = "delete from employee where `Emp_id`='$f12'"; 45 | $result2=mysqli_query($con,$q2); 46 | 47 | if(mysqli_affected_rows($con)>0) 48 | { 49 | echo 'Data deleted Successfully...!!'; 50 | } 51 | else 52 | { 53 | echo 'Data is not deleted ...!!'; 54 | } 55 | header("refresh:1; url=mainpage.html"); 56 | } 57 | 58 | 59 | else if(isset($_POST['employeesearch'])) 60 | { 61 | $con = mysqli_connect('localhost','root',''); 62 | if(!$con) 63 | { 64 | die('Unable to connect..!!'); 65 | } 66 | mysqli_select_db($con,'restaurant'); 67 | $f13= $_POST['id']; 68 | 69 | $q3 = "select * from employee where `Emp_id`='$f13'"; 70 | $result3=mysqli_query($con,$q3); 71 | 72 | if($result3){ 73 | if(mysqli_num_rows($result3)) 74 | { 75 | while($row=mysqli_fetch_array($result3)) 76 | { 77 | echo "
first name: " .$row['Emp_id']; 78 | echo "
first name: " .$row['Emp_fname']; 79 | echo "
designation: ".$desi=$row['Designation']; 80 | echo "
work type: ".$wtype=$row['Work_type']; 81 | echo "
address: ".$address=$row['Address']; 82 | echo "
city: ".$city=$row['City']; 83 | echo "
last name: ".$lname=$row['Emp_lname']; 84 | echo "
state: ".$state=$row['State']; 85 | echo "
pincode: ".$pcode=$row['Pincode']; 86 | echo "
contact_no: ".$cno=$row['Contact_no']; 87 | echo "
salary: ".$salary=$row['Emp_salary']; 88 | echo "
Birth Date: ".$salary=$row['bdate']; 89 | echo "
Hiring date: ".$salary=$row['hiring_date']; 90 | 91 | } 92 | 93 | }} 94 | else 95 | { 96 | echo 'Data is not found ...!!'; 97 | } 98 | header("refresh:5; url=mainpage.html"); 99 | } 100 | else if(isset($_POST['customeradd'])) 101 | { 102 | $f21= $_POST['cid']; 103 | $f22= $_POST['cfname']; 104 | $f23= $_POST['clname']; 105 | $f24= $_POST['ccity']; 106 | $f25= $_POST['caddress']; 107 | $f26= $_POST['cpcode']; 108 | $f27= $_POST['ccno']; 109 | $f28= $_POST['cemailid']; 110 | $f29= $_POST['cstate']; 111 | 112 | $con = mysqli_connect('localhost','root',''); 113 | if(!$con){die('Unable to connect..!!');} 114 | mysqli_select_db($con,'restaurant'); 115 | 116 | $q4 = "insert into customer values ('$f21','$f22','$f23','$f24','$f25','$f26','$f27','$f28','$f29')"; 117 | $result4=mysqli_query($con,$q4); 118 | 119 | if(mysqli_affected_rows($con)>0) 120 | { 121 | echo 'Data inserted Successfully...!!'; 122 | } 123 | else 124 | { 125 | echo 'Data is not inserted ...!!'; 126 | } 127 | header("refresh:1; url=mainpage.html"); 128 | } 129 | 130 | else if(isset($_POST['customerdelete'])) 131 | { 132 | $con = mysqli_connect('localhost','root',''); 133 | if(!$con) 134 | { 135 | die('Unable to connect..!!'); 136 | } 137 | mysqli_select_db($con,'restaurant'); 138 | $f30= $_POST['cid']; 139 | 140 | $q5 = "delete from Customer where `Cust_id`='$f30'"; 141 | $result5=mysqli_query($con,$q5); 142 | 143 | if(mysqli_affected_rows($con)>0) 144 | { 145 | echo 'Data deleted Successfully...!!'; 146 | } 147 | else 148 | { 149 | echo 'Data is not deleted ...!!'; 150 | } 151 | header("refresh:1; url=mainpage.html"); 152 | } 153 | 154 | 155 | else if(isset($_POST['customersearch'])) 156 | { 157 | $con = mysqli_connect('localhost','root',''); 158 | if(!$con) 159 | { 160 | die('Unable to connect..!!'); 161 | } 162 | mysqli_select_db($con,'restaurant'); 163 | $f31= $_POST['cid']; 164 | 165 | $q6 = "select * from customer where `Cust_id`='$f31'"; 166 | $result6=mysqli_query($con,$q6); 167 | 168 | if(mysqli_affected_rows($con)>0) 169 | { 170 | while($row=mysqli_fetch_array($result6)) 171 | { 172 | echo "
id: " .$row['Cust_id']; 173 | echo "
first name: " .$row['Cust_fname']; 174 | echo "
last name: ".$lname=$row['Cust_lname']; 175 | echo "
city: ".$city=$row['City']; 176 | echo "
address: ".$address=$row['Address']; 177 | echo "
pincode: ".$pcode=$row['Pincode']; 178 | echo "
contact_no: ".$cno=$row['Contact_no']; 179 | echo "
email id: ".$salary=$row['Email_id']; 180 | echo "
state: ".$state=$row['State']; 181 | 182 | } 183 | 184 | } 185 | else 186 | { 187 | echo 'Data is not found ...!!'; 188 | } 189 | header("refresh:5; url=mainpage.html"); 190 | } 191 | else if(isset($_POST['menu'])) 192 | { 193 | $con = mysqli_connect('localhost','root',''); 194 | if(!$con) 195 | { 196 | die('Unable to connect..!!'); 197 | } 198 | mysqli_select_db($con,'restaurant'); 199 | $f31= $_POST['cid']; 200 | 201 | $q6 = "call display_food()"; 202 | $result6=mysqli_query($con,$q6); 203 | 204 | if(mysqli_num_rows($result6)) 205 | { 206 | echo "

           Menu

"; 207 | echo " category_id   category name   food id   food name   price   rate   prep_time   spice_level   is_jain   food_description  
"; 208 | while($row=mysqli_fetch_array($result6)) 209 | { 210 | echo "
   ".$row['category_id']; 211 | echo "   ".$row['category_name']; 212 | echo "   ".$lname=$row['Food_id']; 213 | echo "   ".$city=$row['Food_name']; 214 | echo "  ".$cno=$row['Prep_time']; 215 | echo "   ".$salary=$row['Spice_level']; 216 | echo "   ".$state=$row['Is_Jain']; 217 | echo "  ".$address=$row['Price']; 218 | echo "  ".$pcode=$row['Rate']; 219 | echo "  ".$state=$row['Food_description']; 220 | echo "
"; 221 | } 222 | 223 | } 224 | else 225 | { 226 | echo 'Data is not found ...!!'; 227 | } 228 | header("refresh:5; url=mainpage.html"); 229 | } 230 | else if(isset($_POST['prev'])) 231 | { 232 | $con = mysqli_connect('localhost','root',''); 233 | if(!$con) 234 | { 235 | die('Unable to connect..!!'); 236 | } 237 | mysqli_select_db($con,'restaurant'); 238 | 239 | header("refresh:1; url=index.html"); 240 | } 241 | else if(isset($_POST['next'])) 242 | { 243 | $con = mysqli_connect('localhost','root',''); 244 | if(!$con) 245 | { 246 | die('Unable to connect..!!'); 247 | } 248 | mysqli_select_db($con,'restaurant'); 249 | 250 | header("refresh:1; url=page2.php"); 251 | } 252 | 253 | 254 | 255 | ?> -------------------------------------------------------------------------------- /page3.php: -------------------------------------------------------------------------------- 1 |            Menu"; 24 | echo " category_id   category name   food id   food name   price   rate   prep_time   spice_level   is_jain   food_description  
"; 25 | while($row=mysqli_fetch_array($result)) 26 | { 27 | echo "
   ".$row['category_id']; 28 | echo "   ".$row['category_name']; 29 | echo "   ".$lname=$row['Food_id']; 30 | echo "   ".$city=$row['Food_name']; 31 | echo "  ".$cno=$row['Prep_time']; 32 | echo "   ".$salary=$row['Spice_level']; 33 | echo "   ".$state=$row['Is_Jain']; 34 | echo "  ".$address=$row['Price']; 35 | echo "  ".$pcode=$row['Rate']; 36 | echo "  ".$state=$row['Food_description']; 37 | echo "
"; 38 | 39 | } 40 | 41 | } 42 | else 43 | { 44 | echo 'Data is not found ...!!'; 45 | } 46 | header("refresh:5; url=page2.php"); 47 | } 48 | else if(isset($_POST['book']))/*book table*/ 49 | { 50 | 51 | $con = mysqli_connect('localhost','root',''); 52 | if(!$con) 53 | { 54 | die('Unable to connect..!!'); 55 | } 56 | 57 | mysqli_select_db($con,'restaurant'); 58 | 59 | $var1= $_POST['custid']; 60 | $var2= $_POST['mem']; 61 | $query2 = "call Table_allocation('$var2','$var1')"; 62 | $res=mysqli_query($con,$query2); 63 | 64 | if(mysqli_num_rows($res)) 65 | { 66 | $row1=mysqli_fetch_array($res); 67 | echo " Your Table id is: " .$row1['tid']; 68 | } 69 | else 70 | { 71 | echo 'Data is not found ...!!'; 72 | } 73 | header("refresh:9; url=page2.php"); 74 | } 75 | else if(isset($_POST['served']))/*order status*/ 76 | { 77 | 78 | $con = mysqli_connect('localhost','root',''); 79 | if(!$con) 80 | { 81 | die('Unable to connect..!!'); 82 | } 83 | 84 | mysqli_select_db($con,'restaurant'); 85 | 86 | $var3= $_POST['orderid1']; 87 | $query2 = "update order_status set serve_status='C served' where Order_id=$var3"; 88 | $res1=mysqli_query($con,$query2); 89 | 90 | 91 | $query3 = "update order_status set serve_status='served' where serve_status='C served'"; 92 | $res2=mysqli_query($con,$query3); 93 | if(mysqli_affected_rows($con)>0) 94 | { 95 | echo "Order Served"; 96 | } 97 | else 98 | { 99 | echo "Order not Served"; 100 | } 101 | 102 | header("refresh:2; url=page2.php"); 103 | } 104 | else if(isset($_POST['Calculatedis']))/*cal disc*/ 105 | { 106 | 107 | $con = mysqli_connect('localhost','root',''); 108 | if(!$con) 109 | { 110 | die('Unable to connect..!!'); 111 | } 112 | 113 | mysqli_select_db($con,'restaurant'); 114 | 115 | $var4= $_POST['orderid2']; 116 | $query4 = "select Discount('$var4')"; 117 | $res4=mysqli_query($con,$query4); 118 | 119 | if(mysqli_num_rows($res4)) 120 | { 121 | while($row5=mysqli_fetch_array($res4)) 122 | { 123 | echo "Discount calculated successfully" ; 124 | 125 | } 126 | 127 | } 128 | else 129 | { 130 | echo 'Data is not found ...!!'; 131 | } 132 | header("refresh:10; url=page2.php"); 133 | } 134 | else if(isset($_POST['Calculatebill']))/*cal bill*/ 135 | { 136 | 137 | $con = mysqli_connect('localhost','root',''); 138 | if(!$con) 139 | { 140 | die('Unable to connect..!!'); 141 | } 142 | 143 | mysqli_select_db($con,'restaurant'); 144 | 145 | $var8= $_POST['orderid2']; 146 | $query5 = "call bill('$var8')"; 147 | $res5=mysqli_query($con,$query5); 148 | if(mysqli_affected_rows($con)>=0) 149 | { 150 | echo "Bill calculated successfully"; 151 | } 152 | else 153 | { 154 | echo 'Data is not found ...!!'; 155 | } 156 | header("refresh:10; url=page2.php"); 157 | } 158 | else if(isset($_POST['paybill']))/*pay bill*/ 159 | { 160 | 161 | $con = mysqli_connect('localhost','root',''); 162 | if(!$con) 163 | { 164 | die('Unable to connect..!!'); 165 | } 166 | 167 | mysqli_select_db($con,'restaurant'); 168 | 169 | $var11= $_POST['method']; 170 | $var12= $_POST['billno2']; 171 | $query8 = "call payement('$var11','$var12')"; 172 | $res8=mysqli_query($con,$query8); 173 | if(mysqli_affected_rows($con)>=0) 174 | { 175 | echo 'Payment successfully done..'; 176 | } 177 | else 178 | { 179 | echo 'Payment not done..'; 180 | } 181 | header("refresh:10; url=page2.php"); 182 | } 183 | else if(isset($_POST['place']))/*place order*/ 184 | { 185 | 186 | $con = mysqli_connect('localhost','root',''); 187 | if(!$con) 188 | { 189 | die('Unable to connect..!!'); 190 | } 191 | 192 | mysqli_select_db($con,'restaurant'); 193 | 194 | $var15= $_POST['cid']; 195 | $var17= $_POST['fname']; 196 | $var18= $_POST['quantity']; 197 | $var19= $_POST['jain']; 198 | $query9 = "call Orderitems('$var15','$var17','$var18','$var19')"; 199 | $res9=mysqli_query($con,$query9); 200 | if(mysqli_affected_rows($con)>=0) 201 | { 202 | echo 'Order placed successfully ..'; 203 | } 204 | else 205 | { 206 | echo 'Order not placed ..'; 207 | } 208 | header("refresh:10; url=page2.php"); 209 | } 210 | else if(isset($_POST['gete']))/*get emp data*/ 211 | { 212 | 213 | $con = mysqli_connect('localhost','root',''); 214 | if(!$con) 215 | { 216 | die('Unable to connect..!!'); 217 | } 218 | 219 | mysqli_select_db($con,'restaurant'); 220 | 221 | $query10 = "call experience()"; 222 | $res10=mysqli_query($con,$query10); 223 | if(mysqli_num_rows($res10)) 224 | { 225 | while($row=mysqli_fetch_array($res10)) 226 | { 227 | echo "
Emp id: " .$row['emp']; 228 | echo "
Salary: " .$row['salary']; 229 | echo "
Hiring date: ".$row['hdate']; 230 | echo "
Total year of experience: ".$row['tot_years_exp']; 231 | 232 | } 233 | 234 | } 235 | header("refresh:10; url=page2.php"); 236 | } 237 | else if(isset($_POST['varyprice']))/*price variation*/ 238 | { 239 | 240 | $con = mysqli_connect('localhost','root',''); 241 | if(!$con) 242 | { 243 | die('Unable to connect..!!'); 244 | } 245 | 246 | mysqli_select_db($con,'restaurant'); 247 | 248 | $query10 = "select * from price_increase"; 249 | $res10=mysqli_query($con,$query10); 250 | if(mysqli_num_rows($res10)) 251 | { 252 | echo "
Date of inc/dec:    field name:    before value :   after value: "; 253 | while($row=mysqli_fetch_array($res10)) 254 | { 255 | echo "
   " .$row['cur_date']; 256 | echo "   " .$row['field_name']; 257 | echo "     ".$row['before_value']; 258 | echo "     ".$row['after_value']; 259 | echo "
"; 260 | } 261 | 262 | } 263 | header("refresh:10; url=page2.php"); 264 | 265 | } 266 | else if(isset($_POST['leftemp']))/*employee left*/ 267 | { 268 | 269 | $con = mysqli_connect('localhost','root',''); 270 | if(!$con) 271 | { 272 | die('Unable to connect..!!'); 273 | } 274 | 275 | mysqli_select_db($con,'restaurant'); 276 | 277 | $query11 = "select * from left_employee"; 278 | $res11=mysqli_query($con,$query11); 279 | if(mysqli_num_rows($res11)) 280 | { 281 | echo "
username    date & time "; 282 | while($row=mysqli_fetch_array($res11)) 283 | { 284 | echo "
 " .$row['user_name']; 285 | echo "   " .$row['datetime']; 286 | echo "
"; 287 | } 288 | 289 | } 290 | header("refresh:10; url=page2.php"); 291 | } 292 | ?> -------------------------------------------------------------------------------- /restaurant.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 4.7.4 3 | -- https://www.phpmyadmin.net/ 4 | -- 5 | -- Host: 127.0.0.1 6 | -- Generation Time: Apr 16, 2019 at 12:05 PM 7 | -- Server version: 10.1.29-MariaDB 8 | -- PHP Version: 7.1.12 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | SET AUTOCOMMIT = 0; 12 | START TRANSACTION; 13 | SET time_zone = "+00:00"; 14 | 15 | 16 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 17 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 18 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 19 | /*!40101 SET NAMES utf8mb4 */; 20 | 21 | -- 22 | -- Database: `restaurant` 23 | -- 24 | 25 | DELIMITER $$ 26 | -- 27 | -- Procedures 28 | -- 29 | CREATE DEFINER=`root`@`localhost` PROCEDURE `bill` (IN `oid` INT) begin 30 | DECLARE b int; 31 | DECLARE na int; 32 | DECLARE tot_Amount int; 33 | DECLARE tax1,disc float; 34 | DECLARE tid varchar(8); 35 | DECLARE cid varchar(20); 36 | DECLARE cur1 CURSOR FOR SELECT sum(Amount) as tot_amount FROM Order_items where Order_id=oid group by Order_id ; 37 | DECLARE CONTINUE HANDLER FOR NOT FOUND SET b = 1; 38 | set tid=(select Table_id from order_details where Order_id=oid); 39 | set cid=(select Cust_id from order_details where Order_id=oid); 40 | set disc=(SELECT Discount from bill where Order_id=oid); 41 | update table_master set booking_stat="not_booked" where table_id=tid; 42 | update table_master set booking_time=null where table_id=tid; 43 | update table_master set Cust_id=null where table_id=tid; 44 | OPEN cur1; 45 | SET b = 0; 46 | FETCH cur1 INTO tot_amount; 47 | WHILE b = 0 DO 48 | set disc =10; 49 | set tax1= tot_Amount *0.18; 50 | set na = tot_Amount + tax1 - disc ; 51 | update bill set Amount=tot_Amount ,Net_amount=na,tax=tax1,Table_id=tid,Cust_id=cid where Order_id=oid; 52 | 53 | FETCH cur1 INTO tot_Amount; 54 | end while; 55 | CLOSE cur1; 56 | 57 | end$$ 58 | 59 | CREATE DEFINER=`root`@`localhost` PROCEDURE `bill_display` () NO SQL 60 | select customer.Cust_id,cust_fname,cust_lname,bill.Bill_no,payement.Payement_mode,payement.Paid_amount 61 | from customer join bill on customer.Cust_id=bill.cust_id join payement on bill.Bill_no=payement.Bill_no$$ 62 | 63 | CREATE DEFINER=`root`@`localhost` PROCEDURE `Discount` (IN `oid` INT) begin 64 | declare difftime,stime,etime,approxtime,apptime time; 65 | declare odate date; 66 | declare disc float; 67 | set stime=(select Start_time from Order_details where Order_id=oid); 68 | set etime=(select End_time from Order_details where Order_id=oid); 69 | set apptime=(select Approx_Prep_time from Order_details where Order_id=oid); 70 | 71 | set difftime=timediff(etime,stime); 72 | 73 | if(time(difftime)>time(apptime)) then 74 | set disc=300; 75 | insert into bill(Discount,Order_id) values(300,oid); 76 | else 77 | set disc=0; 78 | insert into bill(Discount,Order_id) values(0,oid); 79 | end if; 80 | 81 | 82 | end$$ 83 | 84 | CREATE DEFINER=`root`@`localhost` PROCEDURE `display_food` () SELECT food.category_id,categories.category_name,food.Food_id,food.Food_name,food.Price,food.Rate,food.Prep_time,food.Spice_level,food.Is_Jain,food.Food_description FROM food,categories where categories.category_id=food.category_id order BY category_id,spice_level asc$$ 85 | 86 | CREATE DEFINER=`root`@`localhost` PROCEDURE `experience` () begin 87 | declare emp varchar(10); 88 | declare salary bigint; 89 | declare yr int; 90 | declare hdate,bdate date; 91 | declare b,tot_years_exp int; 92 | declare rdate varchar(30); 93 | declare cur1 cursor for select Emp_id , Emp_salary , hiring_date ,bdate from Employee; 94 | declare continue handler for not found set b = 1; 95 | open cur1; 96 | set b=0; 97 | fetch cur1 into emp ,salary,hdate,bdate; 98 | while b = 0 Do 99 | set yr=(60 + year(bdate)); 100 | set rdate =concat(yr,'-',month(bdate),'-',day(bdate)); 101 | set tot_years_exp =year(curdate())-year(hdate); 102 | 103 | 104 | select emp ,salary,hdate,tot_years_exp ; 105 | fetch cur1 into emp ,salary,hdate,bdate; 106 | end while; 107 | close cur1; 108 | end$$ 109 | 110 | CREATE DEFINER=`root`@`localhost` PROCEDURE `Orderitems` (IN `cid` VARCHAR(8), IN `Foodname` VARCHAR(20), IN `quantity` INT, IN `jain` VARCHAR(3)) begin 111 | DECLARE b int; 112 | DECLARE p int; 113 | DECLARE Amount,oid int; 114 | DECLARE fid1 VARCHAR(8); 115 | DECLARE cur2 CURSOR FOR SELECT Price,Food_id FROM Food where food_name=foodname ; 116 | DECLARE CONTINUE HANDLER FOR NOT FOUND SET b = 1; 117 | set oid=(select Order_id from order_details where cust_id=cid); 118 | OPEN cur2; 119 | SET b = 0; 120 | FETCH cur2 INTO p,fid1; 121 | WHILE b = 0 DO 122 | set Amount = p * quantity ; 123 | 124 | insert into Order_items values (p,quantity,Amount,fid1,Foodname,jain,oid,current_time); 125 | FETCH cur2 INTO p,fid1; 126 | end while; 127 | CLOSE cur2; 128 | update order_details set Order_date=CURRENT_DATE where Cust_id=cid; 129 | update order_details set End_time=NULL,Approx_Prep_time=NULL where Cust_id=cid; 130 | UPDATE order_status SET serve_status="Not served" where Order_id=oid; 131 | end$$ 132 | 133 | CREATE DEFINER=`root`@`localhost` PROCEDURE `payement` (IN `mode` VARCHAR(10), IN `billno` INT) begin 134 | DECLARE b int; 135 | DECLARE paid_amount bigint; 136 | DECLARE cur1 CURSOR FOR select net_Amount from bill where bill_no=billno; 137 | DECLARE CONTINUE HANDLER FOR NOT FOUND SET b = 1; 138 | OPEN cur1; 139 | SET b = 0; 140 | FETCH cur1 INTO paid_amount; 141 | WHILE b = 0 DO 142 | insert into Payement values (curdate(),"",mode,paid_amount,billno); 143 | FETCH cur1 INTO paid_amount; 144 | end while; 145 | CLOSE cur1; 146 | end$$ 147 | 148 | CREATE DEFINER=`root`@`localhost` PROCEDURE `Table_allocation` (IN `members` INT, IN `custid` VARCHAR(8)) begin 149 | declare difftime,stime,etime,approxtime,apptime time; 150 | declare b_s varchar(10); 151 | declare tid,tableid varchar(8); 152 | declare odate date; 153 | declare k,c int; 154 | declare cur1 cursor for select Table_id,capacity,Booking_stat from Table_master; 155 | declare continue handler for not found set k = 1; 156 | 157 | open cur1; 158 | set k = 0; 159 | fetch cur1 into tid,c,b_s; 160 | while k = 0 do 161 | if(c>=members && b_s="not_booked" && c<=8) then 162 | set tableid=tid; 163 | end if; 164 | fetch cur1 into tid,c,b_s; 165 | end while; 166 | close cur1; 167 | select tableid as tid; 168 | update Table_master set Booking_stat="booked" where Table_id=tableid ; 169 | update Table_master set Cust_id=custid where Table_id=tableid ; 170 | update Table_master set Booking_time=curtime() where Table_id=tableid ; 171 | insert into order_details (Cust_id,Table_id,Start_time) VALUES (custid,tableid,CURTIME()); 172 | 173 | end$$ 174 | 175 | DELIMITER ; 176 | 177 | -- -------------------------------------------------------- 178 | 179 | -- 180 | -- Table structure for table `bill` 181 | -- 182 | 183 | CREATE TABLE `bill` ( 184 | `Bill_no` int(11) NOT NULL, 185 | `Amount` bigint(20) DEFAULT NULL, 186 | `Net_amount` bigint(20) DEFAULT NULL, 187 | `Tax` float DEFAULT NULL, 188 | `Discount` float DEFAULT NULL, 189 | `Table_id` varchar(8) DEFAULT NULL, 190 | `Cust_id` varchar(8) DEFAULT NULL, 191 | `Order_id` int(11) DEFAULT NULL 192 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 193 | 194 | -- 195 | -- Dumping data for table `bill` 196 | -- 197 | 198 | INSERT INTO `bill` (`Bill_no`, `Amount`, `Net_amount`, `Tax`, `Discount`, `Table_id`, `Cust_id`, `Order_id`) VALUES 199 | (30, 200, 226, 36, 300, 'T02', 'C01', 16); 200 | 201 | -- 202 | -- Triggers `bill` 203 | -- 204 | DELIMITER $$ 205 | CREATE TRIGGER `booking_status` AFTER INSERT ON `bill` FOR EACH ROW update table_master set booking_stat="not_booked" where table_id=new.table_id 206 | $$ 207 | DELIMITER ; 208 | 209 | -- -------------------------------------------------------- 210 | 211 | -- 212 | -- Table structure for table `categories` 213 | -- 214 | 215 | CREATE TABLE `categories` ( 216 | `category_id` varchar(8) NOT NULL, 217 | `category_name` varchar(20) DEFAULT NULL 218 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 219 | 220 | -- 221 | -- Dumping data for table `categories` 222 | -- 223 | 224 | INSERT INTO `categories` (`category_id`, `category_name`) VALUES 225 | ('1', 'maincourse'), 226 | ('2', 'street food'); 227 | 228 | -- -------------------------------------------------------- 229 | 230 | -- 231 | -- Table structure for table `chef` 232 | -- 233 | 234 | CREATE TABLE `chef` ( 235 | `Chef_id` varchar(8) NOT NULL, 236 | `Chef_fname` varchar(10) DEFAULT NULL, 237 | `Chef_lname` varchar(10) DEFAULT NULL, 238 | `category_id` varchar(8) DEFAULT NULL, 239 | `bonus` float DEFAULT NULL 240 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 241 | 242 | -- 243 | -- Dumping data for table `chef` 244 | -- 245 | 246 | INSERT INTO `chef` (`Chef_id`, `Chef_fname`, `Chef_lname`, `category_id`, `bonus`) VALUES 247 | ('E01', 'Akshat', 'Shah', '2', 0), 248 | ('E05', 'Jugal', 'Naik', '1', 500); 249 | 250 | -- -------------------------------------------------------- 251 | 252 | -- 253 | -- Table structure for table `customer` 254 | -- 255 | 256 | CREATE TABLE `customer` ( 257 | `Cust_id` varchar(8) NOT NULL, 258 | `Cust_fname` varchar(8) DEFAULT NULL, 259 | `City` varchar(15) DEFAULT NULL, 260 | `Address` varchar(50) DEFAULT NULL, 261 | `Cust_lname` varchar(8) DEFAULT NULL, 262 | `Pincode` varchar(6) DEFAULT NULL, 263 | `Contact_no` varchar(13) DEFAULT NULL, 264 | `Email_id` varchar(30) DEFAULT NULL, 265 | `State` varchar(20) DEFAULT NULL 266 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 267 | 268 | -- 269 | -- Dumping data for table `customer` 270 | -- 271 | 272 | INSERT INTO `customer` (`Cust_id`, `Cust_fname`, `City`, `Address`, `Cust_lname`, `Pincode`, `Contact_no`, `Email_id`, `State`) VALUES 273 | ('C01', 'Maria', 'Surat', 'Vip road', 'Upadhyay', '390001', '9876294766', 'maria@gmail.com', 'gujarat'), 274 | ('C02', 'Tina', 'Ahmedabad', 'cg road', 'Sharma', '380001', '9876364766', 'tina@gmail.com', 'gujarat'), 275 | ('C03', 'Meena', 'Ahmedabad', 'mg road', 'Vyas', '380001', '9876235466', 'mena@gmail.com', 'gujarat'), 276 | ('C04', 'Riya', 'Ahmedabad', 'gandhi road', 'Parekh', '380009', '9876345676', 'riya@gmail.com', 'gujarat'), 277 | ('C05', 'Raj', 'Ahmedabad', 'ashram road', 'Jogi', '380008', '9876294666', 'raj@gmail.com', 'gujarat'); 278 | 279 | -- -------------------------------------------------------- 280 | 281 | -- 282 | -- Table structure for table `employee` 283 | -- 284 | 285 | CREATE TABLE `employee` ( 286 | `Emp_id` varchar(8) NOT NULL, 287 | `Emp_fname` varchar(10) NOT NULL, 288 | `Designation` varchar(10) DEFAULT NULL, 289 | `Work_type` varchar(30) DEFAULT NULL, 290 | `Address` varchar(50) DEFAULT NULL, 291 | `City` varchar(10) DEFAULT NULL, 292 | `Emp_lname` varchar(10) NOT NULL, 293 | `State` varchar(20) DEFAULT NULL, 294 | `Pincode` varchar(6) DEFAULT NULL, 295 | `Contact_no` varchar(13) DEFAULT NULL, 296 | `Emp_salary` float DEFAULT NULL, 297 | `hiring_date` date DEFAULT NULL, 298 | `bdate` date DEFAULT NULL 299 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 300 | 301 | -- 302 | -- Dumping data for table `employee` 303 | -- 304 | 305 | INSERT INTO `employee` (`Emp_id`, `Emp_fname`, `Designation`, `Work_type`, `Address`, `City`, `Emp_lname`, `State`, `Pincode`, `Contact_no`, `Emp_salary`, `hiring_date`, `bdate`) VALUES 306 | ('E01', 'Akshat', 'worker', 'taking feedback', 'ashram road', 'ahmedabad', 'Shah', 'gujrat', '380009', '9874561230', 11000, '2019-04-14', '1990-07-03'), 307 | ('E02', 'Vishal', 'worker', 'attending customer', 'sarma road', 'ahmedabad', 'Sharma', 'gujrat', '380009', '9874561230', 16000, '2019-04-14', '0000-00-00'), 308 | ('E03', 'Hardik', 'worker', 'taking order', 'gandhiroad', 'ahmedabad', 'Gajjar', 'gujrat', '380009', '9874561230', 12000, '2019-04-14', '1999-01-03'), 309 | ('E04', 'Brijesh', 'worker', 'serving food', 'cg road', 'ahmedabad', 'Gohil', 'gujrat', '380009', '9874561230', 15000, '2019-04-14', '1991-07-03'), 310 | ('E05', 'Jugal', 'worker', 'serving food', 'mg road', 'ahmedabad', 'Naik', 'gujrat', '380009', '9874561230', 15000, '2019-04-14', '1999-07-03'); 311 | 312 | -- 313 | -- Triggers `employee` 314 | -- 315 | DELIMITER $$ 316 | CREATE TRIGGER `emp_delete` BEFORE DELETE ON `employee` FOR EACH ROW begin 317 | insert into left_employee values(old.Emp_id,current_timestamp()); 318 | end 319 | $$ 320 | DELIMITER ; 321 | 322 | -- -------------------------------------------------------- 323 | 324 | -- 325 | -- Table structure for table `food` 326 | -- 327 | 328 | CREATE TABLE `food` ( 329 | `Food_id` varchar(8) NOT NULL, 330 | `Food_name` varchar(20) NOT NULL, 331 | `Price` int(11) DEFAULT NULL, 332 | `Rate` float DEFAULT NULL, 333 | `Prep_time` time DEFAULT NULL, 334 | `Spice_level` int(11) DEFAULT NULL, 335 | `Is_Jain` varchar(3) DEFAULT NULL, 336 | `Food_description` varchar(100) DEFAULT NULL, 337 | `category_id` varchar(8) DEFAULT NULL 338 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 339 | 340 | -- 341 | -- Dumping data for table `food` 342 | -- 343 | 344 | INSERT INTO `food` (`Food_id`, `Food_name`, `Price`, `Rate`, `Prep_time`, `Spice_level`, `Is_Jain`, `Food_description`, `category_id`) VALUES 345 | ('F101', 'PavBhaji', 100, 4, '00:00:20', 3, 'yes', 'Famous item of Streets of india', '1'), 346 | ('F102', 'VadaPav', 40, 4, '00:00:10', 4, 'yes', 'Famous item of Mumbai', '2'), 347 | ('F103', 'PaniPuri', 60, 4.5, '00:00:20', 5, 'yes', 'Popular street food', '2'), 348 | ('F104', 'Frankie', 100, 4, '00:00:20', 2, 'yes', 'Delicious healthy food', '1'), 349 | ('F105', 'Sandwich', 90, 3.5, '00:01:59', 3, 'yes', 'with variety of sauces', '1'), 350 | ('F106', 'v.Burger', 120, 4.5, '00:00:20', 4, 'yes', 'pretty form of potato', '1'); 351 | 352 | -- 353 | -- Triggers `food` 354 | -- 355 | DELIMITER $$ 356 | CREATE TRIGGER `food_update` BEFORE UPDATE ON `food` FOR EACH ROW begin 357 | declare msg varchar(50); 358 | if old.Price<>new.Price then 359 | insert into price_increase values(now(), 'Price', old.Price , new.Price ,FOOD.Food_id,FOOD.Food_name); 360 | elseif old.Rate<>new.Rate then 361 | insert into price_increase values(now(), 'Rate', old.Rate, new.Rate,FOOD.Food_id,FOOD.Food_name); 362 | 363 | end if; 364 | end 365 | $$ 366 | DELIMITER ; 367 | 368 | -- -------------------------------------------------------- 369 | 370 | -- 371 | -- Table structure for table `left_employee` 372 | -- 373 | 374 | CREATE TABLE `left_employee` ( 375 | `user_name` varchar(8) DEFAULT NULL, 376 | `datetime` datetime NOT NULL 377 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 378 | 379 | -- -------------------------------------------------------- 380 | 381 | -- 382 | -- Table structure for table `order_details` 383 | -- 384 | 385 | CREATE TABLE `order_details` ( 386 | `Cust_id` varchar(8) DEFAULT NULL, 387 | `Order_date` date DEFAULT NULL, 388 | `Start_time` time DEFAULT NULL, 389 | `End_time` time DEFAULT NULL, 390 | `Approx_Prep_time` time DEFAULT NULL, 391 | `Table_id` varchar(8) DEFAULT NULL, 392 | `order_id` int(11) NOT NULL 393 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 394 | 395 | -- 396 | -- Dumping data for table `order_details` 397 | -- 398 | 399 | INSERT INTO `order_details` (`Cust_id`, `Order_date`, `Start_time`, `End_time`, `Approx_Prep_time`, `Table_id`, `order_id`) VALUES 400 | ('C01', '2019-04-16', '15:25:13', '15:25:53', '00:00:20', 'T02', 16); 401 | 402 | -- 403 | -- Triggers `order_details` 404 | -- 405 | DELIMITER $$ 406 | CREATE TRIGGER `order_status_insert_oid` AFTER INSERT ON `order_details` FOR EACH ROW BEGIN 407 | 408 | insert into order_status values (new.order_id,'not_served'); 409 | 410 | end 411 | $$ 412 | DELIMITER ; 413 | 414 | -- -------------------------------------------------------- 415 | 416 | -- 417 | -- Table structure for table `order_items` 418 | -- 419 | 420 | CREATE TABLE `order_items` ( 421 | `Price` int(11) DEFAULT NULL, 422 | `Quantity` int(11) DEFAULT NULL, 423 | `Amount` float DEFAULT NULL, 424 | `Food_id` varchar(8) NOT NULL, 425 | `Food_name` varchar(20) DEFAULT NULL, 426 | `Is_Jain` varchar(3) DEFAULT NULL, 427 | `Order_id` int(11) NOT NULL, 428 | `current_time` time NOT NULL 429 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 430 | 431 | -- 432 | -- Dumping data for table `order_items` 433 | -- 434 | 435 | INSERT INTO `order_items` (`Price`, `Quantity`, `Amount`, `Food_id`, `Food_name`, `Is_Jain`, `Order_id`, `current_time`) VALUES 436 | (40, 2, 80, 'F102', 'VadaPav', 'No', 16, '15:25:25'), 437 | (60, 2, 120, 'F103', 'PANIPURI', 'No', 16, '15:25:47'); 438 | 439 | -- -------------------------------------------------------- 440 | 441 | -- 442 | -- Table structure for table `order_status` 443 | -- 444 | 445 | CREATE TABLE `order_status` ( 446 | `Order_id` int(11) NOT NULL, 447 | `serve_status` varchar(10) DEFAULT 'Not served' 448 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 449 | 450 | -- 451 | -- Dumping data for table `order_status` 452 | -- 453 | 454 | INSERT INTO `order_status` (`Order_id`, `serve_status`) VALUES 455 | (16, 'served'); 456 | 457 | -- 458 | -- Triggers `order_status` 459 | -- 460 | DELIMITER $$ 461 | CREATE TRIGGER `Bonus_Calculation` BEFORE UPDATE ON `order_status` FOR EACH ROW begin 462 | declare cid varchar(8); 463 | declare oid int; 464 | declare bonusamt float; 465 | declare stime,etime,approxtime time; 466 | set oid=(select Order_id from Order_status where serve_status="C Served"); 467 | 468 | set stime=(select Start_time from Order_details where Order_id=oid); 469 | set etime=(select End_time from Order_details where Order_id=oid); 470 | set approxtime=(select Approx_Prep_time from Order_details where Order_id=oid); 471 | set cid=(select category_id from Food join Order_items on Food.Food_id=Order_items.Food_id where Order_items.Order_id=oid group by category_id); 472 | set bonusamt=(select bonus from Chef where category_id=cid); 473 | 474 | if(timediff(etime,stime)