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

Computer Science Project

Uploaded by

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

Computer Science Project

Uploaded by

saapnasinghal27
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

SHIV NADAR SCHOOL

GURUGRAM

COMPUTER SCIENCE
PROJECT

GROCERY MANAGEMENT
SYSTEM

Submitted by:
Kushi Arun Kumar, Kasmya Bhatia

1
COMPUTER SCIENCE
INVESTIGATORY
PROJECT

GROCERY MANAGEMENT
SYSTEM

SUBMITTED BY:
Kushi Arun Kumar, Kasmya Bhatia

Under the guidance of


Mr. Himanshu Arora
(PGT CS)

2
INDEX:

● Certificate 4

● Acknowledgement 5

● Declaration 6

● Introduction to Python 7

● SQL Connectivity 8

● Hardware and Software used 9

● Introduction on project, Modules used 10

● Flowchart 12

● Code 13

● Output and Implementation 27

● Bibliography 30

3
CERTIFICATE

This is to certify that Kasmya Bhatia and Kushi Arun Kumar of Class XII

have prepared the report on a Project entitled “GROCERY

MANAGEMENT SYSTEM”. The report is the result of their efforts and

endeavors. The report is found worthy of acceptance as final project

report for the subject Computer Science of Class XII as prescribed by

CBSE for AISSCE 2022-2023 in Shiv Nadar School, Pahari Road, Sector 26,

DLF City, Phase -1, Block -E, Gurugram, Haryana 122011.

Roll Number: Date:

_____________ _____________

Signature of Signature of

Internal Examiner: External Examiner:

_________________ _________________

4
ACKNOWLEDGEMENT

I would like to express my special thanks of gratitude to my teacher Mr.

Himanshu Arora, PGT(CS) as well as our Principal Ms. Monica Sagar who

gave me the golden opportunity to do this wonderful project on the

topic “Grocery Management System”, which also helped me in doing a

lot of Research and I came to know about so many new things I am really

thankful to them.

Finally, yet importantly, I would like to express my heartfelt thanks to my

beloved parents for their blessings, my friends/classmates for their help

and wishes for the successful completion of this project within the

limited period.

Kushi Arun Kumar,


Kasmya Bhatia

5
DECLARATION

I hereby declare that the project work entitled “GROCERY MANAGEMENT

SYSTEM” submitted to Shiv Nadar School, Gurugram for the subject

Computer Science under the guidance of Mr. Himanshu Arora, PGT(CS) is

a record of original work done by me.

I further declare that this project or any part of it has not been

submitted elsewhere for any other class.

Class:

Place:

Date:

6
INTRODUCTION TO PYTHON

Python is an interpreted, high level, general purpose programming language


which was created by Guido van Rossum and first released in 1991. Python
has a design philosophy that emphasizes code readability. It provides
constructs that enable clear programming on both small and large scales.
Van Rossum led the language community until stepping down as leader in
July 2018.

Python features Dynamic Typing system and automatic memory


management. It supports multiple programming paradigms, including object
oriented, imperative, functional and procedural and has a large and
comprehensive standard library and has various other libraries that can be
downloaded externally.
Python interpreters are available for various operating systems. CPython, the
reference implementation of Python, is an open source software and has a
community based development model, as do nearly all of Python’s other
implementations. Python and CPython are managed by the non-profit
Python Software Foundation. One can also use other implementations like
Spyder IDE or Python IDLE.

7
SQL CONNECTIVITY:

SQL stands for Structured Query Language. SQL databases store collections
of information that is organised in the form of tables and can be easily
accessed, managed and updated. MySQL is a free-to-use, open-source
database that facilitates efficient management of databases by connecting
them to the software of python.

Connectivity of SQL to python can be of a high advantage to us due to the


following factors. Storing data using SQL can reduce chances of data
redundancy and inconsistency, sharing of data can also be easily facilitated
while integrity of data being maintained.

8
HARDWARE AND SOFTWARE USED:

HARDWARE REQUIREMENTS:

Processer AMD Ryzen 4000 SERIES


RAM 4GB
Hard Disk Drive 500GB
Monitor 18.5 LED monitor
Mouse Logitech
Keyboard 104 Keys Keyboard
Port USB Port

SOFTWARE REQUIREMENTS:

Operating System Windows 10


Front End Tool Python
Report tool Data Report/Microsoft Word

9
INTRODUCTION TO PROJECT:

The purpose of the Grocery Shop Management System is to automate the


existing manual system by using computerized software and equipment. The
motive is to fulfill requirements of a grocery store by enabling storage of
valuable data for a longer period of time and making it easily manageable,
accessible and . Grocery Shop Management System can also lead to an error
free, secure, reliable and fast way of management. As it can assist the user
to concentrate on other activities rather than concentrating on record
keeping. Thus it can help organizations in better utilization of resources such
as time.

MODULES USED:
1. Product module:
All the details regarding the products that are being sold in the store
will be stored on a database in an organized manner to make this kind
of information accessible and comprehensible. These details may
include their price, manufacturer, product ID, category, quantity and so
on. Every time a sale is made, the system registers this information and
stores it which will help the system track the product quantity (sold
and left), the customer details, the profit made and the loss
experienced from this sale, and many more.

2. Stock management module:


The system is equipped to manage the stock and the inventory of the
store, details regarding the products and their quantity (as mentioned
above) at a given time will be stored on a database and when a

10
product quantity reaches a certain limit, it will notify the user to
restock and order it again.

3. Financial management module:


The system will also provide a detailed analysis of the profit, loss and
total revenue of the store on a monthly basis. Along with that, it will
provide a helpful evaluation on the customer demand based on
information of the categories and the quantities of the particular
products sold in a given period of time which will allow the user to
invest smartly, and will allow them to maximize their profits by
targeting these customer expectations and desires.

4. Customer and Supplier module:


The system will store necessary information and details regarding the
customers who are buying from the store and the suppliers who
provide the business with the products. This will ease communication
and make the process painless and more efficient. Moreover, it will
enable the user to target customers through email/sms advertising
and marketing and will ultimately help increase sales.

5. Login and system users module:


This module will handle information regarding the login details and the
different users of the system. A portal by which the user, and only the
registered user, can login where and when required.

11
FLOWCHART:

12
Code
#creating functions for different tasks

● FUNCTION1: TO ADD A RECORD TO THE TABLE 'ITEM' ON THE


DATABASE 'INVENTORYMANAGE'

In the following code, Connection between the MySQL database and Python
is made using the connect() function from the mysql.connector module.
Information such as database details like HostName, username, and the
password is passed. The connection object is returned. Input from the user is
taken in order to store in the form of records.

Code:

def addrec():
import mysql.connector
db=mysql.connector.connect(host="localhost", user="root",
passwd="kushi1012", database="inventorymanage")
c=db.cursor()
name=input("Enter item name: ")
p=input("Enter mrp of item: ")
id1=input("Enter item id: ")
lrd=input("Enter item last restocking date: yyyy-mm-dd:")
q=input("Enter quantity of item as per last restocking date: ")
str1="("+id1+","+"'"+name+"'"+","+p+","+q+","+"'"+lrd+"'"+");"
c.execute("insert into item values"+str1)
db.commit()
print ("Record added")

13
● CREATING TABLE USING ‘INVENTORYMANAGE’ DATABASE

The table named item is created in order to store the records.

Here the schema of the table item is displayed using desc query.

14
Output & Implementation:
The following input data is added in a record as a result of running the above
written code.

15
16
By using the select query, the stored information can be viewed in the table
item.

17
● FUNCTION2: TO UPDATE A RECORD ACCORDING TO THE ID INPUT BY
THE USER

Code:

def updaterec():
print(" ")

print("ID**********NAME**********PRICE**********QUANTITY*******
***LASTDATE_OF_RESTOCKING**********")
import mysql.connector
db=mysql.connector.connect(host="localhost", user="root",
passwd="kushi1012", database="inventorymanage")
c=db.cursor()
c.execute("Select * from item;")
rows=c.fetchall()
for i in rows:
for m in i:
print(m,end='**********')
print ()
print (" ")

18
● OPTIONS TO CHOOSE THE FIELD/ATTRIBUTE TO EDIT

As per user’s requirement edits can be made to the previous information


stored in a record. The user is needed to choose a valid option from the
following. Information is updated according to the selected option entered
by the user as input. If, elif and else commands are used for decision making.

Code:

toedit=input("Enter item ID of record to edit: ")


print ("a-to edit name")
print ("b-to edit price")
print ("c-to edit item id")
print ("d-to edit last restocking date")
print ("e-to edit stock quantity")
z=input("Enter a-e: ")
if z=='a':
n=input("enter new name:")
str1=("update item set Name='"+n+"' where ID="+toedit+";")
c.execute(str1)
print ("Record updated")
db.commit()
elif z=='b':
n=input("enter new price:")
str1=("update item set Product_price="+n+"where ID="+toedit+";")
c.execute(str1)
print ("Record updated")
db.commit()
elif z=='c':
n=input("enter new ID:")

19
str1=("update item set ID="+n+"where ID="+toedit+";")
c.execute(str1)
print ("Record updated")
db.commit()
elif z=='d':
n=input("enter new last restocking date (yyyy-mm-dd):")
str1=("update item set Last_restocking_date='"+n+"' where
ID="+toedit+";")
c.execute(str1)
print ("Record updated")
db.commit()
elif z=='e':
n=input("enter new quantity:")
str1=("update item set Quantity="+n+"where ID="+toedit+";")
c.execute(str1)
print ("Record updated")
db.commit()

20
● FUNCTION3: TO DELETE A RECORD FROM THE TABLE

According to the item id entered by the user in the form of input, the record
will be found. The selected record corresponding to the entered item id
would be deleted.

21
Code:

def delrec():
print(" ")

print("ID**********NAME**********PRICE**********QUANTITY*******
***LASTDATE_OF_RESTOCKING**********")
import mysql.connector
db=mysql.connector.connect(host="localhost", user="root",
passwd="kushi1012", database="inventorymanage")
c=db.cursor()
c.execute("Select * from item;")
rows=c.fetchall()
for i in rows:
for m in i:
print(m,end='**********')
print ()
print(" ")
todel=input("Enter item ID of record to delete: ")
str1=("delete from item where ID="+todel+";")
c.execute(str1)
print ("Record deleted")
db.commit()

22
● FUNCTION4: TO SHOW ALL THE RECORDS

Code:

def showallrecs():
print(" ")

print("ID**********NAME**********PRICE**********QUANTITY*******
***LASTDATE_OF_RESTOCKING**********")
import mysql.connector
db=mysql.connector.connect(host="localhost", user="root",
passwd="kushi1012", database="inventorymanage")
c=db.cursor()
c.execute("Select * from item;")
rows=c.fetchall()
for i in rows:
for m in i:
print(m,end='**********')
print ()
print(" ")

23
● MENU-DRIVEN CODE WITH LOOP TO SHOW AND PERFORM
DIFFERENT TASKS

Code:

choice=1

while choice!=0:
print ("************************************")
print ("1-Add an item")
print ("2-Remove an item")
print ("3-Edit specefics of an item")
print ("4-Show all items")
print ("5-Help: See all commands again")
print ("0-Quit")
print ("************************************")
choice=int(input("Enter your choice: "))

if choice==1:
addrec()
elif choice==2:

24
delrec()
elif choice==3:
updaterec()
elif choice==4:
showallrecs()
elif choice==5:
while choice!=0:
print ("1-Add an item")
print ("2-Remove an item")
print ("3-Edit specefics of an item")
print ("4-Show all items")
print ("5-Help: See all commands again")
print ("0-Quit")
choice=int(input("Enter your choice: "))
elif choice==0:
choice=0

25
26
Output & Implementation
Option 3 is selected by the user. According to the item id the corresponding
record is selected. As the user has selected option a the edited name is
entered by the user and the record is updated.

Option 4 is selected by the user. Hence, all items and information regarding
those items is displayed.

27
Option 2 is selected by the user. According to the item id entered by the
user, the record corresponding to that item id is deleted.

Using the select query it can be inferred that the record is deleted from the
table item.

28
Lastly if Option 0 is selected the code stops running.

29
Bibliography

● Computer science with python - Sumita Arora class XI


● Computer science with python - Preeti Arora class XII
● www.tutorial.com
● www.w3school.com

30

You might also like