0% found this document useful (0 votes)
112 views17 pages

Supermarket Management System

Uploaded by

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

Supermarket Management System

Uploaded by

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

INDEX

S.NO DESCRIPTION Page.no


1 Introduction 2
2 FEASIBILITY 3
STUDY
3 Objectives 4
4 Proposed 4
System
5 System Design 4
6 Error Handling 5
7 System 6
Architecture
8 Requirements 7
9 Source code 8

10 output 15

11 Bibliography 16

P a g e 1 | 17
Supermarket
Management System

1.Introduction:
The Supermarket Management System is a software
application designed to manage the daily operations of a
supermarket. The system aims to provide an efficient and
organized way to manage products, customers, and sales. The
system will allow users to add, update, and delete products,
customers, and sales records, as well as view inventory and
sales reports.
Project Overview
The Supermarket Management System is a Python-based
application that utilizes a MySQL database to store and manage
data. The system will provide a user-friendly interface for
supermarket staff to perform various tasks, including:
 Managing inventory and stock levels
 Processing sales and transactions
 Managing customer information and loyalty programs
 Generating reports and analytics
Target Audience
The target audience for the Supermarket Management
System includes:
 Supermarket owners and managers
 Store staff and employees
 Customers and loyalty program members

P a g e 2 | 17
Project Scope
The scope of the Supermarket Management System includes:
 Designing and developing the software application
 Implementing the MySQL database
 Testing and quality assurance
 Deployment and maintenance

2.FEASIBILITY STUDY:

1.Economic Feasibility:
The economic feasibility of the Supermarket Management
System is also high. The system will provide a range of
benefits, including:
1. Improved efficiency: The system will automate many of
the manual processes, reducing the need for manual labor
and improving efficiency.
2. Increased accuracy: The system will reduce the risk of
human error, improving the accuracy of the data and the
overall quality of the service.
3. Cost savings: The system will reduce the need for paper-
based records and manual data entry, reducing costs and
improving profitability.
4. Improved customer service: The system will provide a
range of features that will improve the customer
experience, including online ordering and payment.

2.Technical Feasibility:

P a g e 3 | 17
The technical feasibility of the Supermarket Management
System is high. The system can be developed using a
range of technologies, including Python, MySQL, and HTML/CSS.
The system will require a robust database management
system to store and manage the data, and a user-friendly
interface to interact with the system.

3.Objectives:
 To design and develop a user-friendly supermarket
management system
 To provide an efficient way to manage products,
customers, and sales
 To generate reports on inventory and sales
 To improve the overall management of the supermarket

4.Proposed System:
The proposed system is a Python-based application that
uses the MySQL database management system to store data.
The system consists of the following modules:
 Product Management: allows users to add, update, and
delete products
 Customer Management: allows users to add, update, and
delete customers
 Sales Management : allows users to record sales and view
sales reports
 Inventory Management : allows users to view inventory
reports

5.System Design:
P a g e 4 | 17
The system design consists of the following
components:

Database Design:
 Products table: product_id, product_name,
product_description, price, quantity
 Customers table: customer_id, customer_name,
customer_address, customer_phone
 Sales table: sale_id, product_id, quantity_sold
 Entity-Relationship Model: The database design is
based on the entity-relationship model, where each
table represents an entity (e.g., products, sales,
customers) and the relationships between them are
established through foreign keys.
 Normalization: The database design follows the
principles of normalization, which ensures that each
piece of data is stored in one place and one place
only, reducing data redundancy and improving data
integrity.

6.Error Handling Mechanisms


There are several error handling mechanisms that
can be used to catch and handle exceptions,
including:
1. Try-Except Blocks: These blocks are used to catch
and handle exceptions that occur during the
execution of the code.
2. Error Handling Functions: These functions are used
to handle errors that occur during the execution of
the code, such as logging errors or sending error
messages.

P a g e 5 | 17
3. Error Codes: These codes are used to identify
specific errors that occur during the execution of
the code.
4. Error Messages: These messages are used to inform
the user of any errors that occur during the
execution of the code.
Error Messages
Error messages are used to inform the user of any
errors that occur during the execution of the code.
There are several types of error messages,
including:
1. Error Codes: These codes are used to identify
specific errors that occur during the execution of
the code.
2. Error Descriptions: These descriptions are used to
provide a detailed explanation of the error that
occurred.
3. Error Solutions: These solutions are used to provide
a solution to the error that occurred.
Error Logging
Error logging is the process of recording errors that
occur during the execution of the code. There are
several types of error logging, including:
1. Error Log Files: These files are used to record errors
that occur during the execution of the code.
2. Error Databases: These databases are used to
record errors that occur during the execution of the
code.
3. Error Reporting Tools: These tools are used to
report errors that occur during the execution of the
code.
Common Error Handling Mistakes
P a g e 6 | 17
There are several common error handling mistakes,
including:
1. Not Catching Exceptions: Not catching exceptions
can cause the system to crash or produce
unexpected results.
2. Not Providing Detailed Error Messages: Not
providing detailed error messages can make it
difficult for the user to understand the error that
occurred.
3. Not Logging Errors: Not logging errors can make it
difficult to track and analyze errors that occur
during system operation.
4. Not Testing Error Handling: Not testing error
handling can cause errors to occur during system
operation.

7.System Architecture:
 The system uses a Python script to interact with the
MySQL database
 The system uses a command-line interface to
interact with the user

8.Requirements:
 Python 3.x
 MySQL Connector/Python
 MySQL database management system
 Windows 10 or 11

9.Source Code:
SQL CODE :
P a g e 7 | 17
CREATE TABLE products (

product_id INT AUTO_INCREMENT,

product_name VARCHAR(255),

product_description VARCHAR(255),

price DECIMAL(10, 2),

quantity INT,

PRIMARY KEY (product_id)

);

CREATE TABLE sales (

sale_id INT AUTO_INCREMENT,

product_id INT,

quantity_sold INT,

PRIMARY KEY (sale_id),

FOREIGN KEY (product_id) REFERENCES products(product_id)

);

CREATE TABLE customers (

customer_id INT AUTO_INCREMENT,

customer_name VARCHAR(255),

customer_address VARCHAR(255),

customer_phone VARCHAR(255),

PRIMARY KEY (customer_id)

);

PYTHON CODE :

P a g e 8 | 17
import mysql.connector

class SupermarketManagementSystem:

def __init__(self):

self.cnx = mysql.connector.connect(

user=input("Enter username: "),

password=input("Enter password: "),

host="localhost",

database="supermarket"

self.cursor = self.cnx.cursor()

def execute_query(self, query, params):

try:

self.cursor.execute(query, params)

self.cnx.commit()

except mysql.connector.Error as err:

print("Error: {}".format(err))

def add_product(self):

product_name = input("Enter product name: ")

product_description = input("Enter product description: ")

while True:

try:

price = float(input("Enter price: "))

break

except ValueError:

print("Invalid price. Please enter a valid number.")

P a g e 9 | 17
while True:

try:

quantity = int(input("Enter quantity: "))

break

except ValueError:

print("Invalid quantity. Please enter a valid number.")

query = "INSERT INTO products (product_name, product_description, price, quantity) VALUES


(%s, %s, %s, %s)"

self.execute_query(query, (product_name, product_description, price, quantity))

def update_product(self):

while True:

try:

product_id = int(input("Enter product ID: "))

break

except ValueError:

print("Invalid product ID. Please enter a valid number.")

while True:

try:

quantity = int(input("Enter new quantity: "))

break

except ValueError:

print("Invalid quantity. Please enter a valid number.")

query = "UPDATE products SET quantity = %s WHERE product_id = %s"

self.execute_query(query, (quantity, product_id))

P a g e 10 | 17
def delete_product(self):

while True:

try:

product_id = int(input("Enter product ID: "))

break

except ValueError:

print("Invalid product ID. Please enter a valid number.")

query = "DELETE FROM products WHERE product_id = %s"

self.execute_query(query, (product_id,))

def view_inventory(self):

try:

query = "SELECT * FROM products"

self.cursor.execute(query)

result = self.cursor.fetchall()

for row in result:

print(f"Product ID: {row[0]}, Name: {row[1]}, Description: {row[2]}, Price: {row[3]}, Quantity:
{row[4]}")

except mysql.connector.Error as err:

print("Error: {}".format(err))

def record_sale(self):

while True:

try:

product_id = int(input("Enter product ID: "))

break

except ValueError:
P a g e 11 | 17
print("Invalid product ID. Please enter a valid number.")

while True:

try:

quantity_sold = int(input("Enter quantity sold: "))

break

except ValueError:

print("Invalid quantity sold. Please enter a valid number.")

query = "INSERT INTO sales (product_id, quantity_sold) VALUES (%s, %s)"

self.execute_query(query, (product_id, quantity_sold))

def view_sales_report(self):

try:

query = "SELECT * FROM sales"

self.cursor.execute(query)

result = self.cursor.fetchall()

for row in result:

print(f"Sale ID: {row[0]}, Product ID: {row[1]}, Quantity Sold: {row[2]}")

except mysql.connector.Error as err:

print("Error: {}".format(err))

def add_customer(self):

customer_name = input("Enter customer name: ")

customer_address = input("Enter customer address: ")

customer_phone = input("Enter customer phone: ")

query = "INSERT INTO customers (customer_name, customer_address, customer_phone)


VALUES (%s, %s, %s)"
P a g e 12 | 17
self.execute_query(query, (customer_name, customer_address, customer_phone))

def update_customer(self):

while True:

try:

customer_id = int(input("Enter customer ID: "))

break

except ValueError:

print("Invalid customer ID. Please enter a valid number.")

customer_name = input("Enter new customer name: ")

customer_address = input("Enter new customer address: ")

customer_phone = input("Enter new customer phone: ")

query = "UPDATE customers SET customer_name = %s, customer_address = %s,


customer_phone = %s WHERE customer_id = %s"

self.execute_query(query, (customer_name, customer_address, customer_phone,


customer_id))

def delete_customer(self):

while True:

try:

customer_id = int(input("Enter customer ID: "))

break

except ValueError:

print("Invalid customer ID. Please enter a valid number.")

query = "DELETE FROM customers WHERE customer_id = %s"

self.execute_query(query, (customer_id,))

P a g e 13 | 17
def view_customers(self):

try:

query = "SELECT * FROM customers"

self.cursor.execute(query)

result = self.cursor.fetchall()

for row in result:

print(f"Customer ID: {row[0]}, Name: {row[1]}, Address: {row[2]}, Phone: {row[3]}")

except mysql.connector.Error as err:

print("Error: {}".format(err))

def main():

system = SupermarketManagementSystem()

while True:

print("1. Add Product")

print("2. Update Product")

print("3. Delete Product")

print("4. View Inventory")

print("5. Record Sale")

print("6. View Sales Report")

print("7. Add Customer")

print("8. Update Customer")

print("9. Delete Customer")

print("10. View Customers")

print("11. Exit")

choice = input("Enter your choice: ")

if choice == "1":

P a g e 14 | 17
system.add_product()

elif choice == "2":

system.update_product()

elif choice == "3":

system.delete_product()

elif choice == "4":

system.view_inventory()

elif choice == "5":

system.record_sale()

elif choice == "6":

system.view_sales_report()

elif choice == "7":

system.add_customer()

elif choice == "8":

system.update_customer()

elif choice == "9":

system.delete_customer()

elif choice == "10":

system.view_customers()

elif choice == "11":

break

else:

print("Invalid choice. Please try again.")

if __name__ == "__main__":

main()

10.Output :
P a g e 15 | 17
1. Add Product

2. Update Product

3. Delete Product

4. View Inventory

5. Record Sale

6. View Sales Report

7. Add Customer

8. Update Customer

9. Delete Customer

10. View Customers

11. Exit

Enter your choice:

11.Bibliography:
 Computer science book -class 12 &11
 Google
 https://www.geeksforgeeks.org

P a g e 16 | 17
P a g e 17 | 17

You might also like