Book Stall
Book Stall
INDEX
5. Output Screens
6. Bibliography
BRIEF OVERVIEW OF PROJECT
When the program is run, it first creates a connection to the MySQL server
running on the local machine, using the root user and the password “admin”. It
then creates a database called “store” (if it doesn’t already exist) and uses it. It
creates a table called “signup” with columns for “username” and “password”.
This table is used to store user account information.
The program then enters a loop that presents the user with a choice between
signing up and logging in. If the user chooses to sign up, they are prompted to
enter a username and password, which are then stored in the “signup” table. If
the user chooses to log in, they are prompted to enter a username. If the
username is found in the “signup” table, the program prompts the user to enter
their password. If the password is correct, the user is presented with a menu of
options for managing the bookstore.
1. Add Books: The user is prompted to enter information about a new book
(name, genre, quantity, author, publication, and price). If the book is
already in the store, the quantity is increased. Otherwise, the book is
added to the “Available_Books” table.
2. Delete Books: The user is shown a list of available books and prompted
to enter information about a book to delete (name, quantity, customer
name, phone number, and price). If the requested quantity of the book is
available, a record of the sale is added to the “Sell_rec” table and the
quantity of the book is decreased. Otherwise, an error message is
displayed.
3. Search Books: The user is prompted to choose a search criterion (name,
genre, or author) and enter a search term. The program searches the
“Available_Books” table for books matching the search criterion and
term and displays the results.
4. Staff Details: The user is shown a list of staff details (name, gender, age,
phone number, and address) stored in the “Staff_details” table.
5. Sell Record: The user is shown a list of records of book sales stored in the
“Sell_rec” table.
6. Available Books: The user is shown a list of available books stored in the
“Available_Books” table.
7. Total Income after the Latest Reset: The user is shown the total income
from book sales since the last reset.
8. Exit: The program exits.
NEED OF COMPUTERISATION
A Book store software helps retail Book store businesses have complete control
over business from purchase, inventory management to sales where you can
have a track of every operation
Data file handling has been effectively used in the program. The database is a
collection of interrelated data to serve multiple applications. That is database
programs create files of information. So we see that files are worked with most,
inside the program.
DBMS: The software required for the management of data is called as DBMS.
It has3 models:
• Relation model
• Hierarchical model
• Network model
CHARACTERISTICS OF DBMS:
• It reduces the redundancy
• Reduction of data in inconsistency
• Data sharing
• Data standardization
DIFFERENT TYPES OF FILES: -BASED ON ACCESS:
• Sequential file
• Serial file
• Random (direct access) file BASED ON STORAGE:-
• Text file
• Binary File
Source codescreening
DBMS: MySQL
Host: local host
User: root
Pass: root
Database: book_shop
cur = db.cursor()
user = input("Enter the user name : ")
if passwd == passwd2 :
print("Created Successfully!!!")
db.commit()
db.close()
def login():
cur = db.cursor()
if cur.rowcount>0 :
return True
else:
return False
db.close()
def add_stock() :
cur = db.cursor()
bno = unique_book_no()
if bno :
else :
db.commit()
db.close()
def unique_book_no () :
cur = db.cursor()
cur.execute("select max(Book_No) from stock")
data = cur.fetchall()
if bool(data[0][0]) :
shuffle(L1)
return L1.pop(0)
else :
return False
db.close()
def view_stock() :
cur = db.cursor()
data = cur.fetchall()
db.close()
def update_stock() :
cur = db.cursor()
bno = int(input("Enter the book number : "))
data = cur.fetchall()
print("Updated Successfully")
db.commit()
db.close()
def sell_book() :
cur = db.cursor()
print('Purchase')
print("Bought Successfully")
db.commit()
filename = mktemp('.txt')
open(filename , 'w').write(q)
startfile(filename , 'print')
if cur.rowcount == 1 :
print("STOCK OF ")
print("EXHAUSTED")
db.close()
return 31
return 29
elif month == 2 :
return 28
else :
return 30
def view_sales () :
cur = db.cursor()
data = cur.fetchall()
L1 , L2 = [] , []
L2.append(row[1])
print(L1,L2)
'''
plt.bar(L1 , L2)
plt.xlabel('Books')
plt.ylabel('Sales')
plt.title('Sales')
plt.show()
'''
#_______________________________________________________________
____________________
import datetime as dt
cur = db.cursor()
cur.execute("use book_shop")
cur.execute("create table if not exists stock\
Book_Name varchar(255),\
Author varchar(255),\
Publisher varchar(255),\
Cost_per_Book float,\
Available_Stock bigint,\
qty_purchased bigint,\
purchased_on date)")
cur.close()
db.commit()
db.close()
c = 'y'
print('1. Register')
print('2. Login')
print('3. Exit')
if cho == 1 :
clrscreen()
add_user()#ok
elif cho == 2 :
clrscreen()
if login():#ok
print("Login successful")
clrscreen()
C = 'y'
clrscreen()
print("3. Exit")#ok
if choice == 1 :
clrscreen()
print("4. Exit")
if choice2 == 1 :
clrscreen()
add_stock()#ok
elif choice2 == 2 :
clrscreen()
view_stock()#ok
elif choice2 == 3 :
clrscreen()
update_stock()#ok
elif choice2 == 4 :
print("Good Bye")
break
elif choice == 2 :
clrscreen()
print("3. Exit")
choice3 = int(input("Enter your choice : "))
if choice3 == 1 :
clrscreen()
sell_book()
elif choice3 == 2 :
clrscreen()
view_sales()
elif choice3 == 3 :
print("Good Bye")
break
elif choice == 3 :
print("Good Bye")
break
else :
elif cho == 3 :
print("Good Bye")
break
else :
print("INVALID CHOICE")
c = input("Do you want to return to main menu (y/[n]) : ")
else :
print("Good Bye")
OUTPUT SCREEN
BIBLIOGRAPHY
1. http://www.google.com/
2. http://en.wikipedia.org
by Sumita Arora