Super 1
Super 1
Section
Roll no.
Registration
no.
Board roll
no.
NERUL, NAVI MUMBAI
CERTIFICATE
Registration No.:
Board Roll No.:
__________________ _________________
External Examiner Internal Examiner
Date: Date:
__________________ ___________________
SCHOOL SEAL PRINCIPAL
I hereby declare that the project entitled “Supermarket
billing system” has been submitted to “Tilak Public
School” for subject computer science under the
guidance of Mrs. Amrita Dutta is a record of original
done by us and there is no copy or project related to it
has been submitted to any other school or educational
institute by us.
The success and outcome of this project
Required a lot of assistance and teamwork from both
the team members we extremely fortunate to have got
this all along the completion of our project work.
Whatever we have done is only due to such guidance
and assistance and we would not forget to thank them. I
respect and thank Ms. Amrita Dutta, for giving us an
opportunity to do this assignment work and providing
us all support and guidance which made us complete
the assignment on time, we extremely grateful to her for
providing such a nice support and guidance.
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.
Uses of Python:
Its ease of use. For those who are new to coding and
programming, Python can be an excellent first step. It is
relatively easy to learn, making it a great way to start building
your programming knowledge.
Its simple syntax. Python is relatively easy to read and
understand, as its syntax is more like English. Its
straightforward layout means that you can work out what each
line of code is doing.
Its thriving community. As it is an open-source language,
anyone can use Python to code. What is more, there is a
community that supports and develops the ecosystem, adding
their own contributions and libraries.
Its versatility. As we will explore in more detail, there are
many uses for Python. Whether you are interested in data
visualisation, artificial intelligence or web development, you
can find a use for the language.
Features of Python:
1. Easy to Code
Python is a very high-level programming language, yet it is effortless to learn. Anyone can
learn to code in Python in just a few hours or a few days. Mastering Python and all its
advanced concepts, packages and modules might take some more time. However, learning
the basic Python syntax is very easy, as compared to other popular languages like C, C++,
and Java.
2. Easy to Read
Python code looks like simple English words. There is no use of semicolons or brackets, and
the indentations define the code block. You can tell what the code is supposed to do simply
by looking at it.
Python has an extensive standard library available for anyone to use. This means
that programmers do not have to write their code for every single thing unlike other
programming languages. There are libraries for image manipulation, databases, unit-testing,
expressions and a lot of other functionalities. In addition to the standard library, there is also a
growing collection of thousands of components, which are all available in the Python
Package Index.
5. Interpreted
When a programming language is interpreted, it means that the source code is executed line
by line, and not all at once. Programming languages such as C++ or Java are not interpreted,
and hence need to be compiled first to run them. There is no need to compile Python because
it is processed at runtime by the interpreter.
Python MySQL Connector is a Python driver that
helps to integrate Python and MySQL. This Python
MySQL library allows the conversion between Python
and MySQL data types. MySQL Connector API is
implemented using pure Python and does not require
any third-party library.
Why choose Python for database programming ?
Following are the reason to choose python for database
programming
• Programming more efficient and faster compared to
other languages.
• Portability of python programs.
• Support platform independent program development.
• Python supports SQL cursors.
• Python itself take care of open and close of
connections.
• Python supports relational database systems.
• Porting of data from one dbms to other is easily
possible as it support large range of APIs for various
databases.
SQL, Structured Query Language, was developed
in 1970s in an IBM Laboratory. SQL, sometimes
also referred to as SEQUEL is a 4th generation
non-procedural language.
It is particularly useful in handling structured data,
i.e. data incorporating relations among entities and
variables.
It's based upon relational algebra and tuple
relational calculus, SQL consists of many types of
statements, which may be informally classed as
sublanguages, commonly: a data query language
(DQL).
The purpose of the project is to build an
application program to reduce the manual work for
managing a supermarket store. It tracks all the bills
and allow us to add bills, delete bills, view bills.
3. mysql.connector Connection to
mysql
database
4. Message.box Pop-up
messages
SR.NO FUNCTION PURPOSE
Main.py:
from tkinter import *
from tkinter import messagebox
import pymysql
import mysql.connector
# Add your own database name and password here to reflect in the code
mypass = "Rock@981907"
mydatabase="billingsys"
con =
pymysql.connect(host="localhost",user="root",password=mypass,database=mydataba
se)
cur = con.cursor()
def checkLogin():
uname = userName.get()
pwd = password.get()
branc=place.get()
root = Tk()
root.title("Login")
root.minsize(width=400,height=400)
root.geometry("600x500")
# Take n greater than 0.25 and less than 5
same=True
n=0.25
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
labelFrame = Frame(root,bg='black')
labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5)
userName = Entry(labelFrame)
userName.place(relx=0.3,rely=0.2, relwidth=0.62, relheight=0.1)
place = Entry(labelFrame)
place.place(relx=0.3,rely=0.5, relwidth=0.62, relheight=0.1)
#Submit Button
SubmitBtn = Button(root,text="SUBMIT",bg='#d1ccc0',
fg='black',command=checkLogin)
SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.1)
root.mainloop()
menu.py:
from tkinter import *
import pymysql
def supermarket():
root = Tk()
root.title("Supermarket")
root.minsize(width=400,height=400)
root.geometry("600x500")
# Add your own database name and password here to reflect in the code
mypass = "Rock@981907"
mydatabase="billingsys"
con =
pymysql.connect(host="localhost",user="root",password=mypass,database=mydataba
se)
cur = con.cursor()
Canvas1 = Canvas(root)
Canvas1.config(bg="#006B38")
Canvas1.pack(expand=True,fill=BOTH)
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
headingFrame1.place(relx=0.2,rely=0.1,relwidth=0.6,relheight=0.16)
root.mainloop()
addbill.py:
from tkinter import *
from PIL import ImageTk,Image
from tkinter import messagebox
import pymysql
def bookRegister():
bid = bookInfo1.get()
customer_name = bookInfo2.get()
qty = bookInfo3.get()
bill_amt = bookInfo4.get()
bookTable='bills'
insertBills = "insert into "+bookTable+"
values('"+bid+"','"+customer_name+"','"+qty+"','"+bill_amt+"')"
try:
cur.execute(insertBills)
con.commit()
messagebox.showinfo('Success',"Book added successfully")
except:
messagebox.showinfo("Error","Can't add data into Database")
print(bid)
print(customer_name)
print(qty)
print(bill_amt)
root.destroy()
def addBook():
global
bookInfo1,bookInfo2,bookInfo3,bookInfo4,Canvas1,con,cur,bookTable,root
root = Tk()
root.title("Supermarket")
root.minsize(width=400,height=400)
root.geometry("600x500")
# Add your own database name and password here to reflect in the code
mypass = "Rock@981907"
mydatabase="billingsys"
con =
pymysql.connect(host="localhost",user="root",password=mypass,database=mydataba
se)
cur = con.cursor()
Canvas1 = Canvas(root)
Canvas1.config(bg="#ff6e40")
Canvas1.pack(expand=True,fill=BOTH)
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
labelFrame = Frame(root,bg='black')
labelFrame.place(relx=0.1,rely=0.4,relwidth=0.8,relheight=0.4)
# Book ID
lb1 = Label(labelFrame,text="Bill ID : ", bg='black', fg='white')
lb1.place(relx=0.05,rely=0.2, relheight=0.08)
bookInfo1 = Entry(labelFrame)
bookInfo1.place(relx=0.3,rely=0.2, relwidth=0.62, relheight=0.08)
# Title
lb2 = Label(labelFrame,text="Customer name : ", bg='black', fg='white')
lb2.place(relx=0.05,rely=0.35, relheight=0.08)
bookInfo2 = Entry(labelFrame)
bookInfo2.place(relx=0.3,rely=0.35, relwidth=0.62, relheight=0.08)
# Book Author
lb3 = Label(labelFrame,text="Quantity : ", bg='black', fg='white')
lb3.place(relx=0.05,rely=0.50, relheight=0.08)
bookInfo3 = Entry(labelFrame)
bookInfo3.place(relx=0.3,rely=0.50, relwidth=0.62, relheight=0.08)
# Book Status
lb4 = Label(labelFrame,text="Bill amount : ", bg='black', fg='white')
lb4.place(relx=0.05,rely=0.65, relheight=0.08)
bookInfo4 = Entry(labelFrame)
bookInfo4.place(relx=0.3,rely=0.65, relwidth=0.62, relheight=0.08)
#Submit Button
SubmitBtn = Button(root,text="SUBMIT",bg='#d1ccc0',
fg='black',command=bookRegister)
SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)
root.mainloop()
deletebill.py:
# Add your own database name and password here to reflect in the code
mypass = "Rock@981907"
mydatabase="billingsys"
con =
pymysql.connect(host="localhost",user="root",password=mypass,database=mydataba
se)
cur = con.cursor()
def deleteBook():
bid = bookInfo1.get()
print(bid)
bookInfo1.delete(0, END)
root.destroy()
def delete():
global
bookInfo1,bookInfo2,bookInfo3,bookInfo4,Canvas1,con,cur,bookTable,root
root = Tk()
root.title("Supermarket")
root.minsize(width=400,height=400)
root.geometry("600x500")
Canvas1 = Canvas(root)
Canvas1.config(bg="#006B38")
Canvas1.pack(expand=True,fill=BOTH)
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
headingLabel = Label(headingFrame1, text="Delete Bill", bg='black',
fg='white', font=('Courier',15))
headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)
labelFrame = Frame(root,bg='black')
labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5)
# Book ID to Delete
lb2 = Label(labelFrame,text="Bill ID : ", bg='black', fg='white')
lb2.place(relx=0.05,rely=0.5)
bookInfo1 = Entry(labelFrame)
bookInfo1.place(relx=0.3,rely=0.5, relwidth=0.62)
#Submit Button
SubmitBtn = Button(root,text="SUBMIT",bg='#d1ccc0',
fg='black',command=deleteBook)
SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)
root.mainloop()
viewbill.py:
from tkinter import *
from PIL import ImageTk,Image
from tkinter import messagebox
import pymysql
# Add your own database name and password here to reflect in the code
mypass = "Rock@981907"
mydatabase="billingsys"
con =
pymysql.connect(host="localhost",user="root",password=mypass,database=mydataba
se)
cur = con.cursor()
def View():
root = Tk()
root.title("Supermarket")
root.minsize(width=400,height=400)
root.geometry("600x500")
Canvas1 = Canvas(root)
Canvas1.config(bg="#12a4d9")
Canvas1.pack(expand=True,fill=BOTH)
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
labelFrame = Frame(root,bg='black')
labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5)
y = 0.25
Label(labelFrame, text="%-10s%-40s%-30s%-20s"%('BID','Customer
name','Quantity','Amount'),bg='black',fg='white').place(relx=0.07,rely=0.1)
Label(labelFrame, text="--------------------------------------------------
--------------------------",bg='black',fg='white').place(relx=0.05,rely=0.2)
getBooks = "select * from "+bookTable
try:
cur.execute(getBooks)
con.commit()
for i in cur:
Label(labelFrame, text="%-10s%-50s%-30s%-
20s"%(i[0],i[1],i[2],i[3]),bg='black',fg='white').place(relx=0.07,rely=y)
y += 0.1
except:
messagebox.showinfo("Failed to fetch files from database")
root.mainloop()
addaccount.py:
from tkinter import *
from PIL import ImageTk,Image
from tkinter import messagebox
import pymysql
def logincreate():
username = billInfo1.get()
password = billInfo2.get()
branch = billInfo3.get()
#bill_amt = billInfo4.get()
bookTable='login'
insertBills = "insert into "+bookTable+"
values('"+username+"','"+password+"','"+branch+"')"
try:
cur.execute(insertBills)
con.commit()
messagebox.showinfo('Success',"Account added successfully")
except:
messagebox.showinfo("Error","Can't add account into Database")
print(username)
print(password)
print(branch)
root.destroy()
def newaccount():
global billInfo1,billInfo2,billInfo3,Canvas1,con,cur,bookTable,root
root = Tk()
root.title("Supermarket")
root.minsize(width=400,height=400)
root.geometry("600x500")
# Add your own database name and password here to reflect in the code
mypass = "Rock@981907"
mydatabase="billingsys"
con =
pymysql.connect(host="localhost",user="root",password=mypass,database=mydataba
se)
cur = con.cursor()
Canvas1.config(bg="#ff6e40")
Canvas1.pack(expand=True,fill=BOTH)
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
labelFrame = Frame(root,bg='black')
labelFrame.place(relx=0.1,rely=0.4,relwidth=0.8,relheight=0.4)
# Book ID
lb1 = Label(labelFrame,text="Username : ", bg='black', fg='white')
lb1.place(relx=0.05,rely=0.2, relheight=0.08)
billInfo1 = Entry(labelFrame)
billInfo1.place(relx=0.3,rely=0.2, relwidth=0.62, relheight=0.08)
# Title
lb2 = Label(labelFrame,text="password : ", bg='black', fg='white')
lb2.place(relx=0.05,rely=0.35, relheight=0.08)
billInfo2 = Entry(labelFrame)
billInfo2.place(relx=0.3,rely=0.35, relwidth=0.62, relheight=0.08)
# Book Author
lb3 = Label(labelFrame,text="branch : ", bg='black', fg='white')
lb3.place(relx=0.05,rely=0.50, relheight=0.08)
billInfo3 = Entry(labelFrame)
billInfo3.place(relx=0.3,rely=0.50, relwidth=0.62, relheight=0.08)
# Book Status
#lb4 = Label(labelFrame,text="Bill amount : ", bg='black', fg='white')
#lb4.place(relx=0.05,rely=0.65, relheight=0.08)
#billInfo4 = Entry(labelFrame)
#billInfo4.place(relx=0.3,rely=0.65, relwidth=0.62, relheight=0.08)
#Submit Button
SubmitBtn = Button(root,text="SUBMIT",bg='#d1ccc0',
fg='black',command=logincreate)
SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)
quitBtn = Button(root,text="Quit",bg='#f7f1e3', fg='black',
command=root.destroy)
quitBtn.place(relx=0.53,rely=0.9, relwidth=0.18,relheight=0.08)
root.mainloop()
deleteacc.py:
from tkinter import *
from PIL import ImageTk,Image
from tkinter import messagebox
import pymysql
# Add your own database name and password here to reflect in the code
mypass = "Rock@981907"
mydatabase="billingsys"
con =
pymysql.connect(host="localhost",user="root",password=mypass,database=mydataba
se)
cur = con.cursor()
def deleteacc():
bid = bookInfo1.get()
print(bid)
bookInfo1.delete(0, END)
root.destroy()
def deleteaccount():
global
bookInfo1,bookInfo2,bookInfo3,bookInfo4,Canvas1,con,cur,bookTable,root
root = Tk()
root.title("Supermarket")
root.minsize(width=400,height=400)
root.geometry("600x500")
Canvas1 = Canvas(root)
Canvas1.config(bg="#006B38")
Canvas1.pack(expand=True,fill=BOTH)
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
labelFrame = Frame(root,bg='black')
labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5)
# Book ID to Delete
lb2 = Label(labelFrame,text="Account username : ", bg='black', fg='white')
lb2.place(relx=0.05,rely=0.5)
bookInfo1 = Entry(labelFrame)
bookInfo1.place(relx=0.3,rely=0.5, relwidth=0.62)
#Submit Button
SubmitBtn = Button(root,text="SUBMIT",bg='#d1ccc0',
fg='black',command=deleteacc)
SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)
root.mainloop()
Python Outputs:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
MySql Outputs:
1.Bill Table
2.Login Table
SYSTEM WORKS OFFLINE
LACK OF IDENTITY
IDENTIFICATIONS
www.google.com
www.geeksforgeek.com