KEMBAR78
Completed Project | PDF | Software | Computer Hardware
0% found this document useful (0 votes)
16 views23 pages

Completed Project

The Bookstore System project aims to develop an Inventory Management System (IMS) using Python and MySQL for retail bookstores to manage book records, including adding, updating, deleting, and searching for books. The system requires specific software and hardware configurations, and it provides an interface for handling customer details and generating reports. The project includes a flowchart and source code demonstrating the functionalities of the system.

Uploaded by

neharajeev765
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views23 pages

Completed Project

The Bookstore System project aims to develop an Inventory Management System (IMS) using Python and MySQL for retail bookstores to manage book records, including adding, updating, deleting, and searching for books. The system requires specific software and hardware configurations, and it provides an interface for handling customer details and generating reports. The project includes a flowchart and source code demonstrating the functionalities of the system.

Uploaded by

neharajeev765
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

1.

INTRODUCTION
This project BOOKSTORE SYSTEM includes some facilities for the retail
book store to maintain records of the books and also search, display,
modification, delete the books available. This software searches the books
data which is store in the record.
The software used for small shops for maintaining their records related to
books selling, printing the reports and cost savings. Book distributers
transaction handling is one of the complex process and it required
computerised system to maintain overall transaction in an easier manner.
Due to heavy demand of books in these competitive worlds, data increase so
much. Books store required up to date information about the customer who
purchased books or about the suppliers from where books are purchased. The
books store requires large amount of data to record and to store, which are
collected from the Book House.
In this project, we will develop an Inventory Management System (IMS)
using Python and Mysql. This system will provide an interface for
businesses to manage their inventory with features like adding new products,
updating product details, deleting obsolete products, viewing current stock
levels, and generating basic reports.

1
2. System Requirements
2.1. Software requirements:
Operating system: Windows 10 & above any Linux platform
Editor: Visual Studio Code or any other editor like Python IDLE, i5 5th
generation, Sublime Text that supports python.
Core software: Python 3.12 or 3.13 or the latest available version at the time
of installation.
2.2 Hardware requirements:
Processor: PENTIUM-IV GHz or any INTEL Processor minimum (i5, 5th or 6th
processor) and above.
Ram: Minimum requirement (8 GB, 128 GB SSD)
Hard disk: Minimum of 20 GB of space any make of your choice.

2
3.FLOW CHART

START

Import mysql.connector as happiness


mycon=happiness.connect(host=’localhost’,user=’roo
t’,passwd=’root’)
cursor=mycon.cursor()
cursor.execute(“create database if not exists
bookstore”)
cursor.execute(“use bookstore”)

print(“””====MY
BOOKSTORE===”””)

cursor.execute(“create table if not exists


available_books(book_id int primary key, genre
varchar(50),edition int,book_name varchar(90),publisher
varchar(90),price int)”)
cursor.execute(“create table if not exists
customer_details(name varchar(90),gender varchar(20),age
int,phone_number int unique key,address varchar(90))”)
mycon.commit()

3
while(True):

print(“”1:add books
2:delete books
3:search books
4:update books
5:customer details
6:available books
7:exit””)
a=int(input(“enter your choice
”)

if
a==1:(add)

print(“All information prompted are mandatory to be filled”)


b_id=int(input(“enter book id”))
genre=input(“genre:”)
edition=int(input(“enter edition:”)
name=input(“enter book name:”)
price=int(input(“enter the price:”))
pub=input(“enter publisher:”)

4
elif
a==2:(delete
book)

Bname=input(“enter book name


to delete:”)
print(“++++++++++++++SUCES
SFULLY
DELETED++++++++++++++”)

elif a==3:(search
book)

print(“””1:search by book name


2:search by book genre
3:search by publisher”””)
L=int(input(“search by ?:”)

If l==1:(search by book name)

5
o=input(“enter book name to search:”)
print(++++++++++++BOOK IS IN
STOCK++++++++++++”)

elif l==2:(search
by book genre)

g=input(“enter book genre to search:”)


print(“””+++++++++BOOK IS IN
STOCK+++++++++”””)

elif
l==3:(search by
publisher)

Au=input(“enter publisher to search:”)


print(“””+++++BOOK IS IN
STOCK+++++”””)

6
elif
a==4:(UPDATE
PRODUCT)

print(“1:By edition”)
print(“2:By price”)
cr=int(input(“enter your
choice”))

if cr==1:

Name=input(“enter the book name


whose edition to be updated:”)
print(“”UPDATE ROW”)
print(“SUCESSFULLY
UPDATED”)

elif cr==2:

7
Name=input(“enter the
book name whose price
to be updated”)
print(“SUCESSFULLY
UPDATED”)

elif a==5:(CUSTOMER
DETAILS)

print(“1:new customer entry”)


print(“2:remove customer”)
print(“3:existing customer details”)
ch=int(input(“enter your choice:”))

if
ch==1:(NEW
CUSTOMER
ENTRY)

8
fname=str(input(“enter fullname:”))
gender=str(input(“gender(m/f/o):”))
age=int(input(“age:”))
phno=int(input(“phoneno”))
print(“””+++++++++CUSTOMER IS
SUCESSFULLY ADDED++++++++”””)

elif
ch==2:(REMOV
E CUSTOMER)

nm=str(input(“enter customer name to


remove”))
print=(“””++++++++++++CUSTOMER
SUCESSFULLY
REMOVED++++++++++++”””)

elif ch==3:

9
cursor.execute(“select * from customer_details”)
cust=cursor.fetchall()

if cust is
not NONE:

print(“CUSTOMER DETAILS”)
for i in cust:

print(“i”)

else:

print(“NO CUSTOMER
EXISTS!!!”)

10
elif a==6:(AVAILABLE)

print(“AVAILABLE
BOOKS IN STORE”)

Elif a==7:(EXIT)

break

STOP

11
4. PROJECT DESCRIPTION

Book store system is the python computerised application used for maintaining
the book store.
FUNCTIONS USED IN THE PROGRAM:
#ADD BOOKS
#DELETE BOOKS
#SEARCH BOOKS

#Search by book name


#Search by book genre
#Search by publisher
#UPDATE BOOKS
#Update by edition
#Update by price
#CUSTOMER DETAILS
#New customer entry
#Remove customer
#Existing customer details
#AVAILABLE BOOKS
#EXIT

12
5. SOURCE CODE
import mysql.connector as happiness # CREATING CONNECTION OBJECT
mycon = happiness.connect(host="localhost", user="root", password="root") #
CREATING DATABASE AND TABLE
cursor = mycon.cursor()

cursor.execute("CREATE DATABASE IF NOT EXISTS bookstore")


cursor.execute("USE bookstore")
print("""====MY BOOKSTORE====""")

cursor.execute("""
CREATE TABLE IF NOT EXISTS available_books(
book_id INT PRIMARY KEY,
genre VARCHAR(50),
edition INT,
book_name VARCHAR(90),
publisher VARCHAR(90),
price INT
)
""")

cursor.execute("""
CREATE TABLE IF NOT EXISTS customer_details(
name VARCHAR(90),
gender VARCHAR(20),
age INT,
phone_number VARCHAR(15) UNIQUE, -- Changed to VARCHAR to
handle leading zeros

13
address VARCHAR(90)
)
""")

mycon.commit()

while True:
print("1: add books 2: delete books 3: search books 4: update books 5:
customer details 6: available books 7: exit")
a = int(input("Enter your choice: "))

# ADD BOOK
if a == 1:
print("All information prompted are mandatory to be filled")
b_id = int(input("Enter book ID: "))

# Check if book_id already exists


cursor.execute("SELECT book_id FROM available_books WHERE
book_id=%s", (b_id,))
if cursor.fetchone():
print("Book ID already exists! Try a different one.")
else:
genre = input("Genre: ")
edition = int(input("Enter edition: "))
name = input("Enter book name: ")
price = int(input("Enter the price: "))
pub = input("Enter publisher: ")

14
cursor.execute("""
INSERT INTO available_books(book_id, genre, edition, book_name,
publisher, price)
VALUES(%s, %s, %s, %s, %s, %s)
""", (b_id, genre, edition, name, pub, price))
mycon.commit()
print("++++ SUCCESSFULLY ADDED ++++")

# DELETE BOOK
elif a == 2:
print("Available books:")
cursor.execute("SELECT * FROM available_books")
for x in cursor:
print(x)
Bname = input("Enter book name to delete: ")
cursor.execute("DELETE FROM available_books WHERE
book_name=%s", (Bname,))
mycon.commit()
print("Book successfully deleted")

# SEARCH BOOKS
elif a == 3:
print("1: Search by book name 2: Search by book genre 3: Search by
publisher")
L = int(input("Search by: "))

# By book name
if L == 1:

15
o = input("Enter book name to search: ")
cursor.execute("SELECT * FROM available_books WHERE
book_name=%s", (o,))
tree = cursor.fetchall() # Changed to fetchall() to handle multiple results
if tree:
print("++++++++++++ BOOK IS IN STOCK ++++++++++")
for row in tree:
print(row)
else:
print("BOOK IS NOT IN STOCK")

# By book genre
elif L == 2:
g = input("Enter book genre to search: ")
cursor.execute("SELECT * FROM available_books WHERE
genre=%s", (g,))
poll = cursor.fetchall() # Changed to fetchall() to handle multiple results
if poll:
print("+++++++++ BOOKS IN STOCK +++++++++")
for row in poll:
print(row)
else:
print("NO BOOKS FOUND IN THIS GENRE")

# By publisher
elif L == 3:
au = input("Enter publisher to search: ")

16
cursor.execute("SELECT * FROM available_books WHERE
publisher=%s", (au,))
home = cursor.fetchall() # Changed to fetchall() to handle multiple
results
if home:
print("+++++ BOOKS BY THIS PUBLISHER +++++")
for row in home:
print(row)
else:
print("BOOKS OF THIS PUBLISHER ARE NOT AVAILABLE")

# UPDATE BOOK
elif a == 4:
print("1: By edition")
print("2: By price")
cr = int(input("Enter your choice: "))

# By edition
if cr == 1:
Name = input("Enter the book name whose edition needs to be updated:
")
edt = int(input("Enter the edition to be updated: "))
cursor.execute("UPDATE available_books SET edition=%s WHERE
book_name=%s", (edt, Name))
print("UPDATED ROW")
cursor.execute("SELECT * FROM available_books WHERE
book_name=%s", (Name,))
plan = cursor.fetchone()
print(plan)

17
print("SUCCESSFULLY UPDATED")

# By price
elif cr == 2:
Name = input("Enter book name whose price is to be updated: ")
newprice = int(input("Enter the new price: "))
cursor.execute("UPDATE available_books SET price=%s WHERE
book_name=%s", (newprice, Name))
print("UPDATED ROW")
cursor.execute("SELECT * FROM available_books WHERE
book_name=%s", (Name,))
added = cursor.fetchone()
print(added)
print("SUCCESSFULLY UPDATED")

# CUSTOMER DETAILS
elif a == 5:
print("1: New customer entry")
print("2: Remove customer")
print("3: Existing customer details")
ch = int(input("Enter your choice: "))

# NEW CUSTOMER ENTRY


if ch == 1:
fname = str(input("Enter fullname: "))
gender = str(input("Gender (m/f/o): "))
age = int(input("Age: "))

18
phno = input("Phone number: ") # Changed to string to handle non-
numeric characters and leading zeros
if len(phno) != 10 or not phno.isdigit():
print("Invalid phone number")
else:
address = str(input("Address: "))
cursor.execute("""
INSERT INTO customer_details(name, gender, age,
phone_number, address)
VALUES(%s, %s, %s, %s, %s)
""", (fname, gender, age, phno, address))
mycon.commit()
print("+++++++++ CUSTOMER IS SUCCESSFULLY ADDED
++++++++")

# REMOVE CUSTOMER
elif ch == 2:
nm = str(input("Enter customer name to remove: "))
cursor.execute("SELECT name FROM customer_details WHERE
name=%s", (nm,))
toy = cursor.fetchone()
if toy:
cursor.execute("DELETE FROM customer_details WHERE
name=%s", (nm,))
mycon.commit()
print("++++++++++++ CUSTOMER SUCCESSFULLY REMOVED
+++++++")
else:
print("CUSTOMER DOES NOT EXIST")

19
# EXISTING CUSTOMER DETAILS
elif ch == 3:
cursor.execute("SELECT * FROM customer_details")
cust = cursor.fetchall()
if cust:
print("CUSTOMER DETAILS")
for i in cust:
print(i)
else:
print("NO CUSTOMER EXISTS")

# AVAILABLE BOOKS
elif a == 6:
print("AVAILABLE PRODUCTS IN STORE")
cursor.execute("SELECT * FROM available_books ORDER BY
book_name")
row = cursor.fetchall()
for y in row:
print(y)

# EXIT
elif a == 7:
break

mycon.close()
print("Program completed")

20
21
6. OUTPUT SCREENSHOTS
6.1 Main menu:

6.2 Add Books:

6.3 Delete Books:

6.4 Search Books:


6.4.1 Search By Book Name:

6.4.2 Search By Book Genre:

22
23

You might also like