ABU Dhabi Indian: School
ABU Dhabi Indian: School
BRANCH-1, AL WATHBA
COMPUTER SCIENCE
PROJECT
(2024- 2025)
SUBMITTED BY:
EXAM NO:
ABU DHABI INDIAN SCHOOL,
BRANCH-1, AL WATHBA
CERTIFICATE
Date of Examination:
Internal Examiner :
External Examiner:
Acknowledgement
I would like to take this opportunity to express my heartfelt gratitude to all those who have
supported me in completing this project.
I am also deeply grateful to my parents for their unwavering support, understanding, and
encouragement. Your love and belief in my abilities gave me the strength to persevere and
complete this task to the best of my abilities. Thank you for always being there to lend a helping
hand and for providing the resources I needed.
I am lastly thankful to God for giving me the strength, wisdom, and perseverance that have
enabled me to carry out this project.
Sincerely,
Jomy Prince
INDEX
SI NO CONTENT PAGE NO
4 Source code
5 Output
6 Conclution
7 Bibliography
Overview
Add Medicine:
The system allows the addition of new medicines to the inventory. This includes
specifying details such as the medicine name, category, price, stock quantity, and
expiry date.
The data is stored in a relational database for easy retrieval and updates.
Delete Medicine:
Medicine can be removed from the system if it is no longer in stock or if it needs
to be discontinued.
1
A deletion operation serves to update the database by removing the record of the
medicine from the inventory.
It can also show relevant details like: name, stock quantity, price, and Expiration
Date.
6
Software And Hardware used
1. Python
Python is a programming language that is widely used in web applications,
software development, data science, and machine learning (ML). Developers use
Python because it is efficient and easy to learn and can run on many different
platforms. Python software is free to download, integrates well with all types of
systems, and increases development speed.
2. MYSQL
MySQL is a relational database management system (RDBMS) developed by
Oracle that is based on structured query language (SQL).
7
For my project (medical shop management) I have used SQL and Python to
develop an easy and efficient medicine management program where all records
with regard to medication and inventory can be stored managed with ease. SQL
gave a base for storing and maintaining information about the stock of each
medicine, its name, quantity, dosage, date of expiry, and supplier details. This is
combined with Python into the SQL database that can allow several functions to
be done on the data ,providing current stock of medicines, addition of new
medicines, and dispensing in real time.I have also used MYSQL connector in
Python to effectively connect thepython interface and MYSQL so that I can carry
out fuction in mysql trhough python in a easier manner.
8
Package/Module/Functions used in the project
Random module :
The Python Random module is a built-in module for generating random integers
in Python. These numbers occur randomly and does not follow any rules or
instructuctions. We can therefore use this module to generate random numbers,
display a random item for a list or string, and so on.
1) random() Function:
The random.random() function gives a float number that ranges from 0.0 to 1.0.
2) randint() Function :
The random.randint() function generates a random integer from the range of
numbers supplied.
3) randrange() Function
The random.randrange() function selects an item randomly from the given range
defined by the start, the stop, and the step parameters. By default, the start is set
to 0. Likewise, the step is set to 1 by default.
Time module :
As the name suggests Python time module allows to work with time in Python. It
allows functionality like getting the current time, pausing the Program from
executing, etc.
1) time.sleep() Function :
It is a function in the time module that pauses the execution of the program
for the specified number of seconds. The argument can be a floating point
number to indicate more precise sleep times (like fractions of a second). This
function is useful for delaying actions or simulating delays in your programs.
9
Source code
Part 1
conn=mysql.connect(host="localhost",user="root",password="1234")
if conn.is_connected():
print("sucessfully connect")
cur=conn.cursor()
cur.execute(query1)
cur.execute(query0)
query01=("use medicine_shop")
cur.execute(query01)
query1 = ("""
10
medid int(25) PRIMARY KEY NOT NULL,
name VARCHAR(25),
manfname VARCHAR(25),
dateofman DATE,
dateofex DATE,
mg VARCHAR(25),
content VARCHAR(25),
price int(25),
qty int(25)
""")
cur.execute(query1)
query2 = ("""
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)
""")
cur.execute(query2, values)
11
val1=(2, "Adderall", "sinofarm", "2024-11-02", "2025-01-12", 10, "phosphate" ,21,
50)
cur.execute(query2 ,val1)
cur.execute(query2,val2)
print("table created")
conn.commit()
query3=(
cname VARCHAR(100),
medicine VARCHAR(10000),
amount int(25),
bdate date
)""")
12
cur.execute(query3)
13
Part 2
############### MEDICINE MANAGMENT PROGRAM####################
conn=mysql.connect(host="localhost",user="root",password="1234",db="medicin
e_shop")
if conn.is_connected():
print("sucessfully connect")
cur=conn.cursor()
import time
import random as rd
def addmed():
print(" ")
print("*" * 15)
print(" ")
14
name = input("Enter Medicine Name : ")
time.sleep(2)
data = (mid, name, mf, dom, doe, mg, content, price, qty)
cur=conn.cursor()
cur.execute(q, data)
print("Medicine Inserted")
print("#" * 15)
print("\n")
conn.commit()
time.sleep(2)
15
def showmed():
cur.execute(q)
res = cur.fetchall()
print("*" * 15)
print("\n")
print("-" * 95)
print("Id\tName\t\tDate_of_Expiry\t\tPrice\t\tQty")
print("-" * 95)
medid = row[0]
name = row[1]
date_of_expiry = row[4]
price = row[-2]
qty = row[-1]
print("-" * 95)
print("\n")
16
time.sleep(2)
def restock():
cur = conn.cursor()
cur.execute(query, data)
conn.commit()
print("restocking.... ")
time.sleep(2)
time.sleep(2)
def search():
17
q = "select * from medicine where medid = " + mid
cur = conn.cursor()
cur.execute(q)
k = cur.fetchone()
if k == None:
print("---" * 15)
else:
print("Medicine Found")
print("*" * 15)
print("\n")
print("-" * 95)
print("Id\tName\t\tDate_of_Expiry\t\tPrice\t\tQty")
print("-" * 95)
print("-" * 95)
print()
time.sleep(2)
def seebill():
18
bno= input("Enter the Bill no : ")
cur = conn.cursor()
cur.execute(q)
k = cur.fetchone()
if k == None:
else:
print("*" * 15)
print("\n")
print("-" * 95)
print("Bill No\t\t\tName\t\t\t\tmedicine\t\t\tAmount")
print("-" * 95)
print("-" * 95)
print()
time.sleep(2)
19
def billing():
amount = 0
medicine = ""
cur = conn.cursor()
while True:
cur.execute(q)
res = cur.fetchone()
if res is None:
else:
price = int(res[-2])
20
qty = int(input("Enter the Quantity to be Purchased: "))
amount += bill
if ans.lower() == "no":
time.sleep(2)
break
cur.execute(q, data)
conn.commit()
time.sleep(2)
time.sleep(2)
21
def showbills():
cur = conn.cursor()
cur.execute(q)
res = cur.fetchall()
print("/n")
print("-" * 95)
print("BillNo\tName\t\tMedicine\t\t\tAmount\t\tDateofBill")
print("-" * 95)
for k in res:
print("-" * 95)
print("\n")
time.sleep(2)
def deletem():
22
cur = conn.cursor()
cur.execute(q)
print("Deleting medicine.")
time.sleep(2)
print("Medicine Deleted")
print("\n\n")
conn.commit()
time.sleep(2)
a = rd.randint(1, 9)
b = rd.randint(1, 9)
c = rd.randint(1, 9)
d = rd.randint(1, 9)
e = rd.randint(1, 9)
print("\t\t", num)
if str(n) == num:
23
print("Loading.... ")
time.sleep(2)
print("\n")
print("\n")
time.sleep(2)
while True:
print("\n")
24
print("Press 6 - Billing")
print("press 9 - to Exit")
print("\n")
if opt == 1:
addmed()
elif opt == 2:
restock()
elif opt == 3:
showmed()
elif opt == 4:
search()
elif opt == 5:
deletem()
elif opt == 6:
billing()
elif opt == 7:
showbills()
elif opt == 8:
25
seebill()
elif opt == 9:
print("*" * 95)
break
else:
break
else:
26
Output
Part 1
sucessfully connect
table created
Table created
27
Part 2
sucessfully connect
79711
Loading....
28
The Medical Store
Press 6 - Billing
press 9 - to Exit
***************
29
Enter Medicine Id : 40
###############
30
The Medical Store
Press 6 - Billing
press 9 - to Exit
restocking....
31
The Medical Store
Press 6 - Billing
press 9 - to Exit
***************
32
Id Name Date_of_Expiry Price Qty
2 Adderall 2025-01-12 21 50
33
The Medical Store
Press 6 - Billing
press 9 - to Exit
Medicine Found
***************
34
Id Name Date_of_Expiry Price Qty
35
The Medical Store
Press 6 - Billing
press 9 - to Exit
Medicine Found
***************
36
Id Name Date_of_Expiry Price Qty
2 Adderall 2025-01-12 21 50
37
The Medical Store
Press 6 - Billing
press 9 - to Exit
Deleting medicine.
Medicine Deleted
38
The Medical Store
Press 6 - Billing
press 9 - to Exit
39
Enter Medicine ID: 1
generating bill....
Bill Generated
40
The Medical Store
Press 6 - Billing
press 9 - to Exit
41
Enter Your Choice : 7
42
The Medical Store
Press 6 - Billing
press 9 - to Exit
Bill Found..... !!
***************
43
Bill No Name medicine Amount
44
The Medical Store
Press 6 - Billing
press 9 - to Exit
45
**********************************************************
*************************************
46
Conclusion
47
Bibliography
https://www.geeksforgeeks.org/
https://www.w3schools.com/python/
https://www.javatpoint.com/
https://thonny.org/
https://www.mysql.com/
books:
48