BOOK SHOP SYSTEM Project in Python

32,037 views 29 slides Apr 10, 2021
Slide 1
Slide 1 of 29
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29

About This Presentation

Python Project book shop system.This project BOOKSHOP SYSTEM includes some facilities for the retail book shop to maintain records of the books and also search, display, modification, delete etc the books available. This software searches the books data which is store in the record.


Slide Content

Name of Your School / University





Project Report
On
BOOK SHOP SYSTEM
………………………………………………
(SESSION-……………..)






………………………….
…...............
LOGO IMAGE

ACKNOWLEDGEMENT


I would like to convey my heartful thanks to
……………………………. (Computer Science) who always
gave valuable suggestions & guidance for completion of my
project.
He helped me to understand & remember important details of
the project. My project has been a success only because of his
guidance.
I am especially indented & I am also beholden to my friends. And
finally I thank to the members of my family for their support &
encouragement.

CERTIFICATE




This is to certify that …………………… of class
………… of ………………………………………
has completed his project under my supervision. He has
taken proper care & shown sincerity in completion of this
project.
I certify that this project is up to my expectation &
as per the guideline issued by ………….




……………………………….
(Computer Science faculty)

Content
1. Introduction
2. Flowchart Design
3. Database Structure
4. Source Code
5. Output
6. Requirement
7. Advantages and disadvantages
8. Conclusion
9. Bibliography

INTRODUCTION
This project BOOKSHOP SYSTEM includes some facilities for
the retail book shop to maintain records of the books and also
search, display, modification, delete etc 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 distributors transaction handling is one of the complex
process and it required computerized system to maintain overall
transactions in an easier manner. Due to heavy demand of
books in these competitive worlds, data increase so much. Books
shop required up to date information about the customer who
purchased books or about the suppliers from where books are
purchased. The books shop requires large amount of data to
record and to store, which are collected from the Book House.

FLOWCHART DESIGN

DATABASE STRUCTURE
Table: booksinfo
Columnname Datatype/size Constraints
bookID int(11) Primary Key
title varchar(30)
price int(11)
qty int(11)
pubname varchar(30)
ISBN varchar(20)
authorname varchar(35)
category varchar(15)

Table: salepurchase
Columnname Datatype/size constraints
SPID int(11) Primary key
bookid int(11)
date_SP date
quantity int(11)
status varchar(15)
invoiceno int(11)
amount int(11)

SOURCE CODE
File Name: books_menu.py
"""*************************************************************
THE MAIN FUNCTION OF PROGRAM
****************************************************************
"""
import platform
import os
def myclear():
if platform.system()=="Windows":
print(os.system("cls"))
def intromain():
myclear()
print("***BOOKS******MANAGEMENT****SYSTEM******PROJECT*******************")
print("***************************************************************************")
def intro():
print("****************************BOOKS-MANAGEMENT************************* ")
print("===========================================================")
print("****************************S=Y=S=T=E=M********************************")
print("PROJECT:")
print("MADE BY : ……………………")
print("---------------………………………………………………..--------------------")
def main():
ch=0
myclear()
intromain()
print("=================MAIN MENU====================")
print("01. BOOKS REPORT GENERATOR")
print("02. ADMINISTRATOR")
print("03. EXIT")
print("==============================================")
ch=int(input("Please Select Your Option (1-3)"))
return ch
def book_menu():
ch=0
intromain()
print("===========BOOKS INFO MENU===========")
print("01. ADD BOOKS INFORMATION")
print("02. MODIFY BOOKS INFORMATION")
print("03. DELETE BOOKS INFORMATION")
print("04. BACK TO MAIN")

print("==============================================")
ch=int(input("Please Select Your Option (1-4) "))
return ch
"""***************************************************************
ADMINSTRATOR BOOKS FUNCTION
****************************************************************"""
def admin_menu1():
ch=0
myclear()
intromain()
print("=================BOOKS ADD MENU====================")
print("1.CREATE BOOKS DETAILS")
print("2.DISPLAY ALL BOOKS DETAILS")
print("3.SEARCH RECORD BY BOOKID")
print("4.SEARCH RECORD BY BOOK TITLE")
print("5.SEARCH RECORD BY PRICE")
print("6.SEARCH RECORD BY TYPE")
print("7.SEARCH RECORD BY PUBLISHER")
print("8.BACK TO MAIN MENU")
ch=int(input("Please Enter Your Choice (1-8) "))
return ch
"""***************************************************************
ADMINSTRATOR BOOKS MAIN MENU FUNCTION
****************************************************************"""
def BOOKS_menu():
ch=0
myclear()
intromain()
print("=================ADMIN MENU====================")
print("1.BOOK'S MENU")
print("2.BOOKS SALE/PURCHASE")
print("3.BACK TO MAIN MENU")
ch=int(input("Please Enter Your Choice (1-3) "))
return ch
"""**********************************************************
MODIFY MENU
********************************************************"""
def modifyBOOKS_menu():
ch=0
myclear()
intromain()
print("===============MODIFY MENU==================")
print("1.MODIFY TITLE")
print("2.MODIFY PRICE")
print("3.MODIFY QUANTITY")
print("4.MODIFY ISBN")

print("5.MODIFY PUBLISHER")
print("6.MODIFY CATEGORY")
print("7.BACK TO MAIN MENU")
ch=int(input("Please Enter Your Choice (1-7) "))
return ch
"""**********************************************************
REPORTS MENU
********************************************************"""
def SALE_PURCHASEmenu():
ch=0
myclear()
intromain()
print("===============SALE AND PURCHASE MENU==================")
print("1.BOOKS SOLD OUT")
print("2.BOOKS PURCHASED")
print("3.BACK TO MAIN MENU")
ch=int(input("Please Enter Your Choice (1-3) "))
return ch
def booksinvoicereports():
ch=0
myclear()
intromain()
print("=================BOOKS ADD MENU====================")
print("1.SEARCH AND PRINT SALE INVOICE")
print("2.SEARCH AND PRINT PURCHASE INVOICE")
print("3.DISPLAY ALL INVOICE(SALE/PURCHASE)")
print("4.SEARCH INVOICE BY DATEOFINVOICE")
print("5.BACK TO MAIN MENU")
ch=int(input("Please Enter Your Choice (1-5) "))
return ch

File Name: books.py
import os
import pymysql
#-- to generate the autonumbers
def giveno():
count=0
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
print(mydb)
mycursor=mydb.cursor()
query=("SELECT COUNT(*) FROM booksinfo")
q=("SELECT MAX(bookid) FROM booksinfo")
mycursor.execute(query)
rc=mycursor.fetchone()
tmp=rc[0]
print(tmp)

if tmp==0:
count=int(input("Enter the New No:"))
else:
q=("SELECT MAX(bookid) FROM booksinfo")
mycursor.execute(q)
rc=mycursor.fetchone()
count=rc[0]
count=count+1
mycursor.close()
mydb.close()
return count

#-To add new record of books
def write_bookrecord():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
print(mydb)
C=mydb.cursor()
Query=("INSERT INTO booksinfo VALUES(%s,%s,%s,%s,%s,%s,%s,%s)")
bno=giveno()
bkid=bno
tname=input("Enter Title of book")
pr=int(input("Enter Price of book"))
pnm=input("Enter Publisher name")
isbn=int(input("Enter ISBN number"))
anm=input("Enter Author Name")
catt=input("Enter Category(Fiction/Drama/Education/Others)")
data=(bkid,tname,pr,0,pnm,isbn,anm,catt)
C.execute(Query,data)
mydb.commit()
C.close()
mydb.close()
except:
mydb.close()
#---Search book no
def booksearchdata(scid):
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=conn.cursor()
Query=("SELECT * FROM booksinfo WHERE bookid=%s")
data=(scid,)
C.execute(Query,data)
rc=C.fetchone()
if rc:
print("BOOKID\tTITLE\tPRICE\tQUANTITY\tPUB-NAME\tISBN\tAUTHOR\tCATEGORY")
print(rc[0],"\t",rc[1],"\t",rc[2],"\t",rc[3],"\t",rc[4],"\t",rc[5],"\t",rc[6],"\t",rc[7])

input("--------------------press the key---------------------------------")
os.system('cls')
C.close()
conn.close()
return rc
except:
conn.close()
#----Modify Tile of book
def search_mod_Title():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=mydb.cursor()
bno=int(input("ENTER Book No"))
rc1=booksearchdata(bno)
if rc1:
tnm=input("Enter the new Title name to update:")
Query=("UPDATE booksinfo SET title=%s WHERE bookid=%s")
data=(tnm,bno)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
C.close()
mydb.close()
except:
mydb.close()
#----Modify price of book
def search_mod_price():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=mydb.cursor()
bno=int(input("ENTER Book No"))
rc1=booksearchdata(bno)
if rc1: #--- and f==1:
tnm=int(input("Enter the price to update:"))
Query=("UPDATE booksinfo SET price=price+%s WHERE bookid=%s")
data=(tnm,bno)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
C.close()
mydb.close()
except:
mydb.close()
#----Modify Quantity of book
def search_mod_qty():
try:

mydb=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=mydb.cursor()
bno=int(input("ENTER Book No"))
rc1=booksearchdata(bno)
if rc1:
tnm=int(input("Enter the new Quantity to update:"))
Query=("UPDATE booksinfo SET qty=qty+%s WHERE bookid=%s")
data=(tnm,bno)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
C.close()
mydb.close()
except:
mydb.close()

#----Modify ISBN of book
def search_mod_ISBN():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=mydb.cursor()
bno=int(input("ENTER Book No"))
rc1=booksearchdata(bno)
if rc1:
tnm=input("Enter the ISBN to update:")
Query=("UPDATE booksinfo SET ISBN=%s WHERE bookid=%s")
data=(tnm,bno)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
C.close()
mydb.close()
except:
mydb.close()
#----Modify Publisher of book
def search_mod_pub():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=mydb.cursor()
bno=int(input("ENTER Book No"))
rc1=booksearchdata(bno)
if rc1:
tnm=input("Enter the publisher name to update:")
Query=("UPDATE booksinfo SET pubname=%s WHERE bookid=%s")
data=(tnm,bno)
C.execute(Query,data)

mydb.commit()
print(C.rowcount, "record(s) affected")
C.close()
mydb.close()
except:
mydb.close()

#----Modify Category of book
def search_mod_cat():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=mydb.cursor()
bno=int(input("ENTER Book No"))
rc1=booksearchdata(bno)
if rc1:
tnm=input("Enter the Category to update:")
Query=("UPDATE booksinfo SET category=%s WHERE bookid=%s")
data=(tnm,bno)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
C.close()
mydb.close()
except:
mydb.close()

#---delete the book record from the table
def deletebooks():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=mydb.cursor()
bno=int(input("ENTER Book No"))
rc1=booksearchdata(bno)
if rc1:
Query=("DELETE FROM booksinfo WHERE bookid=%s")
data=(bno,)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
C.close()
mydb.close()
except:
mydb.close()

#--show all books
def showallbook():

try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=conn.cursor()
Query=("SELECT * FROM booksinfo")
#data=(scid,)
C.execute(Query)
rc=C.fetchall()
if rc:
print("BOOKID\tTITLE\tPRICE\tQUANTITY\tPUB-NAME\tISBN\tAUTHOR\tCATEGORY")
for x in rc:
print(x[0],"\t",x[1],"\t",x[2],"\t",x[3],"\t",x[4],"\t",x[5],"\t",x[6],"\t",x[7])

input("--------------------press the key---------------------------------")
os.system('cls')
C.close()
conn.close()
return rc
except:
conn.close()

#----search and display book by ID
def showbookID():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=conn.cursor()
scid=int(input("Enter the Book ID:"))
Query=("SELECT * FROM booksinfo WHERE bookid=%s")
data=(scid,)
C.execute(Query,data)
rc=C.fetchone()
if rc:
print("BOOKID\tTITLE\tPRICE\tQUANTITY\tPUB-NAME\tISBN\tAUTHOR\tCATEGORY")
print(rc[0],"\t",rc[1],"\t",rc[2],"\t",rc[3],"\t",rc[4],"\t",rc[5],"\t",rc[6],"\t",rc[7])
input("--------------------press the key---------------------------------")
os.system('cls')
C.close()
conn.close()
return rc
except:
conn.close()

#----search and display book by title
def showtitle():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=conn.cursor()

scid=input("Enter the Book TITLE:")
Query=("SELECT * FROM booksinfo WHERE title=%s")
data=(scid,)
C.execute(Query,data)
rc=C.fetchone()
if rc:
print("BOOKID\tTITLE\tPRICE\tQUANTITY\tPUB-NAME\tISBN\tAUTHOR\tCATEGORY")
print(rc[0],"\t",rc[1],"\t",rc[2],"\t",rc[3],"\t",rc[4],"\t",rc[5],"\t",rc[6],"\t",rc[7])
input("--------------------press the key---------------------------------")
os.system('cls')
C.close()
conn.close()
return rc
except:
conn.close()

#----search and display book by price
def showbyprice():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=conn.cursor()
low=int(input("Enter the Price lowest value:"))
high=int(input("Enter the Price Highest value:"))
Query=("SELECT * FROM booksinfo WHERE price BETWEEN %s AND %s ")
data=(low,high)
C.execute(Query,data)
rc=C.fetchall()
if rc:
print("BOOKID\tTITLE\tPRICE\tQUANTITY\tPUB-NAME\tISBN\tAUTHOR\tCATEGORY")
for rc1 in rc:
print(rc1[0],"\t",rc1[1],"\t",rc1[2],"\t",rc1[3],"\t",rc1[4],"\t",rc1[5],"\t",rc1[6],"\t",rc1[7])
input("--------------------press the key---------------------------------")
os.system('cls')
C.close()
conn.close()
return rc
except:
conn.close()

#----search and display book by type
def showtype():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=conn.cursor()
scid=input("Enter the Book Category(Fiction/Drama/Education/Programming/Others):")
Query=("SELECT * FROM booksinfo WHERE category=%s")

data=(scid,)
C.execute(Query,data)
rc=C.fetchall()
if rc:
print("BOOKID\tTITLE\tPRICE\tQUANTITY\tPUB-NAME\tISBN\tAUTHOR\tCATEGORY")
for rc1 in rc:
print(rc1[0],"\t",rc1[1],"\t",rc1[2],"\t",rc1[3],"\t",rc1[4],"\t",rc1[5],"\t",rc1[6],"\t",rc1[7])
input("--------------------press the key---------------------------------")
os.system('cls')
C.close()
conn.close()
return rc
except:
conn.close()

#----search and display book by publisher name
def showpub():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=conn.cursor()
scid=input("Enter the Book publisher name:")
Query=("SELECT * FROM booksinfo WHERE pubname=%s")
data=(scid,)
C.execute(Query,data)
rc=C.fetchall()
if rc:
print("BOOKID\tTITLE\tPRICE\tQUANTITY\tPUB-NAME\tISBN\tAUTHOR\tCATEGORY")
for rc1 in rc:
print(rc1[0],"\t",rc1[1],"\t",rc1[2],"\t",rc1[3],"\t",rc1[4],"\t",rc1[5],"\t",rc1[6],"\t",rc1[7])
input("--------------------press the key---------------------------------")
os.system('cls')
C.close()
conn.close()
return rc
except:
conn.close()


#-- to generate the autonumbers
def givemeno():
count=0
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
print(mydb)
mycursor=mydb.cursor()
query=("SELECT COUNT(*) FROM salepurchase")
q=("SELECT MAX(SPID) FROM salepurchase")

mycursor.execute(query)
rc=mycursor.fetchone()
tmp=rc[0]
print(tmp)
if tmp==0:
count=1
else:
q=("SELECT MAX(SPID) FROM salepurchase")
mycursor.execute(q)
rc=mycursor.fetchone()
count=rc[0]
count=count+1
mycursor.close()
mydb.close()
return count

#------Update the qty----
def changeqty(bno,qt,ch):
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=mydb.cursor()
if(ch=='S'):
Query=("UPDATE booksinfo SET qty=qty-%s WHERE bookid=%s")
elif(ch=='A'):
Query=("UPDATE booksinfo SET qty=qty+%s WHERE bookid=%s")
data=(qt,bno)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
C.close()
mydb.close()
except:
mydb.close()


#-------invoice to sell the books

def books_Sale():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
print(mydb)
#mycursor=mydb.cursor()
C=mydb.cursor()
netamt=0
Query=("INSERT INTO salepurchase VALUES(%s,%s,%s,%s,%s,%s,%s)")
invono=int(input("Enter the invoice no:"))

dosp=input("Enter the date of sale")
while True:
no=givemeno()
invoiceid=no
bno=int(input("Enter the book no"))
rc1=booksearchdata(bno)
if rc1:

qt=int(input("Enter the quantity:"))
pr=int(input("Enter the price"))
netamt=pr*qt
#print(invoiceid,bno,dosp,qt,'SALE',invono,netamt)
data=(invoiceid,bno,dosp,qt,'SALE',invono,netamt)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
changeqty(bno,qt,'S')
else:
print("No such book record please try again")

ch=input("Do you want to add more books to sell(y/n)")
if(ch=='n' or ch=='N'):
break
C.close()
mydb.close()
except:
mydb.close()

#-------invoice to sell the books

def books_purchase():
try:
mydb=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
print(mydb)
#mycursor=mydb.cursor()
C=mydb.cursor()
netamt=0
Query=("INSERT INTO salepurchase VALUES(%s,%s,%s,%s,%s,%s,%s)")

invono=int(input("Enter the invoice no:"))
dosp=input("Enter the date of Purchase")
while True:
no=givemeno()
invoiceid=no
bno=int(input("Enter the book no"))
rc1=booksearchdata(bno)

if rc1:

qt=int(input("Enter the quantity:"))
pr=int(input("Enter the price"))
netamt=pr*qt
#print(invoiceid,bno,dosp,qt,'PURCHASE',invono,netamt)
data=(invoiceid,bno,dosp,qt,'PURCHASE',invono,netamt)
C.execute(Query,data)
mydb.commit()
print(C.rowcount, "record(s) affected")
changeqty(bno,qt,'A')
else:
print("No such book record please try again")

ch=input("Do you want to add more books (y/n)")
if(ch=='n' or ch=='N'):
break
C.close()
mydb.close()
except:
mydb.close()
#--------SEARCH AND PRINT SALE INVOICE
def searchinvoice():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=conn.cursor()
tot=0
gst=0
count=1
nettot=0
invo=int(input("Enter the Invoice No:"))
Query=("SELECT booksinfo.title,salepurchase.amount,salepurchase.quantity,salepurchase.date_SP FROM
booksinfo,salepurchase WHERE booksinfo.bookid=salepurchase.bookid AND salepurchase.status='SALE'
AND salepurchase.invoiceno=%s")

data=(invo,)
C.execute(Query,data)
rc=C.fetchall()

if rc:
print("----------------INVOICE: ",invo,"---------DATE: ",rc[0][3])
print("--------------------------SALE------------------------------")
print("S.NO.----|------------BOOK NAME-------------------TOTAL-----")
for rc1 in rc:
tot=tot+rc1[1]
print(count," |---",rc1[0],"\t\t\t\t\t |\t",rc1[1])

count=count+1
gst=tot*12/100
nettot=tot+gst
print("============================================================")
print(" Total: ",tot)
print(" GST : ",gst)
print(" NETTOTAL: ",nettot)
input("----------------------Press any key-------------------------")
C.close()
conn.close()
return rc
except:
conn.close()

#--------SEARCH AND PRINT PURCHASE INVOICE
def searchinvoicePUR():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=conn.cursor()
tot=0
gst=0
count=1
nettot=0
invo=int(input("Enter the Invoice No:"))
Query=("SELECT booksinfo.title,salepurchase.amount,salepurchase.quantity,salepurchase.date_SP FROM
booksinfo,salepurchase WHERE booksinfo.bookid=salepurchase.bookid AND
salepurchase.status='PURCHASE' AND salepurchase.invoiceno=%s")

data=(invo,)
C.execute(Query,data)
rc=C.fetchall()

if rc:
print("----------------INVOICE: ",invo,"---------DATE: ",rc[0][3])
print("-----------------------PURCHASE-----------------------------")
print("S.NO.----|------------BOOK NAME-------------------TOTAL-----")
for rc1 in rc:
tot=tot+rc1[1]
print(count," |---",rc1[0],"\t\t\t\t\t |\t",rc1[1])
count=count+1
gst=tot*12/100
nettot=tot+gst
print("============================================================")
print(" Total: ",tot)
print(" GST : ",gst)
print(" NETTOTAL: ",nettot)

input("----------------------Press any key-------------------------")
C.close()
conn.close()
return rc
except:
conn.close()

#----------display all invoice SALE or PURCHASE wise
def displayinvoiceSP():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=conn.cursor()
count=1
ch=int(input("Enter the Choice 1- SALE Wise 2- PURCHASE Wise:"))
Query=("SELECT booksinfo.title,salepurchase.amount,salepurchase.quantity,salepurchase.date_SP FROM
booksinfo,salepurchase WHERE booksinfo.bookid=salepurchase.bookid AND salepurchase.status=%s")
if(ch==1):
data=('SALE',)
else:
data=('PURCHASE',)
C.execute(Query,data)
rc=C.fetchall()
if rc:
print("---------------------INVOICE LIST---------------------------")
print("------------------------------------------------------------")
print("S.NO.\t\tTitle\t\tQUANTITY\t\tAMOUNT\t\tDATE")
for rc1 in rc:
print(count,"\t\t",rc1[0],"\t\t",rc1[2],"\t\t",rc1[1],"\t\t",rc1[3])
count=count+1
print("============================================================")
input("----------------------Press any key-------------------------")
C.close()
conn.close()
return rc
except:
conn.close()

#----------display all invoice SALE or PURCHASE by date
def displayinvoiceSPdate():
try:
conn=pymysql.connect(host="localhost", user="root", passwd="", database="booksystem")
C=conn.cursor()
count=1

ch=int(input("Enter the Choice 1- SALE Wise 2- PURCHASE Wise:"))
dt=input("Enter the date(yyyy-mm-dd)")

Query=("SELECT
booksinfo.title,salepurchase.amount,salepurchase.quantity,salepurchase.date_SP,salepurchase.invoiceno FROM
booksinfo,salepurchase WHERE booksinfo.bookid=salepurchase.bookid AND salepurchase.status=%s and
salepurchase.date_SP=%s")
if(ch==1):
data=('SALE',dt)
info='SALE'
else:
data=('PURCHASE',dt)
info='PURCHASE'
C.execute(Query,data)
rc=C.fetchall()
if rc:
print("---------------------INVOICE LIST---------------------------")
print("---------------------",info,"---------------------------")
print("S.NO.\t\tTitle\t\tQUANTITY\t\tAMOUNT\t\tDATE\t\tINVOICENO")
for rc1 in rc:
print(count,"\t\t",rc1[0],"\t\t",rc1[2],"\t\t",rc1[1],"\t\t",rc1[3],"\t\t",rc1[4])
count=count+1
print("============================================================")
input("----------------------Press any key-------------------------")
C.close()
conn.close()
return rc
except:
conn.close()

File Name: BOOKSmainpage.py
import books_menu as CM
import sys
import books as BK
def invoice_show():
choice1=CM.booksinvoicereports()
while True:
if choice1==1:
BK.searchinvoice()
break
elif choice1==2:
BK.searchinvoicePUR()
break
elif choice1==3:
BK.displayinvoiceSP()
break
elif choice1==4:
BK.displayinvoiceSPdate()
break
elif choice1==5:
main()
else:
#print("Enter the correct choice")
input("Enter any key to continue")
choice1=0
invoice_show()

def modifybooksshow():
choice1=" "
choice1=CM.modifyBOOKS_menu()
while True:
if choice1==1:
#-----1.MODIFY TITLE
BK.search_mod_Title()
break
elif choice1==2:
#-------2.MODIFY PRICE
BK.search_mod_price()

break
elif choice1==3:
#-------3.MODIFY QUANTITY
BK.search_mod_qty()
break
elif choice1==4:
#-------4.MODIFY ISBN
BK.search_mod_ISBN()
break
elif choice1==5:
#-------5.MODIFY PUBLISHER
BK.search_mod_pub()
break
elif choice1==6:
#-------5.MODIFY CATEGORY
BK.search_mod_cat()
break
elif choice1==7:
main()
else:
input("Enter any key to continue")
modifybooksshow()

#-----------------BOOKS MENU
def booksmenu_show():
choice1=" "
choice1=CM.BOOKS_menu()
while True:
if choice1==1:
bookmidmenu()
break
elif choice1==2:
salepurchase_show()
break
elif choice1==3:
main()
else:
print("Enter the correct choice")
input("Enter any key to continue")
booksmenu_show()

#--------MODIFY MENU AREA
def modifyshow():
choice1=CM.modify_menu()
while True:
if choice1==1:
#--to search custid and modify customer
name
cust.search_mod_custnm()
input("----Press any key------")
break
elif choice1==2:
#----to search custid and modify customer
address
cust.search_mod_custadd()
input("----Press any key------")
break
elif choice1==3:
#---to search custid and search customer
phone no.
cust.search_mod_custphno()
input("----Press any key------")
break
elif choice1==4:
print("\a")
break
else:
print("Enter the correct choice")
input("-----Press any key to continue-----")
choice1=0
modifyshow()
#-------------------------
def book_show():
choice1=CM.admin_menu1()
while True:
if choice1==1:
BK.write_bookrecord()
break
elif choice1==2:
BK.showallbook()
break
elif choice1==3:
BK.showbookID()
break
elif choice1==4:
BK.showtitle()
break
elif choice1==5:
BK.showbyprice()
break
elif choice1==6:
BK.showtype()

break
elif choice1==7:
BK.showpub()
break
elif choice1==8:
main()
break
else:
input("Enter any key to continue")
choice1=0
book_show()

#--------administrator menu
def bookmidmenu():
choice1=CM.book_menu()
while True:
if choice1==1:

book_show()
break
elif choice1==2:
modifybooksshow()
break
elif choice1==3:
BK.deletebooks()
break
elif choice1==4:
print("\a")
break
else:
print("Enter the correct choice")
input("Enter any key to continue")
choice1=0
midmenu()

def salepurchase_show():
choice1=CM.SALE_PURCHASEmenu()
while True:
if choice1==1:
BK.books_Sale()
break
elif choice1==2:
BK.books_purchase()
break
elif choice1==3:
main()
else:
#print("Enter the correct choice")
input("Enter any key to continue")
choice1=0
salepurchase_show()
#-------------Main MENU------------------------------
def main():
CM.intro()
choice=0
while(True):
choice=CM.main()
if choice==1:
CM.myclear()
invoice_show()
elif choice==2:
CM.myclear()
booksmenu_show()
elif choice==3:
exit(1)
else:
print("Enter the correct choice")
input("Enter any key to continue")

main()

OUTPUTS
**********BOOKS******MANAGEMENT****SYSTEM******PROJECT*******************
***************************************************************************
=================MAIN MENU====================
01. BOOKS REPORT GENERATOR
02. ADMINISTRATOR
03. EXIT
==============================================
Please Select Your Option (1-3)
If choice : 1
=================BOOKS ADD MENU====================
1.SEARCH AND PRINT SALE INVOICE
2.SEARCH AND PRINT PURCHASE INVOICE
3.DISPLAY ALL INVOICE(SALE/PURCHASE)
4.SEARCH INVOICE BY DATEOFINVOICE
5.BACK TO MAIN MENU
Please Enter Your Choice (1-5)
If choice: 1
Enter the Invoice No:1452
----------------INVOICE: 1452 ----------------------------------DATE: 2020-09-20
--------------------------SALE------------------------------
S.NO.----|------------BOOK NAME--------------------------------------TOTAL-----
1 |--- CplusProgram | 4500
2 |--- java | 11835
============================================================
Total: 16335
GST : 1960.2
NETTOTAL: 18295.2
if choice: 3
Enter the Choice 1- SALE Wise 2- PURCHASE Wise:1
---------------------INVOICE LIST---------------------------
S.NO. Title QUANTITY AMOUNT DATE
1 CplusProgram 5 2250 2020-05-06
2 java 15 11835 2020-05-06
3 CplusProgram 10 4500 2020-09-20
4 java 15 11835 2020-09-20
If choice: 4
Enter the Choice 1- SALE Wise 2- PURCHASE Wise:1
Enter the date(yyyy-mm-dd) 2020-09-20
---------------------INVOICE LIST---------------------------
--------------------- SALE ---------------------------
S.NO. Title QUANTITY AMOUNT DATE INVOICENO
1 CplusProgram 10 4500 2020-09-20 1452

2 java 15 11835 2020-09-20 1452
If choice: 2
=================ADMIN MENU====================
1.BOOK'S MENU
2.BOOKS SALE/PURCHASE
3.BACK TO MAIN MENU
Please Enter Your Choice (1-3)
If choice : 1
===========BOOKS INFO MENU===========
01. ADD BOOKS INFORMATION
02. MODIFY BOOKS INFORMATION
03. DELETE BOOKS INFORMATION
04. BACK TO MAIN
==============================================
Please Select Your Option (1-4)
If choice:1
=================BOOKS ADD MENU====================
1.CREATE BOOKS DETAILS
2.DISPLAY ALL BOOKS DETAILS
3.SEARCH RECORD BY BOOKID
4.SEARCH RECORD BY BOOK TITLE
5.SEARCH RECORD BY PRICE
6.SEARCH RECORD BY TYPE
7.SEARCH RECORD BY PUBLISHER
8.BACK TO MAIN MENU
Please Enter Your Choice (1-8)
If choice: 1
Enter Title of bookPythonDummies
Enter Price of book580
Enter Publisher nameDummies
Enter ISBN number78956896
Enter Author NameN.D
Enter Category(Fiction/Drama/Education/Others)Computer
If choice: 2
Please Enter Your Choice (1-8) 2
BOOKID TITLE PRICE QUANTITY PUB-NAME ISBN AUTHOR CATEGORY
1451 CplusProgram 450 90 E.SAMUEL 145625 T.SMITH FICTIONS
1452 java 789 85 bpb pub 44587 r.james Programming
1453 PythonDummies 580 0 Dummies 78956896 N.D Computer
If choice: 3
Enter the Book ID:1452
BOOKID TITLE PRICE QUANTITY PUB-NAME ISBN AUTHOR CATEGORY
1452 java 452 88 bpb pub 445877 r.james Programming
If choice: 2 MODIFY
If choice : 2
ENTER Book No1452

BOOKID TITLE PRICE QUANTITY PUB-NAME ISBN AUTHOR CATEGORY
1452 java 454 88 bpb pub 445877 r.james Programming
--------------------press the key---------------------------------
Enter the new Quantity to update:2
1 record(s) affected

REQUIREMENTS
HARDWARE REQUIRED

 Printer, to print the required documents of the project
 Processor : intel or any other
 Ram : 512 MB or above
 Harddisk : 80 GB or more

 SOFTWARE REQUIRED
 Operating system : Windows 7 or above
 Python 2 or above
 IDE Atom, PyCharm, Thonny, or any other.
 Database: MySQL
 WebServer: XAMPP
ADVANTAGES AND DISADVANTAGES
Advantages:
 Customer does not have to wait in long queues.
 This software reduces paper work.
 It is easy to handle customer’s record.
 This software saves the time.
 Information of the customer stores permanently.
Disadvantages:
 This system suitable for only small book shops.
 Online facility is not available.

CONCLUSION
This software is efficient in maintaining customer’s details
and can easily perform operations on customer’s records. This
software also reduces the work load of the shop keeper to
know the quantity of books available and also keep the records
of how many books are purchased and sold.

In future, this system can launch web site for easy online
book selling.
BIBLIOGRAPHY

 www.mysql.org
 www.google.co.in
 www.w3schools.com
 www.tutorialspoint.com
 www.javapoint.com
 www.programiz.com
 www.guru99.com