├── ER_Diagram.png ├── PHARMACY ├── emp.png ├── alert.png ├── pharm1.png ├── carticon1.png ├── inventory.png ├── moneyicon.png ├── logout.php ├── logout1.php ├── config.php ├── customer-delete.php ├── employee-delete.php ├── inventory-delete.php ├── supplier-delete.php ├── header.css ├── pos-delete.php ├── pharm-pos-delete.php ├── purchase-delete.php ├── table1.css ├── table2.css ├── form2.css ├── form4.css ├── form3.css ├── login1.css ├── mainpage.php ├── mainpage1.php ├── pharmmainpage.php ├── nav2.css ├── pharm-customer-view.php ├── pharm-inventory.php ├── stockreport.php ├── sales-view.php ├── adminmainpage.php ├── expiryreport.php ├── salesitems-view.php ├── customer-view.php ├── supplier-view.php ├── pharm-customer.php ├── inventory-view.php ├── pharm-pos2.php ├── employee-view.php ├── purchase-view.php ├── supplier-add.php ├── supplier-update.php ├── inventory-update.php ├── inventory-add.php ├── customer-update.php ├── customer-add.php ├── purchase-add.php ├── pos2.php ├── purchase-update.php ├── pharm-pos1.php ├── salesreport.php ├── employee-add.php ├── employee-update.php └── pos1.php ├── RelationalModel.png ├── Screenshots ├── admin-login.png ├── admin-mainpage.png ├── pharmacist-login.png ├── admin-expiryreport.png ├── admin-new_medicine.png ├── admin-stocksreport.png ├── admin-view_medicine.png ├── pharmacist-mainpage.png ├── pharmacist-inventory.png ├── pharmacist-sale_bill.png ├── pharmacist-point_of_sale.png ├── admin-transaction_reports1.png ├── admin-transaction_reports2.png └── admin-transaction_reports3.png ├── README.md └── pharmacy.sql /ER_Diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/ER_Diagram.png -------------------------------------------------------------------------------- /PHARMACY/emp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/PHARMACY/emp.png -------------------------------------------------------------------------------- /PHARMACY/alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/PHARMACY/alert.png -------------------------------------------------------------------------------- /PHARMACY/pharm1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/PHARMACY/pharm1.png -------------------------------------------------------------------------------- /RelationalModel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/RelationalModel.png -------------------------------------------------------------------------------- /PHARMACY/carticon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/PHARMACY/carticon1.png -------------------------------------------------------------------------------- /PHARMACY/inventory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/PHARMACY/inventory.png -------------------------------------------------------------------------------- /PHARMACY/moneyicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/PHARMACY/moneyicon.png -------------------------------------------------------------------------------- /Screenshots/admin-login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/Screenshots/admin-login.png -------------------------------------------------------------------------------- /Screenshots/admin-mainpage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/Screenshots/admin-mainpage.png -------------------------------------------------------------------------------- /Screenshots/pharmacist-login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/Screenshots/pharmacist-login.png -------------------------------------------------------------------------------- /Screenshots/admin-expiryreport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/Screenshots/admin-expiryreport.png -------------------------------------------------------------------------------- /Screenshots/admin-new_medicine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/Screenshots/admin-new_medicine.png -------------------------------------------------------------------------------- /Screenshots/admin-stocksreport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/Screenshots/admin-stocksreport.png -------------------------------------------------------------------------------- /Screenshots/admin-view_medicine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/Screenshots/admin-view_medicine.png -------------------------------------------------------------------------------- /Screenshots/pharmacist-mainpage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/Screenshots/pharmacist-mainpage.png -------------------------------------------------------------------------------- /Screenshots/pharmacist-inventory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/Screenshots/pharmacist-inventory.png -------------------------------------------------------------------------------- /Screenshots/pharmacist-sale_bill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/Screenshots/pharmacist-sale_bill.png -------------------------------------------------------------------------------- /Screenshots/pharmacist-point_of_sale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/Screenshots/pharmacist-point_of_sale.png -------------------------------------------------------------------------------- /Screenshots/admin-transaction_reports1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/Screenshots/admin-transaction_reports1.png -------------------------------------------------------------------------------- /Screenshots/admin-transaction_reports2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/Screenshots/admin-transaction_reports2.png -------------------------------------------------------------------------------- /Screenshots/admin-transaction_reports3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Varshini-E/Pharmacy-Management-System/HEAD/Screenshots/admin-transaction_reports3.png -------------------------------------------------------------------------------- /PHARMACY/logout.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PHARMACY/logout1.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PHARMACY/config.php: -------------------------------------------------------------------------------- 1 | connect_error) { 4 | die("Connection failed: " . $conn->connect_error); 5 | } 6 | ?> -------------------------------------------------------------------------------- /PHARMACY/customer-delete.php: -------------------------------------------------------------------------------- 1 | query($sql)) 5 | header("location:customer-view.php"); 6 | else 7 | echo "error"; 8 | ?> -------------------------------------------------------------------------------- /PHARMACY/employee-delete.php: -------------------------------------------------------------------------------- 1 | query($sql)) 5 | header("location:employee-view.php"); 6 | else 7 | echo "error"; 8 | ?> -------------------------------------------------------------------------------- /PHARMACY/inventory-delete.php: -------------------------------------------------------------------------------- 1 | query($sql)) 5 | header("location:inventory-view.php"); 6 | else 7 | echo "error"; 8 | ?> -------------------------------------------------------------------------------- /PHARMACY/supplier-delete.php: -------------------------------------------------------------------------------- 1 | query($sql)) 5 | header("location:supplier-view.php"); 6 | else 7 | echo "error"; 8 | ?> -------------------------------------------------------------------------------- /PHARMACY/header.css: -------------------------------------------------------------------------------- 1 | div.head { 2 | width:78%; 3 | background-color:#e6e6e6; 4 | color:#003366; 5 | float:right; 6 | margin-top:80px; 7 | margin-right:55px; 8 | margin-left:0px; 9 | top: 0; 10 | right: 0; 11 | overflow:hidden; 12 | } 13 | -------------------------------------------------------------------------------- /PHARMACY/pos-delete.php: -------------------------------------------------------------------------------- 1 | query($sql)){ 5 | header("location:pos2.php"); 6 | exit(); 7 | } 8 | else 9 | echo "Error"; 10 | ?> 11 | 12 | 13 | -------------------------------------------------------------------------------- /PHARMACY/pharm-pos-delete.php: -------------------------------------------------------------------------------- 1 | query($sql)){ 5 | header("location:pharm-pos2.php"); 6 | exit(); 7 | } 8 | else 9 | echo "Error"; 10 | ?> 11 | 12 | 13 | -------------------------------------------------------------------------------- /PHARMACY/purchase-delete.php: -------------------------------------------------------------------------------- 1 | query($sql)) 10 | header("location:purchase-view.php"); 11 | else 12 | echo "error"; 13 | ?> -------------------------------------------------------------------------------- /PHARMACY/table1.css: -------------------------------------------------------------------------------- 1 | #table1 { 2 | font-family: Arial; 3 | border-collapse: collapse; 4 | margin-top:50px; 5 | margin-right:25px; 6 | width: 70%; 7 | overflow:auto; 8 | } 9 | 10 | #table1 td, #table1 th { 11 | border: 1px solid #ddd; 12 | padding: 8px; 13 | } 14 | 15 | #table1 tr:nth-child(even){background-color: #f2f2f2;} 16 | 17 | #table1 tr:hover {background-color: #ddd;} 18 | 19 | #table1 th { 20 | padding-top: 12px; 21 | padding-bottom: 12px; 22 | text-align: left; 23 | background-color: #0077b3; 24 | color: white; 25 | } 26 | 27 | .button1 { 28 | border:none; 29 | color: white; 30 | padding: 10px 24px; 31 | text-align: center; 32 | text-decoration: none; 33 | display: inline-block; 34 | margin: 4px 2px; 35 | cursor: pointer; 36 | } 37 | 38 | .edit-btn 39 | { 40 | background-color:#2E8B57; 41 | } 42 | 43 | .del-btn 44 | { 45 | background-color:#800000; 46 | } 47 | -------------------------------------------------------------------------------- /PHARMACY/table2.css: -------------------------------------------------------------------------------- 1 | #table1 { 2 | font-family: Arial; 3 | border-collapse: collapse; 4 | margin-top:50px; 5 | margin-right:25px; 6 | width: 80%; 7 | overflow:auto; 8 | } 9 | 10 | #table1 td, #table1 th { 11 | border: 1px solid #ddd; 12 | padding: 8px; 13 | } 14 | 15 | #table1 tr:nth-child(even){background-color: #f2f2f2;} 16 | 17 | #table1 tr:hover {background-color: #ddd;} 18 | 19 | #table1 th { 20 | padding-top: 12px; 21 | padding-bottom: 12px; 22 | text-align: left; 23 | background-color: #0077b3; 24 | color: white; 25 | } 26 | 27 | .button1 { 28 | border:none; 29 | color: white; 30 | padding: 10px 24px; 31 | text-align: center; 32 | text-decoration: none; 33 | display: inline-block; 34 | margin: 4px 2px; 35 | cursor: pointer; 36 | } 37 | 38 | .edit-btn 39 | { 40 | background-color:#2E8B57; 41 | } 42 | 43 | .del-btn 44 | { 45 | background-color:#800000; 46 | } 47 | 48 | .view-btn 49 | { 50 | background-color:#0077b3; 51 | } 52 | -------------------------------------------------------------------------------- /PHARMACY/form2.css: -------------------------------------------------------------------------------- 1 | .one{ 2 | border-radius: 5px; 3 | box-sizing: border-box; 4 | background-color: #f2f2f2; 5 | padding:30px; 6 | padding-left: 60px; 7 | width:1175px; 8 | float:right; 9 | margin-right:45px; 10 | margin-top:0px; 11 | margin-bottom:50px; 12 | font-family:Arial; 13 | } 14 | 15 | .column { 16 | float: left; 17 | width: 50%; 18 | } 19 | 20 | .row:after { 21 | content: ""; 22 | display: table; 23 | clear: both; 24 | } 25 | 26 | 27 | input[type=text],input[type=number],input[type=date],select { 28 | width: 80%; 29 | padding: 12px; 30 | border: 1px solid #ccc; 31 | border-radius: 4px; 32 | } 33 | 34 | label { 35 | padding: 12px 12px 12px 0; 36 | display: inline-block; 37 | } 38 | 39 | input[type=submit]{ 40 | background-color: #0077b3; 41 | color: white; 42 | padding: 12px 20px; 43 | border: none; 44 | border-radius: 4px; 45 | cursor: pointer; 46 | display:inline-block; 47 | margin-top:20px; 48 | } 49 | 50 | 51 | input[type=submit]:hover { 52 | background-color: #0088cc; 53 | } 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /PHARMACY/form4.css: -------------------------------------------------------------------------------- 1 | .one{ 2 | border-radius: 5px; 3 | box-sizing: border-box; 4 | background-color: #f2f2f2; 5 | padding:30px; 6 | padding-left: 60px; 7 | width:1175px; 8 | float:right; 9 | margin-right:58px; 10 | margin-top:20px; 11 | margin-bottom:50px; 12 | font-family:Arial; 13 | } 14 | 15 | .column { 16 | float: left; 17 | width: 50%; 18 | } 19 | 20 | .row:after { 21 | content: ""; 22 | display: table; 23 | clear: both; 24 | } 25 | 26 | 27 | input[type=text],input[type=number],input[type=date],select { 28 | width: 80%; 29 | padding: 12px; 30 | border: 1px solid #ccc; 31 | border-radius: 4px; 32 | } 33 | 34 | label { 35 | padding: 12px 12px 12px 0; 36 | display: inline-block; 37 | } 38 | 39 | input[type=submit]{ 40 | background-color: #0077b3; 41 | color: white; 42 | padding: 12px 20px; 43 | border: none; 44 | border-radius: 4px; 45 | cursor: pointer; 46 | display:inline-block; 47 | margin-top:20px; 48 | } 49 | 50 | 51 | input[type=submit]:hover { 52 | background-color: #0088cc; 53 | } 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /PHARMACY/form3.css: -------------------------------------------------------------------------------- 1 | .one{ 2 | border-radius: 5px; 3 | box-sizing: border-box; 4 | background-color: #f2f2f2; 5 | padding:30px; 6 | padding-right:10px; 7 | padding-left: 60px; 8 | width:1000px; 9 | float:right; 10 | margin-right:45px; 11 | margin-top:0px; 12 | margin-bottom:50px; 13 | font-family:Arial; 14 | } 15 | 16 | .column { 17 | float: left; 18 | width: 33%; 19 | } 20 | 21 | .row:after { 22 | content: ""; 23 | display: table; 24 | clear: both; 25 | } 26 | 27 | 28 | input[type=text],input[type=number],input[type=date],select { 29 | width: 30%; 30 | padding: 12px; 31 | border: 1px solid #ccc; 32 | border-radius: 4px; 33 | } 34 | 35 | label { 36 | padding: 12px 12px 12px 0; 37 | display: inline-block; 38 | } 39 | 40 | input[type=submit]{ 41 | background-color: #0077b3; 42 | color: white; 43 | padding: 12px 20px; 44 | border: none; 45 | border-radius: 4px; 46 | cursor: pointer; 47 | display:inline-block; 48 | margin-top:20px; 49 | } 50 | 51 | 52 | input[type=submit]:hover { 53 | background-color: #0088cc; 54 | } 55 | -------------------------------------------------------------------------------- /PHARMACY/login1.css: -------------------------------------------------------------------------------- 1 | body{ 2 | font-family:Arial; 3 | background-image:url("pharm1.png"); 4 | background-size:cover; 5 | overflow:hidden; 6 | } 7 | 8 | .header { 9 | padding: 10px; 10 | margin:-10px; 11 | text-align: center; 12 | background: #003366; 13 | color: white; 14 | font-size: 30px; 15 | overflow:hidden; 16 | } 17 | 18 | .footer { 19 | position: fixed; 20 | left: 0; 21 | bottom: 0; 22 | width: 100%; 23 | right:0; 24 | background-color: #003366; 25 | color: white; 26 | text-align: center; 27 | overflow:hidden; 28 | } 29 | 30 | .container{ 31 | width:30%; 32 | margin:auto; 33 | background-color:white; 34 | 35 | } 36 | 37 | 38 | #div_login{ 39 | border:1px solid gray; 40 | border-radius: 3px; 41 | width: 30%px; 42 | height: 280px; 43 | box-shadow: 0px 2px 2px 0px gray; 44 | margin: 0 auto; 45 | } 46 | 47 | #div_login h1{ 48 | margin-top: 0px; 49 | font-weight: normal; 50 | padding: 10px; 51 | background-color: #003366; 52 | color: white; 53 | font-family: sans-serif; 54 | } 55 | 56 | #div_login div{ 57 | clear: both; 58 | margin-top: 10px; 59 | padding: 5px; 60 | padding-right: 15px; 61 | } 62 | 63 | #div_login .textbox{ 64 | width: 90%; 65 | padding: 7px; 66 | 67 | } 68 | 69 | input[type=submit]{ 70 | background-color: #0077b3; 71 | color: white; 72 | padding: 12px 20px; 73 | border: none; 74 | border-radius: 4px; 75 | cursor: pointer; 76 | display:inline-block; 77 | margin-top:5px; 78 | } 79 | -------------------------------------------------------------------------------- /PHARMACY/mainpage.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |

PHARMACIA

8 |

Pharmacy Management System

9 |
10 | 11 | Pharmacia 12 | 13 | 14 | 15 | 16 | 17 |



18 |
19 |
20 |
21 |

Admin Login

22 |
23 |
24 | 25 |
26 |
27 | 28 |
29 |
30 | 31 | 32 | 33 | 34 | query($sql); 47 | $row = $result->fetch_row(); 48 | if(!$row) { 49 | echo "

Invalid username or password!

"; 50 | } 51 | else { 52 | session_start(); 53 | $_SESSION['user']=$uname; 54 | header('location:adminmainpage.php'); 55 | } 56 | } 57 | } 58 | 59 | if(isset($_POST['psubmit'])) 60 | { 61 | header("location:mainpage1.php"); 62 | } 63 | ?> 64 | 65 |
66 |
67 |
68 |
69 |
70 | 71 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /PHARMACY/mainpage1.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |

PHARMACIA

8 |

Pharmacy Management System

9 |
10 | 11 | Pharmacia 12 | 13 | 14 | 15 | 16 | 17 |



18 |
19 |
20 |
21 |

Pharmacist Login

22 |
23 |
24 | 25 |
26 |
27 | 28 |
29 |
30 | 31 | 32 |
33 | 34 | 35 | query($sql); 48 | $row = $result->fetch_row(); 49 | if(!$row) { 50 | echo "

Invalid username or password!

"; 51 | } 52 | else { 53 | 54 | $emp=$row[0]; 55 | session_start(); 56 | $_SESSION['user']=$emp; 57 | header("location:pharmmainpage.php"); 58 | } 59 | } 60 | } 61 | 62 | if(isset($_POST['psubmit'])) 63 | { 64 | header("location:mainpage.php"); 65 | } 66 | ?> 67 | 68 |
69 |
70 |
71 |
72 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /PHARMACY/pharmmainpage.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Pharmacist Dashboard 9 | 10 | 11 | 14 | 15 | 16 | 17 |
18 |

PHARMACIA

19 | Dashboard 20 | 21 | View Inventory 22 | Add New Sale 23 | 26 | 30 |
31 | 32 | query($sql); 39 | $row=$result->fetch_row(); 40 | 41 | $ename=$row[0]; 42 | 43 | ?> 44 | 45 |
46 | Logout(signed in as ) 47 |
48 | 49 |
50 |
51 |

PHARMACIST DASHBOARD

52 |
53 |
54 | 55 | 56 | Add New Sale 57 | 58 | 59 | 60 | Inventory 61 | 62 | 63 | 64 | 65 | 84 | 85 | -------------------------------------------------------------------------------- /PHARMACY/nav2.css: -------------------------------------------------------------------------------- 1 | .header { 2 | padding: 60px; 3 | text-align: center; 4 | background: #1abc9c; 5 | color: white; 6 | font-size: 30px; 7 | margin: 0; 8 | } 9 | 10 | .sidenav { 11 | height: 100%; 12 | width: 15%; 13 | position: fixed; 14 | z-index: 1; 15 | top: 0; 16 | left: 0; 17 | background-color: #003366; 18 | padding-top: 10px; 19 | padding-left:5px; 20 | font-family:Arial; 21 | 22 | } 23 | 24 | 25 | .sidenav a,.dropdown-btn { 26 | padding: 6px 8px 6px 16px; 27 | text-decoration: none; 28 | font-size: 20px; 29 | color: #bfbfbf; 30 | display: block; 31 | border: none; 32 | background: none; 33 | width: 100%; 34 | text-align: left; 35 | cursor: pointer; 36 | outline: none; 37 | } 38 | 39 | .sidenav a:hover, .dropdown-btn:hover { 40 | color: #f1f1f1; 41 | } 42 | 43 | 44 | .active { 45 | background-color: #004d99; 46 | color: white; 47 | } 48 | 49 | 50 | .dropdown-container { 51 | display: none; 52 | background-color: #004d99; 53 | padding-left: 8px; 54 | } 55 | 56 | 57 | 58 | i { 59 | border: solid white; 60 | border-width: 0 3px 3px 0; 61 | display: inline-block; 62 | padding: 3px; 63 | } 64 | 65 | .down { 66 | transform: rotate(45deg); 67 | -webkit-transform: rotate(45deg); 68 | } 69 | 70 | 71 | 72 | @media screen and (max-height: 450px) { 73 | .sidenav {padding-top: 15px;} 74 | .sidenav a {font-size: 18px;} 75 | } 76 | 77 | .topnav { 78 | overflow: hidden; 79 | background-color: #003366; 80 | margin:0px; 81 | vertical-align:top; 82 | width: 100%; 83 | height:9%; 84 | position: fixed; 85 | x-index: 1; 86 | top: 0; 87 | left: 0; 88 | 89 | 90 | } 91 | 92 | .topnav a { 93 | float: right; 94 | text-align: center; 95 | padding: 20px 22px; 96 | text-decoration: none; 97 | font-size: 20px; 98 | font-family:Arial; 99 | color: #bfbfbf; 100 | display: block; 101 | border: none; 102 | background: none; 103 | cursor: pointer; 104 | outline: none; 105 | } 106 | 107 | .topnav a:hover { 108 | color: #f1f1f1 109 | } 110 | 111 | .topnav a.active { 112 | background-color: #4CAF50; 113 | color: white; 114 | } 115 | 116 | div.head { 117 | width:78%; 118 | font-family:Arial; 119 | background-color:#e6e6e6; 120 | color:#003366; 121 | float:right; 122 | margin-top:80px; 123 | margin-right:53px; 124 | margin-left:0px; 125 | top: 0; 126 | right: 0; 127 | overflow:hidden; 128 | } 129 | -------------------------------------------------------------------------------- /PHARMACY/pharm-customer-view.php: -------------------------------------------------------------------------------- 1 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | Customers 32 | 33 | 34 | 35 | 36 | 37 |
38 |

PHARMACIA

39 | Dashboard 40 | 41 | View Inventory 42 | Add New Sale 43 | 46 | 50 |
51 | 52 | query($sql); 59 | $row=$result->fetch_row(); 60 | 61 | $ename=$row[0]; 62 | 63 | ?> 64 | 65 |
66 | Logout(signed in as ) 67 |
68 | 69 |
70 | 71 |
72 |

CUSTOMER LIST

73 |
74 | 75 |
76 |     77 | 78 |

79 |
80 | 81 |
82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | num_rows > 0) { 96 | while($row = $search_result->fetch_assoc()) { 97 | 98 | echo ""; 99 | echo ""; 100 | echo ""; 101 | echo ""; 102 | echo ""; 103 | echo ""; 104 | } 105 | echo "
Customer IDFirst NameLast NamePhone Number
" . $row["c_id"]. "" . $row["c_fname"] . "" . $row["c_lname"]. "" . $row["c_phno"]. "
"; 106 | } 107 | 108 | $conn->close(); 109 | ?> 110 | 111 | 112 | 113 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /PHARMACY/pharm-inventory.php: -------------------------------------------------------------------------------- 1 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Inventory 33 | 34 | 35 | 36 | 37 | 38 |
39 |

PHARMACIA

40 | Dashboard 41 | View Inventory 42 | Add New Sale 43 | 46 | 50 |
51 | 52 | query($sql1); 59 | $row1=$result1->fetch_row(); 60 | 61 | $ename=$row1[0]; 62 | 63 | ?> 64 | 65 |
66 | Logout(signed in as ) 67 |
68 | 69 | 70 |
71 | 72 |
73 |

MEDICINE INVENTORY

74 |
75 | 76 |
77 |     78 | 79 |

80 |
81 | 82 |
83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | num_rows > 0) { 98 | 99 | while($row = $search_result->fetch_assoc()) { 100 | 101 | echo ""; 102 | echo ""; 103 | echo ""; 104 | echo ""; 105 | echo ""; 106 | echo ""; 107 | echo ""; 108 | echo ""; 109 | } 110 | echo "
Medicine IDMedicine NameQuantity AvailableCategoryPriceLocation in Store
" . $row["medid"]. "" . $row["medname"] . "" . $row["medqty"]. "" . $row["medcategory"]. "" . $row["medprice"] . "" . $row["medlocation"]. "
"; 111 | } 112 | 113 | $conn->close(); 114 | ?> 115 | 116 | 117 | 118 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /PHARMACY/stockreport.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Reports 10 | 11 | 12 | 13 | 14 | 15 |
16 |

PHARMACIA

17 | Dashboard 18 | 21 | 25 | 28 | 32 | 35 | 39 | 42 | 46 | 49 | 53 | View Sales Invoice Details 54 | View Sold Products Details 55 | Add New Sale 56 | 59 | 64 |
65 | 66 |
67 | Logout 68 |
69 | 70 |
71 |
72 |

MEDICINES LOW ON STOCK(LESS THAN 50)

73 |
74 |
75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | num_rows > 0) { 90 | 91 | while($row = $result->fetch_assoc()) { 92 | 93 | echo ""; 94 | echo ""; 95 | echo ""; 96 | echo ""; 97 | echo ""; 98 | echo ""; 99 | echo ""; 100 | } 101 | echo "
Medicine IDMedicine NameQuantity AvailableCategoryPrice
" . $row["med_id"]. "" . $row["med_name"] . "" . $row["med_qty"]. "" . $row["category"]. "" . $row["med_price"] . "
"; 102 | } 103 | 104 | $conn->close(); 105 | ?> 106 | 107 | 108 | 109 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /PHARMACY/sales-view.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Sales Invoice 10 | 11 | 12 | 13 | 14 | 15 |
16 |

PHARMACIA

17 | Dashboard 18 | 21 | 25 | 28 | 32 | 35 | 39 | 42 | 46 | 49 | 53 | View Sales Invoice Details 54 | View Sold Products Details 55 | Add New Sale 56 | 59 | 64 |
65 | 66 |
67 | Logout 68 |
69 | 70 |
71 |
72 |

SALES INVOICE DETAILS

73 |
74 |
75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | query($sql); 90 | if ($result->num_rows > 0) { 91 | 92 | while($row = $result->fetch_assoc()) { 93 | 94 | 95 | echo ""; 96 | echo ""; 97 | echo ""; 98 | echo ""; 99 | echo ""; 100 | echo ""; 101 | echo ""; 102 | } 103 | echo "
Sale IDCustomer IDDate and Time Sale AmountEmployee ID
" . $row["sale_id"]. "" . $row["c_id"] . "" . $row["s_date"]."  ".$row["s_time"]."" . $row["total_amt"]. "" . $row["e_id"]. "
"; 104 | } 105 | $conn->close(); 106 | ?> 107 | 108 | 109 | 110 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /PHARMACY/adminmainpage.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Admin Dashboard 8 | 9 | 10 | 11 | 12 | 13 |
14 |

PHARMACIA

15 | Dashboard 16 | 19 | 23 | 26 | 30 | 33 | 37 | 40 | 44 | 47 | 51 | View Sales Invoice Details 52 | View Sold Products Details 53 | Add New Sale 54 | 57 | 62 |
63 | 64 |
65 | Logout(Logged in as Admin) 66 |
67 | 68 |
69 |
70 |

ADMIN DASHBOARD

71 |
72 |
73 | 74 | 75 | Add New Sale 76 | 77 | 78 | 79 | Inventory 80 | 81 | 82 | 83 | Employees List 84 | 85 |
86 | 87 | Transactions List 88 | 89 | 90 | 91 | Low Stock Report 92 | 93 | 94 | 95 | 96 | 97 | 113 | 114 | -------------------------------------------------------------------------------- /PHARMACY/expiryreport.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Reports 10 | 11 | 12 | 13 | 14 | 15 |
16 |

PHARMACIA

17 | Dashboard 18 | 21 | 25 | 28 | 32 | 35 | 39 | 42 | 46 | 49 | 53 | View Sales Invoice Details 54 | View Sold Products Details 55 | Add New Sale 56 | 59 | 64 |
65 | 66 |
67 | Logout 68 |
69 | 70 |
71 |
72 |

STOCK EXPIRING WITHIN 6 MONTHS

73 |
74 |
75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | num_rows > 0) { 93 | 94 | while($row = $result->fetch_assoc()) { 95 | 96 | echo ""; 97 | echo ""; 98 | echo ""; 99 | echo ""; 100 | echo ""; 101 | echo ""; 102 | echo ""; 103 | echo ""; 104 | echo ""; 105 | echo ""; 106 | } 107 | echo "
Purchase IDSupplier IDMedicine IDQuantityCost of PurchaseDate of PurchaseManufacturing DateExpiry Date
" . $row["p_id"]. "" . $row["sup_id"]. "" . $row["med_id"]. "" . $row["p_qty"]. "" . $row["p_cost"]. "" . $row["pur_date"]. "" . $row["mfg_date"] . "" . $row["exp_date"]. "
"; 108 | } 109 | 110 | $conn->close(); 111 | 112 | ?> 113 | 114 | 115 | 116 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /PHARMACY/salesitems-view.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Products - Sale 10 | 11 | 12 | 13 | 14 | 15 |
16 |

PHARMACIA

17 | Dashboard 18 | 21 | 25 | 28 | 32 | 35 | 39 | 42 | 46 | 49 | 53 | View Sales Invoice Details 54 | View Sold Products Details 55 | Add New Sale 56 | 59 | 64 |
65 | 66 |
67 | Logout 68 |
69 | 70 |
71 |
72 |

LIST OF PRODUCTS SOLD

73 |
74 |
75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | query($sql); 91 | if ($result->num_rows > 0) { 92 | 93 | while($row = $result->fetch_assoc()) { 94 | 95 | $sql1="SELECT med_name from meds where med_id=".$row["med_id"].""; 96 | $result1 = $conn->query($sql1); 97 | 98 | 99 | while($row1 = $result1->fetch_assoc()) { 100 | 101 | echo ""; 102 | echo ""; 103 | echo ""; 104 | echo ""; 105 | echo ""; 106 | echo ""; 107 | echo ""; 108 | } 109 | } 110 | 111 | echo "
Sale IDMedicine IDMedicine NameQuantity SoldTotal Price
" . $row["sale_id"]. "" . $row["med_id"] . "" . $row1["med_name"]. "" . $row["sale_qty"]. "" . $row["tot_price"]. "
"; 112 | } 113 | 114 | $conn->close(); 115 | 116 | ?> 117 | 118 | 119 | 120 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /PHARMACY/customer-view.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Customers 9 | 10 | 11 | 12 | 13 | 14 |
15 |

PHARMACIA

16 | Dashboard 17 | 20 | 24 | 27 | 31 | 34 | 38 | 41 | 45 | 48 | 52 | View Sales Invoice Details 53 | View Sold Products Details 54 | Add New Sale 55 | 58 | 63 |
64 | 65 |
66 | Logout 67 |
68 | 69 |
70 |
71 |

CUSTOMER LIST

72 |
73 |
74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | query($sql); 92 | if ($result->num_rows > 0) { 93 | 94 | while($row = $result->fetch_assoc()) { 95 | 96 | echo ""; 97 | echo ""; 98 | echo ""; 99 | echo ""; 100 | echo ""; 101 | echo ""; 102 | echo ""; 103 | echo ""; 104 | echo ""; 108 | echo ""; 109 | } 110 | echo "
Customer IDFirst NameLast NameAgeSexPhone NumberEmail AddressAction
" . $row["c_id"]. "" . $row["c_fname"] . "" . $row["c_lname"]. "" . $row["c_age"]. "" . $row["c_sex"] . "" . $row["c_phno"]. "" . $row["c_mail"]. ""; 105 | echo "Edit"; 106 | echo "Delete"; 107 | echo "
"; 111 | } 112 | 113 | $conn->close(); 114 | ?> 115 | 116 | 117 | 118 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /PHARMACY/supplier-view.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Suppliers 11 | 12 | 13 | 14 | 15 |
16 |

PHARMACIA

17 | Dashboard 18 | 21 | 25 | 28 | 32 | 35 | 39 | 42 | 46 | 49 | 53 | View Sales Invoice Details 54 | View Sold Products Details 55 | Add New Sale 56 | 59 | 64 |
65 | 66 |
67 | Logout 68 |
69 | 70 |
71 |
72 |

SUPPLIERS LIST

73 |
74 |
75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | query($sql); 91 | 92 | if ($result->num_rows > 0) { 93 | 94 | while($row = $result->fetch_assoc()) { 95 | 96 | echo ""; 97 | echo ""; 98 | echo ""; 99 | echo ""; 100 | echo ""; 101 | echo ""; 102 | echo ""; 106 | echo ""; 107 | } 108 | echo "
Supplier IDCompany NameAddressPhone NumberEmail AddressAction
" . $row["sup_id"]. "" . $row["sup_name"] . "" . $row["sup_add"]. "" . $row["sup_phno"]. "" . $row["sup_mail"]. ""; 103 | echo "Edit"; 104 | echo "Delete"; 105 | echo "
"; 109 | } 110 | 111 | $conn->close(); 112 | 113 | ?> 114 | 115 | 116 | 117 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /PHARMACY/pharm-customer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 |
15 |

PHARMACIA

16 | Dashboard 17 | 18 | View Inventory 19 | Add New Sale 20 | 23 | 27 |
28 | 29 | query($sql); 35 | $row=$result->fetch_row(); 36 | 37 | $ename=$row[0]; 38 | 39 | ?> 40 | 41 |
42 | Logout(signed in as ) 43 |
44 | 45 |
46 |
47 |

ADD CUSTOMER DETAILS

48 |
49 |
50 | 51 |







52 | 53 |
54 |
55 |
56 |
57 |

58 |
59 | 60 |

61 |

62 |
63 | 64 |

65 |

66 |
67 | 68 |

69 |

70 |
71 | 72 |

73 | 74 |

75 |
76 | 82 |

83 | 84 |
85 |
86 | 87 |

88 |
89 | 90 |

91 |

92 |
93 | 94 |

95 |
96 | 97 | 98 |
99 |
100 | 101 | 102 | Customer successfully added!

"; 120 | } else{ 121 | echo "

Error! Check details.

"; 122 | } 123 | } 124 | 125 | $conn->close(); 126 | ?> 127 |
128 |
129 | 130 | 131 | 132 | 148 | 149 | -------------------------------------------------------------------------------- /PHARMACY/inventory-view.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Medicines 10 | 11 | 12 | 13 | 14 |
15 |

PHARMACIA

16 | Dashboard 17 | 20 | 24 | 27 | 31 | 34 | 38 | 41 | 45 | 48 | 52 | View Sales Invoice Details 53 | View Sold Products Details 54 | Add New Sale 55 | 58 | 63 |
64 | 65 |
66 | Logout 67 |
68 | 69 |
70 |
71 |

MEDICINE INVENTORY

72 |
73 |
74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | query($sql); 91 | if ($result->num_rows > 0) { 92 | 93 | while($row = $result->fetch_assoc()) { 94 | 95 | echo ""; 96 | echo ""; 97 | echo ""; 98 | echo ""; 99 | echo ""; 100 | echo ""; 101 | echo ""; 102 | echo ""; 109 | echo ""; 110 | } 111 | echo "
Medicine IDMedicine NameQuantity AvailableCategoryPriceLocation in StoreAction
" . $row["med_id"]. "" . $row["med_name"] . "" . $row["med_qty"]. "" . $row["category"]. "" . $row["med_price"] . "" . $row["location_rack"]. ""; 103 | 104 | echo "Edit"; 105 | 106 | echo "Delete"; 107 | 108 | echo "
"; 112 | } 113 | 114 | $conn->close(); 115 | ?> 116 | 117 | 118 | 119 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /PHARMACY/pharm-pos2.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | New Sales 11 | 12 | 13 | 14 | 15 | 16 |
17 |

PHARMACIA

18 | Dashboard 19 | 20 | View Inventory 21 | Add New Sale 22 | 25 | 29 |
30 | 31 | query($sql); 38 | $row=$result->fetch_row(); 39 | 40 | $ename=$row[0]; 41 | 42 | ?> 43 | 44 |
45 | Logout(signed in as ) 46 |
47 | 48 |
49 |
50 |

SALES INVOICE

51 |
52 |
53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | query($sql)){ 74 | die('There was an error running the query [' . $conn->error . ']'); 75 | } 76 | 77 | $row = $result->fetch_assoc(); 78 | $sid=$row['Auto_increment']-1; 79 | } 80 | 81 | if(!empty($sid)) { 82 | $qry1 = "SELECT med_id,sale_qty,tot_price FROM sales_items where sale_id=$sid"; 83 | $result1 = $conn->query($qry1); 84 | $sum=0; 85 | 86 | if ($result1->num_rows > 0) { 87 | 88 | while($row1 = $result1->fetch_assoc()) { 89 | 90 | $medid=$row1["med_id"]; 91 | $qry2 = "SELECT med_name,med_price FROM meds where med_id=$medid"; 92 | $result2 = $conn->query($qry2); 93 | $row2=$result2->fetch_row(); 94 | 95 | echo ""; 96 | echo ""; 97 | echo ""; 98 | echo ""; 99 | echo ""; 100 | echo ""; 101 | echo ""; 104 | echo ""; 105 | } 106 | echo "
Medicine IDMedicine NameQuantityPriceTotal PriceAction
" . $row1["med_id"]. "" . $row2[0] . "" . $row1["sale_qty"]. "" . $row2[1] . "" . $row1["tot_price"]. ""; 102 | echo "Delete"; 103 | echo "
"; 107 | } 108 | } 109 | 110 | ?> 111 | 112 |
113 |
114 | Go Back to Sales Page 115 |       116 |
117 |
118 |
119 | 120 | 134 | 135 | Total 136 | ";echo $tot; 137 | echo " 138 | 139 | "; 140 | } 141 | 142 | ?> 143 | 144 | 145 | 146 | 164 | 165 | -------------------------------------------------------------------------------- /PHARMACY/employee-view.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Employees 10 | 11 | 12 | 13 | 14 | 15 |
16 |

PHARMACIA

17 | Dashboard 18 | 21 | 25 | 28 | 32 | 35 | 39 | 42 | 46 | 49 | 53 | View Sales Invoice Details 54 | View Sold Products Details 55 | Add New Sale 56 | 59 | 64 |
65 | 66 |
67 | Logout 68 |
69 | 70 |
71 |
72 |

EMPLOYEE LIST

73 |
74 |
75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 1"; 97 | $result = $conn->query($sql); 98 | 99 | if ($result->num_rows > 0) { 100 | 101 | while($row = $result->fetch_assoc()) { 102 | 103 | echo ""; 104 | echo ""; 105 | echo ""; 106 | echo ""; 107 | echo ""; 108 | echo ""; 109 | echo ""; 110 | echo ""; 111 | echo ""; 112 | echo ""; 113 | echo ""; 114 | echo ""; 115 | echo ""; 116 | echo ""; 120 | echo ""; 121 | } 122 | echo "
Employee IDFirst NameLast NameDate of BirthAgeSexEmployee TypeDate of JoiningSalaryPhone NumberEmail AddressHome AddressAction
" . $row["e_id"]. "" . $row["e_fname"] . "" . $row["e_lname"] . "" . $row["bdate"] . "" . $row["e_age"]. "" . $row["e_sex"]. "" . $row["e_type"]. "" . $row["e_jdate"]. "" . $row["e_sal"]. "" . $row["e_phno"]. "" . $row["e_mail"]. "" . $row["e_add"]. ""; 117 | echo "Edit"; 118 | echo "Delete"; 119 | echo "
"; 123 | } 124 | 125 | $conn->close(); 126 | 127 | ?> 128 | 129 | 130 | 131 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /PHARMACY/purchase-view.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Purchases 11 | 12 | 13 | 14 | 15 | 16 |
17 |

PHARMACIA

18 | Dashboard 19 | 22 | 26 | 29 | 33 | 36 | 40 | 43 | 47 | 50 | 54 | View Sales Invoice Details 55 | View Sold Products Details 56 | Add New Sale 57 | 60 | 65 |
66 | 67 |
68 | Logout 69 |
70 | 71 |
72 |
73 |

STOCK PURCHASE LIST

74 |
75 |
76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | query($sql); 96 | 97 | if ($result->num_rows > 0) { 98 | 99 | while($row = $result->fetch_assoc()) { 100 | 101 | $sql1="SELECT med_name from meds where med_id=".$row["med_id"].""; 102 | $result1 = $conn->query($sql1); 103 | 104 | while($row1 = $result1->fetch_assoc()) { 105 | 106 | echo ""; 107 | echo ""; 108 | echo ""; 109 | echo ""; 110 | echo ""; 111 | echo ""; 112 | echo ""; 113 | echo ""; 114 | echo ""; 115 | echo ""; 116 | echo ""; 120 | echo ""; 121 | } 122 | } 123 | echo "
Purchase IDSupplier IDMedicine IDMedicine NameQuantityCost of PurchaseDate of PurchaseManufacturing DateExpiry DateAction
" . $row["p_id"]. "" . $row["sup_id"]. "" . $row["med_id"]. "" . $row1["med_name"] . "" . $row["p_qty"]. "" . $row["p_cost"]. "" . $row["pur_date"]. "" . $row["mfg_date"] . "" . $row["exp_date"]. ""; 117 | echo "Edit"; 118 | echo "Delete"; 119 | echo "
"; 124 | } 125 | $conn->close(); 126 | 127 | ?> 128 | 129 | 130 | 131 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /PHARMACY/supplier-add.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Suppliers 11 | 12 | 13 | 14 | 15 | 16 |
17 |

PHARMACIA

18 | Dashboard 19 | 22 | 26 | 29 | 33 | 36 | 40 | 43 | 47 | 50 | 54 | View Sales Invoice Details 55 | View Sold Products Details 56 | Add New Sale 57 | 60 | 65 |
66 | 67 |
68 | Logout 69 |
70 | 71 |
72 |
73 |

ADD SUPPLIER DETAILS

74 |
75 |
76 | 77 | 78 | 79 |
80 | 81 |
82 |
83 |

84 |
85 | 86 |

87 |

88 |
89 | 90 |

91 |

92 |
93 | 94 |

95 | 96 | 97 |
98 |
99 |

100 |
101 | 102 |

103 | 104 |

105 |
106 | 107 |

108 | 109 |
110 | 111 | 112 | 113 |
114 |
115 | 116 | 117 | Supplier details successfully added!

"; 132 | } else{ 133 | echo "

Error! Check details.

"; 134 | } 135 | } 136 | 137 | $conn->close(); 138 | ?> 139 | 140 |
141 | 142 | 143 | 144 | 162 | 163 | -------------------------------------------------------------------------------- /PHARMACY/supplier-update.php: -------------------------------------------------------------------------------- 1 | query($qry1); 9 | $row = $result -> fetch_row(); 10 | } 11 | ?> 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Suppliers 23 | 24 | 25 | 26 | 27 | 28 |
29 |

PHARMACIA

30 | Dashboard 31 | 34 | 38 | 41 | 45 | 48 | 52 | 55 | 59 | 62 | 66 | View Sales Invoice Details 67 | View Sold Products Details 68 | Add New Sale 69 | 72 | 77 |
78 | 79 |
80 | Logout 81 |
82 | 83 |
84 |
85 |

UPDATE SUPPLIER DETAILS

86 |
87 |
88 | 89 | 90 |
91 |
92 |
93 |
94 |

95 |
96 | 97 |

98 |

99 |
100 | 101 |

102 |

103 |
104 | 105 |

106 | 107 | 108 |
109 |
110 |

111 |
112 | 113 |

114 | 115 |

116 |
117 | 118 |

119 | 120 |
121 | 122 | 123 | 124 |
125 | 126 | query($sql)) 137 | header("location:supplier-view.php"); 138 | else 139 | echo "

Error! Unable to update.

"; 140 | } 141 | 142 | ?> 143 |
144 |
145 | 146 | 147 | 148 | 164 | 165 | -------------------------------------------------------------------------------- /PHARMACY/inventory-update.php: -------------------------------------------------------------------------------- 1 | query($qry1); 9 | $row = $result -> fetch_row(); 10 | } 11 | ?> 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Medicines 23 | 24 | 25 | 26 | 27 | 28 |
29 |

PHARMACIA

30 | Dashboard 31 | 34 | 38 | 41 | 45 | 48 | 52 | 55 | 59 | 62 | 66 | View Sales Invoice Details 67 | View Sold Products Details 68 | Add New Sale 69 | 72 | 77 |
78 | 79 |
80 | Logout 81 |
82 | 83 |
84 |
85 |

UPDATE MEDICINE DETAILS

86 |
87 |
88 | 89 |
90 |
91 |
92 |
93 |

94 |
95 | 96 |

97 |

98 |
99 | 100 |

101 |

102 |
103 | 104 |

105 |

106 |
107 | 108 |

109 |
110 | 111 |
112 |

113 |
114 | 115 |

116 |

117 |
118 | 119 |

120 |
121 | 122 | 123 |
124 | 125 | query($sql)) 137 | header("location:inventory-view.php"); 138 | else 139 | echo "

Error! Unable to update.

"; 140 | } 141 | 142 | ?> 143 |
144 |
145 | 146 | 147 | 148 | 166 | 167 | -------------------------------------------------------------------------------- /PHARMACY/inventory-add.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Medicines 11 | 12 | 13 | 14 | 15 | 16 |
17 |

PHARMACIA

18 | Dashboard 19 | 22 | 26 | 29 | 33 | 36 | 40 | 43 | 47 | 50 | 54 | View Sales Invoice Details 55 | View Sold Products Details 56 | Add New Sale 57 | 60 | 65 |
66 | 67 |
68 | Logout 69 |
70 | 71 |
72 |
73 |

ADD MEDICINE DETAILS

74 |
75 |
76 | 77 | 78 |







79 | 80 | 81 |
82 |
83 |
84 |
85 |

86 |
87 | 88 |

89 |

90 |
91 | 92 |

93 |

94 |
95 | 96 |

97 |

98 |
99 | 104 |

105 | 106 |
107 |
108 | 109 |

110 |
111 | 112 |

113 |

114 |
115 | 116 |

117 |
118 | 119 | 120 | 121 |
122 |
123 | 124 | 125 | Medicine details successfully added!

"; 142 | } else{ 143 | echo "

Error! Check details.

"; 144 | } 145 | } 146 | 147 | $conn->close(); 148 | ?> 149 |
150 |
151 | 152 | 153 | 154 | 172 | 173 | 174 | 175 | 176 | -------------------------------------------------------------------------------- /PHARMACY/customer-update.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Customers 9 | 10 | 11 | 12 | 13 | 14 |
15 |

PHARMACIA

16 | Dashboard 17 | 20 | 24 | 27 | 31 | 34 | 38 | 41 | 45 | 48 | 52 | View Sales Invoice Details 53 | View Sold Products Details 54 | Add New Sale 55 | 58 | 63 |
64 | 65 |
66 | Logout 67 |
68 | 69 |
70 |
71 |

UPDATE CUSTOMER DETAILS

72 |
73 |
74 | 75 | 76 |
77 |
78 | 79 | query($qry1); 88 | $row = $result -> fetch_row(); 89 | } 90 | 91 | if( isset($_POST['update'])) 92 | { 93 | $id = $_POST['cid']; 94 | $fname = $_POST['cfname']; 95 | $lname = $_POST['clname']; 96 | $age = $_POST['age']; 97 | $sex = $_POST['sex']; 98 | $phno = $_POST['phno']; 99 | $mail = $_POST['emid']; 100 | 101 | $sql="UPDATE customer SET c_fname='$fname',c_lname='$lname',c_age='$age',c_sex='$sex',c_phno='$phno',c_mail='$mail' where c_id='$id'"; 102 | if ($conn->query($sql)) 103 | header("location:customer-view.php"); 104 | else 105 | echo "

Error! Unable to update.

"; 106 | } 107 | 108 | ?> 109 |
110 |
111 |

112 |
113 | 114 |

115 |

116 |
117 | 118 |

119 |

120 |
121 | 122 |

123 |

124 |
125 | 126 |

127 | 128 |

129 |
130 | 131 |

132 | 133 |
134 |
135 | 136 |

137 |
138 | 139 |

140 |

141 |
142 | 143 |

144 |
145 | 146 | 147 | 148 |
149 |
150 |
151 | 152 | 153 | 154 | 172 | 173 | -------------------------------------------------------------------------------- /PHARMACY/customer-add.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Customers 10 | 11 | 12 | 13 | 14 | 15 |
16 |

PHARMACIA

17 | Dashboard 18 | 21 | 25 | 28 | 32 | 35 | 39 | 42 | 46 | 49 | 53 | View Sales Invoice Details 54 | View Sold Products Details 55 | Add New Sale 56 | 59 | 65 |
66 | 67 |
68 | Logout 69 |
70 | 71 |
72 |
73 |

ADD CUSTOMER DETAILS

74 |
75 |
76 | 77 |







78 | 79 |
80 |
81 |
82 |
83 |

84 |
85 | 86 |

87 |

88 |
89 | 90 |

91 |

92 |
93 | 94 |

95 |

96 |
97 | 98 |

99 | 100 |

101 |
102 | 108 |

109 | 110 |
111 |
112 | 113 |

114 |
115 | 116 |

117 |

118 |
119 | 120 |

121 |
122 | 123 | 124 | 125 |
126 |
127 | 128 | 129 | Customer successfully added!

"; 146 | } else{ 147 | echo "

Error! Check details.

"; 148 | } 149 | } 150 | 151 | $conn->close(); 152 | ?> 153 |
154 |
155 | 156 | 157 | 158 | 176 | 177 | -------------------------------------------------------------------------------- /PHARMACY/purchase-add.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Purchases 9 | 10 | 11 | 12 | 13 | 14 |
15 |

PHARMACIA

16 | Dashboard 17 | 20 | 24 | 27 | 31 | 34 | 38 | 41 | 45 | 48 | 52 | View Sales Invoice Details 53 | View Sold Products Details 54 | Add New Sale 55 | 58 | 63 |
64 | 65 |
66 | Logout 67 |
68 | 69 |
70 |
71 |

ADD PURCHASE DETAILS

72 |
73 |
74 | 75 | 76 |







77 | 78 | 79 |
80 |
81 | 82 | Purchase details successfully added!

"; 100 | } else{ 101 | echo "

Error! Check details.

"; 102 | } 103 | 104 | } 105 | 106 | $conn->close(); 107 | ?> 108 | 109 |
110 |

111 |
112 | 113 |

114 |

115 |
116 | 117 |

118 |

119 |
120 | 121 |

122 |

123 |
124 | 125 |

126 | 127 | 128 |
129 |
130 | 131 |

132 |
133 | 134 |

135 | 136 | 137 |

138 |
139 | 140 |

141 |

142 |
143 | 144 |

145 |

146 |
147 | 148 |

149 | 150 |
151 | 152 | 153 | 154 |
155 |
156 | 157 |
158 | 159 | 160 | 161 | 179 | 180 | -------------------------------------------------------------------------------- /PHARMACY/pos2.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | New Sales 11 | 12 | 13 | 14 | 15 | 16 |
17 |

PHARMACIA

18 | Dashboard 19 | 22 | 26 | 29 | 33 | 36 | 40 | 43 | 47 | 50 | 54 | View Sales Invoice Details 55 | View Sold Products Details 56 | Add New Sale 57 | 60 | 65 |
66 | 67 |
68 | Logout 69 |
70 | 71 |
72 |
73 |

SALES INVOICE

74 |
75 |
76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | query($sql)){ 100 | die('There was an error running the query [' . $conn->error . ']'); 101 | } 102 | $row = $result->fetch_assoc(); 103 | $sid=$row['Auto_increment']-1; 104 | } 105 | 106 | if(!empty($sid)) { 107 | $qry1 = "SELECT med_id,sale_qty,tot_price FROM sales_items where sale_id=$sid"; 108 | $result1 = $conn->query($qry1); 109 | $sum=0; 110 | 111 | if ($result1->num_rows > 0) { 112 | 113 | while($row1 = $result1->fetch_assoc()) { 114 | 115 | $medid=$row1["med_id"]; 116 | $qry2 = "SELECT med_name,med_price FROM meds where med_id=$medid"; 117 | $result2 = $conn->query($qry2); 118 | $row2=$result2->fetch_row(); 119 | 120 | echo ""; 121 | echo ""; 122 | echo ""; 123 | echo ""; 124 | echo ""; 125 | echo ""; 126 | echo ""; 129 | echo ""; 130 | } 131 | 132 | echo "
Medicine IDMedicine NameQuantityPriceTotal PriceAction
" . $row1["med_id"]. "" . $row2[0] . "" . $row1["sale_qty"]. "" . $row2[1] . "" . $row1["tot_price"]. ""; 127 | echo "Delete"; 128 | echo "
"; 133 | }} 134 | ?> 135 | 136 |
137 |
138 | Go Back to Sales Page 139 |       140 | 141 |
142 |
143 |
144 | 145 | 159 | 160 | 161 | Total 162 | ";echo $tot; 163 | echo " 164 | 165 | "; 166 | } 167 | 168 | ?> 169 | 170 | 171 | 172 | 173 | 189 | 190 | -------------------------------------------------------------------------------- /PHARMACY/purchase-update.php: -------------------------------------------------------------------------------- 1 | query($qry1); 11 | $row = $result -> fetch_row(); 12 | } 13 | 14 | if( isset($_POST['update'])) 15 | { 16 | $pid=$_POST['pid']; 17 | $sid=$_POST['sid']; 18 | $mid=$_POST['mid']; 19 | $qty = $_POST['pqty']; 20 | $cost = $_POST['pcost']; 21 | $pdate = $_POST['pdate']; 22 | $mdate = $_POST['mdate']; 23 | $edate = $_POST['edate']; 24 | 25 | $sql="UPDATE purchase SET p_cost='$cost',p_qty='$qty',pur_date='$pdate',mfg_date='$mdate',exp_date='$edate' 26 | where p_id='$pid' and sup_id='$sid' and med_id='$mid'"; 27 | if ($conn->query($sql)) 28 | header("location:purchase-view.php"); 29 | 30 | } 31 | ?> 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | Purchases 43 | 44 | 45 | 46 | 47 | 48 |
49 | 50 | query($sql))) 65 | echo "

Error! Unable to update.

"; 66 | } 67 | ?> 68 |

PHARMACIA

69 | Dashboard 70 | 73 | 77 | 80 | 84 | 87 | 91 | 94 | 98 | 101 | 105 | View Sales Invoice Details 106 | View Sold Products Details 107 | Add New Sale 108 | 111 | 116 |
117 | 118 |
119 | Logout 120 |
121 | 122 |
123 |
124 |

UPDATE PURCHASE DETAILS

125 |
126 |
127 | 128 | 129 |
130 |
131 |
132 |
133 |

134 |
135 | 136 |

137 |

138 |
139 | 140 |

141 |

142 |
143 | 144 |

145 |

146 |
147 | 148 |

149 |
150 | 151 |
152 |

153 |
154 | 155 |

156 | 157 | 158 |

159 |
160 | 161 |

162 |

163 |
164 | 165 |

166 |

167 |
168 | 169 |

170 |
171 | 172 | 173 |
174 |
175 |
176 | 177 | 195 | 196 | -------------------------------------------------------------------------------- /PHARMACY/pharm-pos1.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | New Sales 11 | 12 | 13 | 14 | 15 | 16 |
17 |

PHARMACIA

18 | Dashboard 19 | 20 | View Inventory 21 | Add New Sale 22 | 25 | 29 |
30 | 31 | query($sql); 37 | $row=$result->fetch_row(); 38 | 39 | $ename=$row[0]; 40 | ?> 41 | 42 |
43 | Logout(signed in as ) 44 |
45 | 46 |
47 |
48 |

POINT OF SALE

49 |
50 |
51 | 52 | 53 |
54 |
55 | 56 | 73 |    74 | 75 | 76 | 77 | query($qry2))) { 91 | echo "

Invalid! Enter valid Customer ID to record Sales.

"; 92 | }} 93 | 94 | 95 | ?> 96 | 97 |
98 | 114 |    115 | 116 |
117 | 118 |


119 |
120 | 121 | 122 | query($qry4); 130 | $row4 = $result4 -> fetch_row(); 131 | 132 | } 133 | ?> 134 |
135 |
136 |
137 | 138 | 139 |

140 | 141 | 142 |

143 | 144 |
145 |
146 | 147 | 148 |

149 | 150 | 151 |

152 | 153 |
154 |
155 | 156 | 157 |

158 | 159 | 160 |

161 | 162 |
163 | 164 | 165 |     166 |     167 | 168 | query($qry5); 174 | $row5=$result5->fetch_row(); 175 | $sid=$row5[0]; 176 | echo mysqli_error($conn); 177 | 178 | $mid=$_POST['medid']; 179 | $aqty=$_POST['mqty']; 180 | $qty=$_POST['mcqty']; 181 | 182 | if($qty>$aqty||$qty==0) 183 | {echo "QUANTITY INVALID!";} 184 | else { 185 | $price=$_POST['mprice']*$qty; 186 | $qry6="INSERT INTO sales_items(`sale_id`,`med_id`,`sale_qty`,`tot_price`) VALUES($sid,$mid,$qty,$price)"; 187 | $result6 = mysqli_query($conn,$qry6); 188 | echo mysqli_error($conn); 189 | 190 | echo "

"; 191 | echo "View Order"; 192 | echo "
"; 193 | } 194 | } 195 | ?> 196 | 197 |
198 |
199 | 200 | 201 | 202 | 218 | 219 | -------------------------------------------------------------------------------- /PHARMACY/salesreport.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Reports 11 | 12 | 15 | 16 | 17 | 18 | 19 |
20 |

PHARMACIA

21 | Dashboard 22 | 25 | 29 | 32 | 36 | 39 | 43 | 46 | 50 | 53 | 57 | View Sales Invoice Details 58 | View Sold Products Details 59 | Add New Sale 60 | 63 | 68 |
69 | 70 |
71 | Logout 72 |
73 | 74 |
75 |
76 |

TRANSACTION REPORTS

77 |
78 | 79 |








80 | 81 |
82 |

83 | 84 | 85 |

86 |

87 | 88 | 89 |

90 | 91 | 92 |
93 | 94 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | = '$start' AND pur_date <= '$end';"; 131 | $result = $conn->query($sql); 132 | if ($result->num_rows > 0) { 133 | 134 | while($row = $result->fetch_assoc()) { 135 | 136 | echo ""; 137 | echo ""; 138 | echo ""; 139 | echo ""; 140 | echo ""; 141 | echo ""; 142 | echo ""; 143 | 144 | echo ""; 145 | } 146 | } 147 | 148 | echo ""; 149 | echo ""; 150 | echo""; 151 | echo ""; 152 | echo "
Purchase IDSupplier IDMedicine IDQuantityDate of PurchaseCost of Purchase(in Rs)
" . $row["p_id"]. "" . $row["sup_id"]. "" . $row["med_id"]. "" . $row["p_qty"]. "" . $row["pur_date"]. "" . $row["p_cost"]. "
TotalRs.".$pamt."
"; 153 | echo ""; 154 | ?> 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | = '$start' AND s_date <= '$end';"; 169 | $result = $conn->query($sql); 170 | if ($result->num_rows > 0) { 171 | 172 | while($row = $result->fetch_assoc()) { 173 | 174 | 175 | echo ""; 176 | echo ""; 177 | echo ""; 178 | echo ""; 179 | echo ""; 180 | echo ""; 181 | 182 | echo ""; 183 | } 184 | echo ""; 185 | echo ""; 186 | echo""; 187 | echo ""; 188 | echo "
Sale IDCustomer IDEmployee IDDateSale Amount(in Rs)
" . $row["sale_id"]. "" . $row["c_id"] . "" . $row["e_id"]. "" . $row["s_date"]."" . $row["total_amt"]. "
TotalRs.".$samt."
"; 189 | } 190 | ?> 191 | 192 | 193 | 194 | 195 | 196 | 197 |
Transaction Amount Rs.
198 | 199 | 200 | 201 | 217 | 218 | 219 | -------------------------------------------------------------------------------- /PHARMACY/employee-add.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Employees 10 | 11 | 12 | 13 | 14 | 15 |
16 |

PHARMACIA

17 | Dashboard 18 | 21 | 25 | 28 | 32 | 35 | 39 | 42 | 46 | 49 | 53 | View Sales Invoice Details 54 | View Sold Products Details 55 | Add New Sale 56 | 59 | 64 |
65 | 66 |
67 | Logout 68 |
69 | 70 |
71 |
72 |

ADD EMPLOYEE DETAILS

73 |
74 |
75 | 76 | 77 |







78 | 79 | 80 |
81 | 82 | Employee successfully added!

"; 105 | } else{ 106 | echo "

Error! Check details.

"; 107 | } 108 | 109 | } 110 | 111 | $conn->close(); 112 | ?> 113 | 114 |
115 |
116 |

117 |
118 | 119 |

120 |

121 |
122 | 123 |

124 |

125 |
126 | 127 |

128 |

129 |
130 | 131 |

132 |

133 |
134 | 135 |

136 |

137 |
138 | 144 |

145 |
146 |
147 |

148 |
149 | 154 |

155 |

156 |
157 | 158 |

159 |

160 |
161 | 162 |

163 |

164 |
165 | 166 |

167 | 168 |

169 |
170 | 171 |

172 |

173 |
174 | 175 |

176 | 177 |
178 | 179 | 180 | 181 |
182 |
183 |
184 | 185 | 186 | 187 | 205 | 206 | -------------------------------------------------------------------------------- /PHARMACY/employee-update.php: -------------------------------------------------------------------------------- 1 | query($qry1); 9 | $row = $result -> fetch_row(); 10 | } 11 | 12 | ?> 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Employees 23 | 24 | 25 | 26 | 27 | 28 |
29 |

PHARMACIA

30 | Dashboard 31 | 34 | 38 | 41 | 45 | 48 | 52 | 55 | 59 | 62 | 66 | View Sales Invoice Details 67 | View Sold Products Details 68 | Add New Sale 69 | 72 | 77 |
78 | 79 |
80 | Logout 81 |
82 | 83 |
84 |
85 |

UPDATE EMPLOYEE DETAILS

86 |
87 |
88 | 89 |
90 |
91 | 92 | query($sql)) 113 | header("location:employee-view.php"); 114 | else 115 | echo "

Error! Unable to update.

"; 116 | } 117 | 118 | ?> 119 | 120 |
121 |
122 |

123 |
124 | 125 |

126 |

127 |
128 | 129 |

130 |

131 |
132 | 133 |

134 |

135 |
136 | 137 |

138 |

139 |
140 | 141 |

142 |

143 |
144 | 145 |

146 |
147 |
148 |

149 |
150 | 151 |

152 |

153 |
154 | 155 |

156 |

157 |
158 | 159 |

160 |

161 |
162 | 163 |

164 | 165 |

166 |
167 | 168 |

169 |

170 |
171 | 172 |

173 | 174 |
175 | 176 | 177 | 178 |
179 |
180 |
181 | 182 | 183 | 184 | 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pharmacy-Management-System 2 | The project aims to assist a pharmacy in managing its inventory, details of customers, employees and suppliers as well as keeping track of its 3 | purchases and sales. It is a web-based application implemented using PHP with MySQL as the Database Management System. User Interface is designed using HTML5, CSS3 and JavaScript. 4 | 5 | # Getting Started 6 | 7 | ## Installation and Setup 8 | 9 | 1. Download and Install [XAMPP](https://www.apachefriends.org/download.html) 10 | 2. Open XAMPP Control Panel and start Apache and MySQL. 11 | 3. Clone the repository to your system or download and extract the zipped folder. 12 | 4. Place the folder PHARMACY in *C:\xampp\htdocs*. 13 | 5. In web browser, open *localhost/phpmyadmin*. 14 | 6. Create a new database called 'pharmacy' in phpmyadmin. 15 | 7. Import the file 'pharmacy.sql' into the database. 16 | 17 | ## Launch 18 | 19 | 1. After successfully importing, start the project by typing the following in the web browser: *localhost/PHARMACY/mainpage.php* 20 | 2. The Login Page for Admin opens up by default. Login as Admin by using: 21 | ``` 22 | Username: admin 23 | Password: password 24 | ``` 25 | 3. For Pharmacist Login, refer to the 'emplogin' table in the database. 26 | Example: 27 | ``` 28 | Username: varshini 29 | Password: pass7 30 | ``` 31 | 32 | # About the Project 33 | 34 | ## Introduction 35 | 36 | **Pharmacia**, a **Pharmacy Management System** aims to help in maintaining and managing the records for a pharmaceutical store by improving efficiency, accuracy and security. 37 | 38 | Pharmacies need to maintain details of medicine stock, suppliers, employees, customers, any stock purchased by the pharmacy and any sales made by the pharmacy. The previous manual methods require the pharmacists to manually monitor all the records lists and transactions and to verify the presence of the each drug in the pharmacy. Searching for any required drug may be difficult. 39 | 40 | Using the Pharmacy Management System, one can maintain stock and inventory, oversee transactions, manage suppliers and employees and maintains records of its customers. 41 | The system will help prevent waste of time and resources, allow easy access to medicines, as well as ensure more security and reliability for the data compared to the manual systems. The system assists the pharmacy in handling the daily requirements in a smoother, better and effective manner. 42 | 43 | ## Objectives 44 | 45 | The main objectives/features of the system are: 46 | 47 | - Ease of use 48 | - Deals with automation of tasks 49 | - Provides fast searching capabilities 50 | - Time and resources utilization is maximized via digitalisation 51 | - Generate alerts and reports as required on sales and medicines. 52 | 53 | ## Users of the System 54 | 55 | The system is developed for use by either the **Admin** or **Pharmacists**. 56 | 57 | ### Admin Capabilities: 58 | 59 | - Access and update the list of available medicines/drugs 60 | - Access and modify drug suppliers’ data 61 | - Access and update any details of new purchases of stock for the company 62 | - Access and update all employees’ details 63 | - Access and update all customers’ details 64 | - Keep track of all sale transactions 65 | - Generate and view reports based on the data 66 | 67 | ### Screenshots 68 | 69 | #### Admin Login Page 70 | 71 | 72 | 73 | #### Admin DashBoard 74 | 75 | 76 | 77 | ### Pharmacist Capabilities: 78 | 79 | - View the inventory of medicines, their price, quantity and other details – no changes are allowed from a pharmacist point of view 80 | - View minimal details regarding existing customers 81 | - Add a new customer to their database 82 | - Make a new sale and register the sale details onto the database 83 | 84 | ### Screenshots 85 | 86 | #### Pharmacist Login Page 87 | 88 | 89 | 90 | #### Pharmacist DashBoard 91 | 92 | 93 | 94 | ***Check out other screenshots showing interface functionality here: [Screenshots](Screenshots)*** 95 | 96 | ## Database Architecture 97 | 98 | ***MEDS***: 99 | Contains details regarding the list of all medicines, mainly their type, the quantity currently present in the store and their price. 100 | 101 | ***SUPPLIERS***: 102 | Contains details regarding any of the drug suppliers who supply stock to the pharmacy. 103 | 104 | ***PURCHASE***: 105 | Contains details regarding any stock purchased by the company. Purchasing a stock consists of placing an order for multiple medicines and multiple suppliers via a single purchase on an online platform on a date as specified by purchase date (based on date of delivery). It also contains the manufacturing and expiry dates for the purchased items. 106 | 107 | ***EMPLOYEES***: 108 | Contains details regarding all employees, including Admin, Managers and Pharmacists. 109 | 110 | ***CUSTOMERS***: 111 | Contains details of all customers for ease during sales transactions. 112 | 113 | ***SALES***: 114 | Contains details regarding all sales made by the pharmacy. It keeps track of the sale invoice number, the customer ID of the customer, the employee ID of the employee who conducted the sales, the total amount of sale and the sale date and time. 115 | 116 | ***SALES_ITEMS***: 117 | Contains details regarding the particular medicines sold during each sale. It keeps track of the sale invoice number, the medicine ID, the quantity of that medicine purchased and total cost for that particular sale. 118 | 119 | ***ADMIN***: 120 | Contains the employee ID, the username and password for the Admin. Only a single record exists. Admin capabilities can be implemented only by this login. 121 | 122 | ***EMPLOGIN***: 123 | Contains the employee ID, the employee username and password for all the pharmacists and managers, apart from Admin. Pharmacist capabilities can be implemented by using any of the login details in the table. 124 | 125 | ### ER Diagram 126 | 127 | 128 | 129 | ### Relational Database Model 130 | 131 | 132 | 133 | ## Additional Information 134 | 135 | - Check the triggers, procedures and functions for further understanding. 136 | - If a new employee has been added, login details for a new employee can only be added using the database server. 137 | - Admin login details can only be changed using the database server. 138 | - For major changes, please open an *issue* first to discuss what you would like to change. 139 | 140 | *Feel free to contact for any further queries.* 141 | 142 | 143 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /PHARMACY/pos1.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | New Sales 11 | 12 | 13 | 14 | 15 | 16 |
17 |

PHARMACIA

18 | Dashboard 19 | 22 | 26 | 29 | 33 | 36 | 40 | 43 | 47 | 50 | 54 | View Sales Invoice Details 55 | View Sold Products Details 56 | Add New Sale 57 | 60 | 65 |
66 | 67 |
68 | Logout 69 |
70 | 71 |
72 |
73 |

POINT OF SALE

74 |
75 |
76 | 77 | 78 |
79 |
80 | 81 | 99 |    100 | 101 | 102 | 103 | 104 | query($qry1); 110 | $row1=$result1->fetch_row(); 111 | $eid=$row1[0]; 112 | 113 | if(isset($_GET['sid'])) 114 | { 115 | $sid=$_GET['sid']; 116 | } 117 | 118 | if(isset($_POST['cid'])) 119 | $cid=$_POST['cid']; 120 | 121 | if(isset($_POST['custadd'])) { 122 | 123 | $qry2="INSERT INTO sales(c_id,e_id) VALUES ('$cid','$eid')"; 124 | if(!($result2=$conn->query($qry2))) { 125 | echo "

Invalid! Enter valid Customer ID to record Sales.

"; 126 | } 127 | } 128 | ?> 129 | 130 |
131 | 148 |    149 | 150 |
151 | 152 |


153 |
154 | 155 | 156 | query($qry4); 163 | $row4 = $result4 -> fetch_row(); 164 | 165 | } 166 | ?> 167 | 168 |
169 |
170 |
171 | 172 | 173 |

174 | 175 | 176 |

177 | 178 |
179 |
180 | 181 | 182 |

183 | 184 | 185 |

186 | 187 |
188 |
189 | 190 | 191 |

192 | 193 | 194 |

195 | 196 |
197 | 198 | 199 |     200 |     201 | 202 | query($qry5); 208 | $row5=$result5->fetch_row(); 209 | $sid=$row5[0]; 210 | echo mysqli_error($conn); 211 | 212 | $mid=$_POST['medid']; 213 | $aqty=$_POST['mqty']; 214 | $qty=$_POST['mcqty']; 215 | 216 | if($qty>$aqty||$qty==0) 217 | {echo "QUANTITY INVALID!";} 218 | else { 219 | $price=$_POST['mprice']*$qty; 220 | $qry6="INSERT INTO sales_items(`sale_id`,`med_id`,`sale_qty`,`tot_price`) VALUES($sid,$mid,$qty,$price)"; 221 | $result6 = mysqli_query($conn,$qry6); 222 | echo mysqli_error($conn); 223 | 224 | echo "

"; 225 | echo "View Order"; 226 | echo "
"; 227 | } 228 | } 229 | ?> 230 | 231 | 232 |
233 |
234 | 235 | 236 | 252 | 253 | -------------------------------------------------------------------------------- /pharmacy.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 5.0.1 3 | -- https://www.phpmyadmin.net/ 4 | -- 5 | -- Host: 127.0.0.1 6 | -- Generation Time: Dec 04, 2020 at 06:39 PM 7 | -- Server version: 10.4.11-MariaDB 8 | -- PHP Version: 7.2.28 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: `pharmacy` 23 | -- 24 | 25 | DELIMITER $$ 26 | -- 27 | -- Procedures 28 | -- 29 | CREATE DEFINER=`root`@`localhost` PROCEDURE `EXPIRY` () NO SQL 30 | BEGIN 31 | SELECT p_id,sup_id,med_id,p_qty,p_cost,pur_date,mfg_date,exp_date FROM purchase where exp_date between CURDATE() and DATE_SUB(CURDATE(), INTERVAL -6 MONTH); 32 | END$$ 33 | 34 | CREATE DEFINER=`root`@`localhost` PROCEDURE `SEARCH_INVENTORY` (IN `search` VARCHAR(255)) NO SQL 35 | BEGIN 36 | DECLARE mid DECIMAL(6); 37 | DECLARE mname VARCHAR(50); 38 | DECLARE mqty INT; 39 | DECLARE mcategory VARCHAR(20); 40 | DECLARE mprice DECIMAL(6,2); 41 | DECLARE location VARCHAR(30); 42 | DECLARE exit_loop BOOLEAN DEFAULT FALSE; 43 | DECLARE MED_CURSOR CURSOR FOR SELECT MED_ID,MED_NAME,MED_QTY,CATEGORY,MED_PRICE,LOCATION_RACK FROM MEDS; 44 | DECLARE CONTINUE HANDLER FOR NOT FOUND SET exit_loop=TRUE; 45 | CREATE TEMPORARY TABLE IF NOT EXISTS T1 (medid decimal(6),medname varchar(50),medqty int,medcategory varchar(20),medprice decimal(6,2),medlocation varchar(30)); 46 | OPEN MED_CURSOR; 47 | med_loop: LOOP 48 | FETCH FROM MED_CURSOR INTO mid,mname,mqty,mcategory,mprice,location; 49 | IF exit_loop THEN 50 | LEAVE med_loop; 51 | END IF; 52 | 53 | IF(CONCAT(mid,mname,mcategory,location) LIKE CONCAT('%',search,'%')) THEN 54 | INSERT INTO T1(medid,medname,medqty,medcategory,medprice,medlocation) 55 | VALUES(mid,mname,mqty,mcategory,mprice,location); 56 | END IF; 57 | END LOOP med_loop; 58 | CLOSE MED_CURSOR; 59 | SELECT medid,medname,medqty,medcategory,medprice,medlocation FROM T1; 60 | END$$ 61 | 62 | CREATE DEFINER=`root`@`localhost` PROCEDURE `STOCK` () NO SQL 63 | BEGIN 64 | SELECT med_id, med_name,med_qty,category,med_price,location_rack FROM meds where med_qty<=50; 65 | END$$ 66 | 67 | CREATE DEFINER=`root`@`localhost` PROCEDURE `TOTAL_AMT` (IN `ID` INT, OUT `AMT` DECIMAL(8,2)) NO SQL 68 | BEGIN 69 | UPDATE SALES SET S_DATE=SYSDATE(),S_TIME=CURRENT_TIMESTAMP(),TOTAL_AMT=(SELECT SUM(TOT_PRICE) FROM SALES_ITEMS WHERE SALES_ITEMS.SALE_ID=ID) WHERE SALES.SALE_ID=ID; 70 | SELECT TOTAL_AMT INTO AMT FROM SALES WHERE SALE_ID=ID; 71 | END$$ 72 | 73 | -- 74 | -- Functions 75 | -- 76 | CREATE DEFINER=`root`@`localhost` FUNCTION `P_AMT` (`start` DATE, `end` DATE) RETURNS DECIMAL(8,2) NO SQL 77 | DETERMINISTIC 78 | BEGIN 79 | DECLARE PAMT DECIMAL(8,2) DEFAULT 0.0; 80 | SELECT SUM(P_COST) INTO PAMT FROM PURCHASE WHERE PUR_DATE >= start AND PUR_DATE<= end; 81 | RETURN PAMT; 82 | END$$ 83 | 84 | CREATE DEFINER=`root`@`localhost` FUNCTION `S_AMT` (`start` DATE, `end` DATE) RETURNS DECIMAL(8,2) NO SQL 85 | BEGIN 86 | DECLARE SAMT DECIMAL(8,2) DEFAULT 0.0; 87 | SELECT SUM(TOTAL_AMT) INTO SAMT FROM SALES WHERE S_DATE >= start AND S_DATE<= end; 88 | RETURN SAMT; 89 | END$$ 90 | 91 | DELIMITER ; 92 | 93 | -- -------------------------------------------------------- 94 | 95 | -- 96 | -- Table structure for table `admin` 97 | -- 98 | 99 | CREATE TABLE `admin` ( 100 | `ID` decimal(7,0) NOT NULL, 101 | `A_USERNAME` varchar(50) NOT NULL, 102 | `A_PASSWORD` varchar(50) NOT NULL 103 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 104 | 105 | -- 106 | -- Dumping data for table `admin` 107 | -- 108 | 109 | INSERT INTO `admin` (`ID`, `A_USERNAME`, `A_PASSWORD`) VALUES 110 | ('1', 'admin', 'password'); 111 | 112 | -- -------------------------------------------------------- 113 | 114 | -- 115 | -- Table structure for table `customer` 116 | -- 117 | 118 | CREATE TABLE `customer` ( 119 | `C_ID` decimal(6,0) NOT NULL, 120 | `C_FNAME` varchar(30) NOT NULL, 121 | `C_LNAME` varchar(30) DEFAULT NULL, 122 | `C_AGE` int(11) NOT NULL, 123 | `C_SEX` varchar(6) NOT NULL, 124 | `C_PHNO` decimal(10,0) NOT NULL, 125 | `C_MAIL` varchar(40) DEFAULT NULL 126 | ) ; 127 | 128 | -- 129 | -- Dumping data for table `customer` 130 | -- 131 | 132 | INSERT INTO `customer` (`C_ID`, `C_FNAME`, `C_LNAME`, `C_AGE`, `C_SEX`, `C_PHNO`, `C_MAIL`) VALUES 133 | ('987101', 'Safia', 'Malik', 22, 'Female', '9632587415', 'safia@gmail.com'), 134 | ('987102', 'Varun', 'Ilango', 24, 'Male', '9987565423', 'varun@gmail.com'), 135 | ('987103', 'Suja', 'Suresh', 45, 'Female', '7896541236', 'suja@hotmail.com'), 136 | ('987104', 'Agatha', 'Elizabeth', 30, 'Female', '7845129635', 'agatha@gmail.com'), 137 | ('987105', 'Zayed', 'Shah', 40, 'Male', '6789541235', 'zshah@hotmail.com'), 138 | ('987106', 'Vijay', 'Kumar', 60, 'Male', '8996574123', 'vijayk@yahoo.com'), 139 | ('987107', 'Meera', 'Das', 35, 'Female', '7845963259', 'meera@gmail.com'); 140 | 141 | -- -------------------------------------------------------- 142 | 143 | -- 144 | -- Table structure for table `emplogin` 145 | -- 146 | 147 | CREATE TABLE `emplogin` ( 148 | `E_ID` decimal(7,0) NOT NULL, 149 | `E_USERNAME` varchar(20) NOT NULL, 150 | `E_PASS` varchar(30) NOT NULL 151 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 152 | 153 | -- 154 | -- Dumping data for table `emplogin` 155 | -- 156 | 157 | INSERT INTO `emplogin` (`E_ID`, `E_USERNAME`, `E_PASS`) VALUES 158 | ('4567005', 'amaya', 'pass1'), 159 | ('4567002', 'anita', 'pass2'), 160 | ('4567010', 'daniel', 'pass3'), 161 | ('4567003', 'harish', 'pass4'), 162 | ('4567009', 'shayla', 'pass5'), 163 | ('4567006', 'shoaib', 'pass6'), 164 | ('4567001', 'varshini', 'pass7'); 165 | 166 | -- -------------------------------------------------------- 167 | 168 | -- 169 | -- Table structure for table `employee` 170 | -- 171 | 172 | CREATE TABLE `employee` ( 173 | `E_ID` decimal(7,0) NOT NULL, 174 | `E_FNAME` varchar(30) NOT NULL, 175 | `E_LNAME` varchar(30) DEFAULT NULL, 176 | `BDATE` date NOT NULL, 177 | `E_AGE` int(11) NOT NULL, 178 | `E_SEX` varchar(6) NOT NULL, 179 | `E_TYPE` varchar(20) NOT NULL, 180 | `E_JDATE` date NOT NULL, 181 | `E_SAL` decimal(8,2) NOT NULL, 182 | `E_PHNO` decimal(10,0) NOT NULL, 183 | `E_MAIL` varchar(40) DEFAULT NULL, 184 | `E_ADD` varchar(40) DEFAULT NULL 185 | ) ; 186 | 187 | -- 188 | -- Dumping data for table `employee` 189 | -- 190 | 191 | INSERT INTO `employee` (`E_ID`, `E_FNAME`, `E_LNAME`, `BDATE`, `E_AGE`, `E_SEX`, `E_TYPE`, `E_JDATE`, `E_SAL`, `E_PHNO`, `E_MAIL`, `E_ADD`) VALUES 192 | ('1', 'Admin', '-', '1989-05-24', 30, 'Female', 'Admin', '2009-06-24', '95000.00', '9874563219', 'admin@pharmacia.com', 'Chennai'), 193 | ('4567001', 'Varshini', 'Elangovan', '1995-10-05', 25, 'Female', 'Pharmacist', '2017-11-12', '25000.00', '9967845123', 'evarsh@hotmail.com', 'Thiruvanmiyur'), 194 | ('4567002', 'Anita', 'Shree', '2000-10-03', 20, 'Female', 'Pharmacist', '2012-10-06', '45000.00', '8546123566', 'anita@gmail.com', 'Adyar'), 195 | ('4567003', 'Harish', 'Raja', '1998-02-01', 22, 'Male', 'Pharmacist', '2019-07-06', '21000.00', '7854123694', 'harishraja@live.com', 'T.Nagar'), 196 | ('4567005', 'Amaya', 'Singh', '1992-01-02', 28, 'Female', 'Pharmacist', '2017-05-16', '32000.00', '7894532165', 'amaya@gmail.com', 'Kottivakkam'), 197 | ('4567006', 'Shoaib', 'Ahmed', '1999-12-11', 20, 'Male', 'Pharmacist', '2018-09-05', '28000.00', '7896541234', 'shoaib@hotmail.com', 'Porur'), 198 | ('4567009', 'Shayla', 'Hussain', '1980-02-28', 40, 'Female', 'Manager', '2010-05-06', '80000.00', '7854123695', 'shaylah@gmail.com', 'Adyar'), 199 | ('4567010', 'Daniel', 'James', '1993-04-05', 27, 'Male', 'Pharmacist', '2016-01-05', '30000.00', '7896541235', 'daniels@gmail.com', 'Kodambakkam'); 200 | 201 | -- -------------------------------------------------------- 202 | 203 | -- 204 | -- Table structure for table `meds` 205 | -- 206 | 207 | CREATE TABLE `meds` ( 208 | `MED_ID` decimal(6,0) NOT NULL, 209 | `MED_NAME` varchar(50) NOT NULL, 210 | `MED_QTY` int(11) NOT NULL, 211 | `CATEGORY` varchar(20) DEFAULT NULL, 212 | `MED_PRICE` decimal(6,2) NOT NULL, 213 | `LOCATION_RACK` varchar(30) DEFAULT NULL 214 | ) ; 215 | 216 | -- 217 | -- Dumping data for table `meds` 218 | -- 219 | 220 | INSERT INTO `meds` (`MED_ID`, `MED_NAME`, `MED_QTY`, `CATEGORY`, `MED_PRICE`, `LOCATION_RACK`) VALUES 221 | ('123001', 'Dolo 650 MG', 625, 'Tablet', '1.00', 'rack 5'), 222 | ('123002', 'Panadol Cold & Flu', 90, 'Tablet', '2.50', 'rack 6'), 223 | ('123003', 'Livogen', 25, 'Capsule', '5.00', 'rack 3'), 224 | ('123004', 'Gelusil', 440, 'Tablet', '1.25', 'rack 4'), 225 | ('123005', 'Cyclopam', 120, 'Tablet', '6.00', 'rack 2'), 226 | ('123006', 'Benadryl 200 ML', 35, 'Syrup', '50.00', 'rack 10'), 227 | ('123007', 'Lopamide', 15, 'Capsule', '5.00', 'rack 7'), 228 | ('123008', 'Vitamic C', 90, 'Tablet', '3.00', 'rack 8'), 229 | ('123009', 'Omeprazole', 35, 'Capsule', '4.00', 'rack 3'), 230 | ('123010', 'Concur 5 MG', 600, 'Tablet', '3.50', 'rack 9'), 231 | ('123011', 'Augmentin 250 ML', 115, 'Syrup', '80.00', 'rack 7'); 232 | 233 | -- -------------------------------------------------------- 234 | 235 | -- 236 | -- Table structure for table `purchase` 237 | -- 238 | 239 | CREATE TABLE `purchase` ( 240 | `P_ID` decimal(4,0) NOT NULL, 241 | `SUP_ID` decimal(3,0) NOT NULL, 242 | `MED_ID` decimal(6,0) NOT NULL, 243 | `P_QTY` int(11) NOT NULL, 244 | `P_COST` decimal(8,2) NOT NULL, 245 | `PUR_DATE` date NOT NULL, 246 | `MFG_DATE` date NOT NULL, 247 | `EXP_DATE` date NOT NULL 248 | ) ; 249 | 250 | -- 251 | -- Dumping data for table `purchase` 252 | -- 253 | 254 | INSERT INTO `purchase` (`P_ID`, `SUP_ID`, `MED_ID`, `P_QTY`, `P_COST`, `PUR_DATE`, `MFG_DATE`, `EXP_DATE`) VALUES 255 | ('1001', '136', '123010', 200, '1500.50', '2020-03-01', '2019-05-05', '2021-05-10'), 256 | ('1002', '123', '123002', 1000, '3000.00', '2020-02-01', '2018-06-01', '2020-12-05'), 257 | ('1003', '145', '123006', 20, '800.00', '2020-04-22', '2017-02-05', '2020-07-01'), 258 | ('1004', '156', '123004', 250, '1000.00', '2020-04-02', '2020-05-06', '2023-05-06'), 259 | ('1005', '123', '123005', 200, '1200.00', '2020-02-01', '2019-08-02', '2021-04-01'), 260 | ('1006', '162', '123010', 500, '1500.00', '2019-04-22', '2018-01-01', '2020-05-02'), 261 | ('1007', '123', '123001', 500, '450.00', '2020-01-02', '2019-01-05', '2022-03-06'); 262 | 263 | -- 264 | -- Triggers `purchase` 265 | -- 266 | DELIMITER $$ 267 | CREATE TRIGGER `QTYDELETE` AFTER DELETE ON `purchase` FOR EACH ROW BEGIN 268 | UPDATE meds SET MED_QTY=MED_QTY-old.P_QTY WHERE meds.MED_ID=old.MED_ID; 269 | END 270 | $$ 271 | DELIMITER ; 272 | DELIMITER $$ 273 | CREATE TRIGGER `QTYINSERT` AFTER INSERT ON `purchase` FOR EACH ROW BEGIN 274 | UPDATE meds SET MED_QTY=MED_QTY+new.P_QTY WHERE meds.MED_ID=new.MED_ID; 275 | END 276 | $$ 277 | DELIMITER ; 278 | DELIMITER $$ 279 | CREATE TRIGGER `QTYUPDATE` AFTER UPDATE ON `purchase` FOR EACH ROW BEGIN 280 | UPDATE meds SET MED_QTY=MED_QTY-old.P_QTY WHERE meds.MED_ID=new.MED_ID; 281 | UPDATE meds SET MED_QTY=MED_QTY+new.P_QTY WHERE meds.MED_ID=new.MED_ID; 282 | END 283 | $$ 284 | DELIMITER ; 285 | 286 | -- -------------------------------------------------------- 287 | 288 | -- 289 | -- Table structure for table `sales` 290 | -- 291 | 292 | CREATE TABLE `sales` ( 293 | `SALE_ID` int(11) NOT NULL, 294 | `C_ID` decimal(6,0) NOT NULL, 295 | `S_DATE` date DEFAULT NULL, 296 | `S_TIME` time DEFAULT NULL, 297 | `TOTAL_AMT` decimal(8,2) DEFAULT NULL, 298 | `E_ID` decimal(7,0) NOT NULL 299 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 300 | 301 | -- 302 | -- Dumping data for table `sales` 303 | -- 304 | 305 | INSERT INTO `sales` (`SALE_ID`, `C_ID`, `S_DATE`, `S_TIME`, `TOTAL_AMT`, `E_ID`) VALUES 306 | (1, '987101', '2020-04-15', '13:23:03', '180.00', '4567009'), 307 | (2, '987106', '2020-04-21', '20:19:31', '585.00', '1'), 308 | (3, '987103', '2020-04-15', '11:23:53', '120.00', '4567010'), 309 | (4, '987104', '2020-04-14', '18:20:00', '955.00', '4567006'), 310 | (5, '987103', '2020-04-21', '15:24:43', '45.00', '1'), 311 | (6, '987102', '2020-03-11', '10:24:43', '140.00', '4567001'), 312 | (7, '987105', '2020-04-24', '00:25:54', '350.00', '1'), 313 | (8, '987104', '2020-04-24', '00:47:47', '35.00', '4567001'), 314 | (12, '987103', '2020-04-24', '19:33:16', '60.00', '1'), 315 | (13, '987104', '2020-04-24', '21:15:56', '62.50', '4567001'), 316 | (15, '987107', '2020-12-04', '18:39:46', '420.00', '1'), 317 | (16, '987106', '2020-12-04', '18:52:21', '30.00', '1'), 318 | (17, '987103', '2020-12-04', '19:35:56', '57.50', '1'), 319 | (18, '987105', '2020-12-04', '19:36:56', '160.00', '4567001'), 320 | (20, '987103', '2020-12-04', '22:53:18', '150.00', '4567001'); 321 | 322 | -- 323 | -- Triggers `sales` 324 | -- 325 | DELIMITER $$ 326 | CREATE TRIGGER `SALE_ID_DELETE` BEFORE DELETE ON `sales` FOR EACH ROW BEGIN 327 | DELETE from sales_items WHERE sales_items.SALE_ID=old.SALE_ID; 328 | END 329 | $$ 330 | DELIMITER ; 331 | 332 | -- -------------------------------------------------------- 333 | 334 | -- 335 | -- Table structure for table `sales_items` 336 | -- 337 | 338 | CREATE TABLE `sales_items` ( 339 | `SALE_ID` int(11) NOT NULL, 340 | `MED_ID` decimal(6,0) NOT NULL, 341 | `SALE_QTY` int(11) NOT NULL, 342 | `TOT_PRICE` decimal(8,2) NOT NULL 343 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 344 | 345 | -- 346 | -- Dumping data for table `sales_items` 347 | -- 348 | 349 | INSERT INTO `sales_items` (`SALE_ID`, `MED_ID`, `SALE_QTY`, `TOT_PRICE`) VALUES 350 | (1, '123001', 20, '20.00'), 351 | (1, '123011', 2, '160.00'), 352 | (2, '123003', 75, '225.00'), 353 | (2, '123005', 60, '360.00'), 354 | (3, '123008', 40, '120.00'), 355 | (4, '123010', 250, '875.00'), 356 | (4, '123011', 1, '80.00'), 357 | (5, '123001', 45, '45.00'), 358 | (6, '123006', 2, '100.00'), 359 | (6, '123009', 10, '40.00'), 360 | (7, '123001', 100, '100.00'), 361 | (7, '123003', 50, '250.00'), 362 | (8, '123001', 10, '10.00'), 363 | (8, '123002', 10, '25.00'), 364 | (12, '123005', 10, '60.00'), 365 | (13, '123002', 25, '62.50'), 366 | (15, '123005', 45, '270.00'), 367 | (15, '123006', 3, '150.00'), 368 | (16, '123008', 10, '30.00'), 369 | (17, '123004', 10, '12.50'), 370 | (17, '123007', 5, '25.00'), 371 | (17, '123009', 5, '20.00'), 372 | (18, '123011', 2, '160.00'), 373 | (20, '123005', 25, '150.00'); 374 | 375 | -- 376 | -- Triggers `sales_items` 377 | -- 378 | DELIMITER $$ 379 | CREATE TRIGGER `SALEDELETE` AFTER DELETE ON `sales_items` FOR EACH ROW BEGIN 380 | UPDATE meds SET MED_QTY=MED_QTY+old.SALE_QTY WHERE meds.MED_ID=old.MED_ID; 381 | END 382 | $$ 383 | DELIMITER ; 384 | DELIMITER $$ 385 | CREATE TRIGGER `SALEINSERT` AFTER INSERT ON `sales_items` FOR EACH ROW BEGIN 386 | UPDATE meds SET MED_QTY=MED_QTY-new.SALE_QTY WHERE meds.MED_ID=new.MED_ID; 387 | END 388 | $$ 389 | DELIMITER ; 390 | 391 | -- -------------------------------------------------------- 392 | 393 | -- 394 | -- Table structure for table `suppliers` 395 | -- 396 | 397 | CREATE TABLE `suppliers` ( 398 | `SUP_ID` decimal(3,0) NOT NULL, 399 | `SUP_NAME` varchar(25) NOT NULL, 400 | `SUP_ADD` varchar(30) NOT NULL, 401 | `SUP_PHNO` decimal(10,0) NOT NULL, 402 | `SUP_MAIL` varchar(40) NOT NULL 403 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; 404 | 405 | -- 406 | -- Dumping data for table `suppliers` 407 | -- 408 | 409 | INSERT INTO `suppliers` (`SUP_ID`, `SUP_NAME`, `SUP_ADD`, `SUP_PHNO`, `SUP_MAIL`) VALUES 410 | ('123', 'XYZ Pharmaceuticals', 'Chennai, Tamil Nadu', '8745632145', 'xyz@xyzpharma.com'), 411 | ('136', 'ABC PharmaSupply', 'Trichy', '7894561235', 'abc@pharmsupp.com'), 412 | ('145', 'Daily Pharma Ltd', 'Hyderabad', '7854699321', 'daily@dpharma.com'), 413 | ('156', 'MedAll', 'Chennai', '9874585236', 'mainid@medall.com'), 414 | ('162', 'MedHead Pharmaceuticals', 'Trichy', '7894561335', 'abc@pharmsupp.com'); 415 | 416 | -- 417 | -- Indexes for dumped tables 418 | -- 419 | 420 | -- 421 | -- Indexes for table `admin` 422 | -- 423 | ALTER TABLE `admin` 424 | ADD PRIMARY KEY (`A_USERNAME`), 425 | ADD UNIQUE KEY `USERNAME` (`A_USERNAME`), 426 | ADD KEY `ID` (`ID`); 427 | 428 | -- 429 | -- Indexes for table `customer` 430 | -- 431 | ALTER TABLE `customer` 432 | ADD PRIMARY KEY (`C_ID`), 433 | ADD UNIQUE KEY `C_PHNO` (`C_PHNO`), 434 | ADD UNIQUE KEY `C_MAIL` (`C_MAIL`); 435 | 436 | -- 437 | -- Indexes for table `emplogin` 438 | -- 439 | ALTER TABLE `emplogin` 440 | ADD PRIMARY KEY (`E_USERNAME`), 441 | ADD KEY `E_ID` (`E_ID`); 442 | 443 | -- 444 | -- Indexes for table `employee` 445 | -- 446 | ALTER TABLE `employee` 447 | ADD PRIMARY KEY (`E_ID`); 448 | 449 | -- 450 | -- Indexes for table `meds` 451 | -- 452 | ALTER TABLE `meds` 453 | ADD PRIMARY KEY (`MED_ID`); 454 | 455 | -- 456 | -- Indexes for table `purchase` 457 | -- 458 | ALTER TABLE `purchase` 459 | ADD PRIMARY KEY (`P_ID`,`MED_ID`), 460 | ADD KEY `SUP_ID` (`SUP_ID`), 461 | ADD KEY `MED_ID` (`MED_ID`); 462 | 463 | -- 464 | -- Indexes for table `sales` 465 | -- 466 | ALTER TABLE `sales` 467 | ADD PRIMARY KEY (`SALE_ID`), 468 | ADD KEY `C_ID` (`C_ID`), 469 | ADD KEY `E_ID` (`E_ID`); 470 | 471 | -- 472 | -- Indexes for table `sales_items` 473 | -- 474 | ALTER TABLE `sales_items` 475 | ADD PRIMARY KEY (`SALE_ID`,`MED_ID`), 476 | ADD KEY `MED_ID` (`MED_ID`); 477 | 478 | -- 479 | -- Indexes for table `suppliers` 480 | -- 481 | ALTER TABLE `suppliers` 482 | ADD PRIMARY KEY (`SUP_ID`); 483 | 484 | -- 485 | -- AUTO_INCREMENT for dumped tables 486 | -- 487 | 488 | -- 489 | -- AUTO_INCREMENT for table `sales` 490 | -- 491 | ALTER TABLE `sales` 492 | MODIFY `SALE_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21; 493 | 494 | -- 495 | -- Constraints for dumped tables 496 | -- 497 | 498 | -- 499 | -- Constraints for table `admin` 500 | -- 501 | ALTER TABLE `admin` 502 | ADD CONSTRAINT `admin_ibfk_1` FOREIGN KEY (`ID`) REFERENCES `employee` (`E_ID`); 503 | 504 | -- 505 | -- Constraints for table `emplogin` 506 | -- 507 | ALTER TABLE `emplogin` 508 | ADD CONSTRAINT `emplogin_ibfk_1` FOREIGN KEY (`E_ID`) REFERENCES `employee` (`E_ID`); 509 | 510 | -- 511 | -- Constraints for table `purchase` 512 | -- 513 | ALTER TABLE `purchase` 514 | ADD CONSTRAINT `purchase_ibfk_1` FOREIGN KEY (`SUP_ID`) REFERENCES `suppliers` (`SUP_ID`), 515 | ADD CONSTRAINT `purchase_ibfk_2` FOREIGN KEY (`MED_ID`) REFERENCES `meds` (`MED_ID`); 516 | 517 | -- 518 | -- Constraints for table `sales` 519 | -- 520 | ALTER TABLE `sales` 521 | ADD CONSTRAINT `sales_ibfk_1` FOREIGN KEY (`C_ID`) REFERENCES `customer` (`C_ID`), 522 | ADD CONSTRAINT `sales_ibfk_2` FOREIGN KEY (`E_ID`) REFERENCES `employee` (`E_ID`); 523 | 524 | -- 525 | -- Constraints for table `sales_items` 526 | -- 527 | ALTER TABLE `sales_items` 528 | ADD CONSTRAINT `sales_items_ibfk_1` FOREIGN KEY (`SALE_ID`) REFERENCES `sales` (`SALE_ID`), 529 | ADD CONSTRAINT `sales_items_ibfk_2` FOREIGN KEY (`MED_ID`) REFERENCES `meds` (`MED_ID`); 530 | COMMIT; 531 | 532 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 533 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 534 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 535 | --------------------------------------------------------------------------------