0% found this document useful (0 votes)
5 views

CS project

CHEMIST SHOP MANAGEMENT
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

CS project

CHEMIST SHOP MANAGEMENT
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

KENDRIYA VIDYALAYA NO.

2 JALAHALLI EAST
BANGALORE

A PROJECT REPORT
ON
CHEMIST SHOP MANAGEMENT!!!
FOR
CBSE 2024-25 EXAMINATION
[AS A PART OF THE COMPUTER SCIENCE(083)]

DONE BY:

SUHANA BALIYAN

UNDER THE GUIDANCE OF:


MRS. LEENA A
PGT (COMP.SC)
CERTIFICATE
This is to certify that SUHANA BALIYAN of
class XII-A has successfully completed their
Computer Science project on “CHEMIST SHOP
MANAGEMENT” under the guidance of Mrs.
Leena Unni (PGT Comp. Sc.). This is certified
to be the bonafide work of the student in the
Informatics Computer Science laboratory during
the academic year 2024-25.

TEACHER IN CHARGE EXAMINER PRINCIPAL


ACKNOWLEDGEMENT
I have tried to apply best of knowledge and

experience, gained during the study and class

work experience.

I would like to extend my sincere thanks and


gratitude to my teacher MRS LEENA A (PGT
Comp.Sc), who gave me an opportunity to make
this project and supported me throughout.

I am very much thankful to our Principal

MRS JYOTHI SHARMA for giving her valuable


time and moral support.

I would like to take the opportunity to extend

my sincere thanks and gratitude to my parents

for being a source of inspiration and providing

time and freedom to develop this software

project.
INDEX

1. CERTIFICATE

2. ACKNOWLEDGEMENT

3. INTRODUCTION

4.THEORITICAL APPROACH

5. CODING

6. OUTPUT

7. BIBLOGRAPHY
INTRODUCTION

This project provides the information about


‘CHEMIST SHOP MANAGEMENT’.

The system is designed to store and manage


essential details, including Medicine ID, Name,
Manufacturer, Date of Manufacture, Date of
Expiry, Weight, Contents, Price,and Quantity,
in a MySQL database.

This project helps in managing the daily tasks of

a chemist shop, making it easier to keep records,

track stock, and serve customers better.


THEORITICAL APPROACH

What is Python?

Python is an interpreted, object-oriented, high-level


programming language with dynamic semantics. Its high-level
built in data structures, combined with dynamic typing and
dynamic binding, make it very attractive for Rapid Application
Development, as well as for use as a scripting or glue language to
connect existing components together. Python's simple, easy to
learn syntax emphasizes readability and therefore reduces the
cost of program maintenance. Python supports modules and
packages, which encourages program modularity and code reuse.
The Python interpreter and the extensive standard library are
available in source or binary form without charge for all major
platforms, and can be freely distributed.

Often, programmers fall in love with Python because of the


increased productivity it provides. Since there is no compilation
step, the edit-test-debug cycle is incredibly fast. Debugging
Python programs is easy: a bug or bad input will never cause a
segmentation fault. Instead, when the interpreter discovers an
error, it raises an exception. When the program doesn't catch
the exception, the interpreter prints a stack trace. A source
level debugger allows inspection of local and global variables,
evaluation of arbitrary expressions, setting breakpoints, stepping
through the code a line at a time, and so on. The debugger is
written in Python itself, testifying to Python's introspective
power. On the other hand, often the quickest way to debug a
program is to add a few print statements to the code
Features of Python:
Python provides lots of features that are listed below.

1) Easy to Learn and Use

Python is easy to learn and use. It is developer-friendly and high-


level programming language.

2) Expressive Language

Python language is more expressive means that it is more


understandable and readable.

3) Interpreted Language

Python is an interpreted language i.e. interpreter executes the


code line by line at a time. This makes debugging easy and thus
suitable for beginners.

4) Cross-platform Language
Python can run equally on different platforms such as Windows,
Linux, Unix and Macintosh etc. So, we can say that Python is a
portable language.

5) Free and Open Source

Python language is freely available at official web address. The


source-code is also available. Therefore, it is open source.

6) Object-Oriented Language

Python supports object-oriented language and concepts of


classes and objects come into existence.
SYSTEM REQUIREMENTS

• RAM : 2GB
• PROCESSOR : INTEL CORE i5
• OPERATING SYSTEM : MS Windows 10

SOFTWARES USED

• Python : 3.11.4 (64 bit)


• MySQL : version 8.0.40
• MySQL-Python connector
CODING
Initializing a MySQL database and creating tables
import mysql.connector as m
c=m.connect(host="localhost", user="root",
password="root",auth_plugin='mysql_native_password')
cursor = c.cursor()
q = "create database project"
cursor.execute(q)
q = "use project"
cursor.execute(q)
q = '''create table medicine(
mid integer primary key,
mname varchar(30) not null,
manufacturer varchar(50),
dateofm date,
dateofexp date not null,
mg float,
content varchar(100),
price float,
qty integer)'''
cursor.execute(q)
q = '''
create table bill(
billid integer primary key,
cname varchar(50),
medicine_bought varchar(100),
amount float,
billdate date)'''
cursor.execute(q)
c.commit()
print("Database Initialised")

Main Code

# library import
import mysql.connector as m
import time
import random as rd

def medicine():
# function to add a medicine
def addmedicine():
print("\n")
mid = input("Enter Medicine Id : ")
name = input("Enter Medicine Name : ")
mf = input("Enter Name of Manufacturer : ")
dom = input("Enter Date of Manufacture : ")
doe = input("Enter Date of Expiry : ")
mg = input("Enter the Weight (in mg) : ")
content = input("Enter Content : ")
price = input("Enter the Price : ")
qty = input("Enter the Quantity : ")
print("\nSTORING MEDICINE DETAILS.......")
time.sleep(2)
q = "insert into medicine values(%s,%s,%s,%s,%s,%s,%s,%s,%s)"
data = (mid, name, mf, dom, doe, mg, content, price, qty)
cursor = c.cursor()
cursor.execute(q, data)
print("\nMedicine Inserted.......!!!!")
print("\n")
c.commit()

# function to show a medicine


def showmedicine():
q = "select * from medicine"
cursor = c.cursor()
cursor.execute(q)
res = cursor.fetchall()
print("\n")
print("-" * 95)
print("Id\tName\t\tDate_of_Expiry\t\tPrice\t\tQty")
print("-" * 95)
for k in res:
print(k[0], "\t", k[1], "\t\t", k[4], "\t\t", k[-2], "\t\t", k[-1])
print("-" * 95)
print("\n")

# function to restock a medicine


def restock():
mid = input("Enter the Medicine ID : ")
qty = input("Enter the Quantity to Add : ")
q = "update medicine set qty = qty + %s where mid = %s"
d = (qty, mid)
cursor = c.cursor()
cursor.execute(q, d)
print("\n")
print("Medicine Restocked......!!")
print("\n")
c.commit()

# function to search a medicine


def search():
mid = input("Enter the Medicine ID : ")
q = "select * from medicine where mid = " + mid
cursor = c.cursor()
cursor.execute(q)
k = cursor.fetchone() # Corrected this line
if k == None:
print("\nNo Medicine Available With This ID\n")
else:
print("\nMedicine Found......!!")
print("\n")
print("-" * 95)
print("Id\tName\t\tDate_of_Expiry\t\tPrice\t\tQty")
print("-" * 95)
print(k[0], "\t", k[1], "\t\t", k[4], "\t\t", k[-2], "\t\t", k[-1])
print("-" * 95)
print()

# Function to delete a medicine


def deletem():
mid = input("Enter the Medicine ID : ")
q = "delete from medicine where mid = " + mid
cursor = c.cursor()
cursor.execute(q)
print("\nMedicine Deleted......!!\n")
print("\n\n")
c.commit()

# function for billing


def billing():
bno = input("Enter Bill No. : ")
cname = input("Enter Customer's Name : ")
bdate = input("Enter Bill Date (yyyy-mm-dd) : ")
amount = 0
medicine = ""
cursor = c.cursor()
while True:
mid = input("Enter Medicine id : ")
q = "select * from medicine where mid = " + mid
cursor.execute(q)
res = cursor.fetchone()
if res == None:
print("\nNo Medicine Available With This ID\n")
else:
price = int(res[-2])
medicine += res[1] + " "
print("Price of Medicine is : ", price)
qty = int(input("Enter the Quantity to be Purchased : "))
bill = price * qty
amount += bill
print("Amount for Medicine ", amount)
ans = input("Are There More Medicine to be Purchased : ")
if ans.lower() == "no":
print("Calculating Your Bill ")
break
print("Total Bill Amount is : ", amount)
q = "insert into bill values(%s,%s,%s,%s,%s)"
data = (bno, cname, medicine, amount, bdate)
cursor.execute(q, data)
c.commit()
print(" Bill Generated !!! \n\n")

def showbills():
q = "select * from bill"
cursor = c.cursor()
cursor.execute(q)
res = cursor.fetchall()
print("\n")
print("-" * 95)
print("BillNo\tName\t\tMedicine\t\t\t\tAmount\t\tDateofBill")
print("-" * 95)
for k in res:
print(str(k[0]) + "\t" + k[1] + "\t\t" + k[2] + "\t\t" + str(k[3]) +
"\t\t" + str(k[4]))
print("-" * 95)
print("\n")

while True:
print("\t\t\tS.I.T.I Medical Store")
print("\n")
print("Press 1 - Add New Medicine")
print("Press 2 - Restock a Medicine")
print("Press 3 - Show All Medicines")
print("Press 4 - Search a Medicine")
print("Press 5 - Delete a Medicine")
print("Press 6 - Billing")
print("Press 7 - Display Previous Bills")
print("press 8 - to Exit")
print("\n")
opt = int(input("Enter Your Choice : "))
if opt == 1:
addmedicine()
elif opt == 2:
restock()
elif opt == 3:
showmedicine()
elif opt == 4:
search()
elif opt == 5:
deletem()
elif opt == 6:
billing()
elif opt == 7:
showbills()
elif opt == 8:
print("THANKS FOR VISITING..!!")
print("\t\t Have a Medicine-Free Life Ahead")
print("*" * 95)
break
else:
print("You're having only 8 options to choose -___-")
break

# setting connection
c = m.connect(host="localhost", user="root", password="root",
database="project", auth_plugin='mysql_native_password')

if c.is_connected():
print("\n")
print("\t\t\tCHEMIST SHOP MANAGEMENT")
print("\n")
medicine()
print("\t\tThanks for Visiting....!!!")
else:
print("Connection Error !!!!!")
OUTPUT
Enter your Choice : 1

Enter your Choice : 2


Enter choice : 3

Enter choice : 4
Enter choice : 5

Enter choice : 6
Enter choice : 7

Medicine Table

Billing table
BIBLOGRAPHY

1. The Complete Reference MySQL by Vikram V

2. Online Help of python(Chat GPT)

3. Class Notes

You might also like