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

CS Project File

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

CS Project File

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

IntroductIon

The GroceryShopManagementSystem is designed to simplify and automate key shop operations,


including inventory management, sales tracking, and billing. Developed using Python and MySQL, it
ensures secure and efficient data handling, providing accurate and up-to-date records. The system
helps manage product details, stock levels, and customer transactions with ease, reducing manual
effort and minimizing errors. By streamlining these processes, it enhances the overall efficiency of
the shop, making it a reliable and essential tool for day-to-day management.
Software requIrementS

1. Operating System

• Windows 10/11, macOS, or Linux

2. Python Installation

• Python Version: Python 3.7 or higher

3. MySQL Database

• MySQL Server: Install the latest version of MySQL Community


Server
• Workbench (Optional): MySQL Workbench GUI tool
• Default Port: MySQL uses port 3306 by default

4. MySQL Connector for Python

• Library: mysql-connector-python library.

SyStem requIrementS

• Processor: Minimum Dual-Core (64-bit architecture recommended).


• RAM: 4 GB (8 GB or more recommended for database-heavy tasks).
• Storage: 500 MB to 1 GB for MySQL and Python installations.
Source code

import pymysql as sql s try:


conn = sql.connect(host='localhost', user='root',
password='Class@12', database='grocery_shop')
if conn.open:
print('Successfully connected to the database')
except sql.MySQLError as e: print(f"Error: {e}") conn = None
# Ensure conn is defined even in error cases

if conn: c =
conn.cursor()

print('Grocery Shop Management System')


print('1. Login') print('2. Exit') choice
= int(input('Enter your choice: '))

if choice == 1:
user_name = input('Enter your username: ')
password = input('Enter your password: ')

if user_name == 'root' and password == 'Class@12':


print('Connected successfully')
print("=" * 100) print('STOP &
SHOP Grocery Shop') print("=" *
100)

while True:
print('1. Customer details')
print('2. Product details')
print('3. Worker details')
print('4. See all customer
details') print('5. See all product
details') print('6. See all worker
details') print('7. See one
customer detail') print('8. See one
product detail') print('9. See one
worker detail') print('10. Stocks')
print('12. Exit')

choice = int(input('Enter your choice: '))

if choice == 1:
cust_name = input('Enter your name: ') phone_no =
int(input('Enter your phone number: ')) cost =
float(input('Enter your Bill Amount: '))
sql_insert = "INSERT INTO customer_details VALUES
(%s, %s, %s)"
c.execute(sql_insert, (phone_no, cust_name, cost))
conn.commit() print('Data is updated
successfully!')

elif choice == 2:
product_name = input('Enter product name: ')
product_cost = float(input('Enter the MRP: '))
sql_insert = "INSERT INTO product_details VALUES
(%s, %s)"
c.execute(sql_insert, (product_name, product_cost))
conn.commit() print('Data is updated
successfully!')
elif choice == 3:
worker_name = input('Enter your name: ')
worker_work = input('Enter your work: ') worker_age
= int(input('Enter your age: ')) worker_salary =
float(input('Enter your salary: ')) phone_no =
int(input('Enter your phone number: ')) sql_insert
= "INSERT INTO worker_details VALUES
(%s, %s, %s, %s, %s)"
c.execute(sql_insert, (worker_name, worker_work,
worker_age, worker_salary, phone_no))
conn.commit() print('Data is updated
successfully!')

elif choice == 4: t =
conn.cursor()
t.execute('SELECT * FROM customer_details')
records = t.fetchall() for record in
records:
print(record)

elif choice == 5: t =
conn.cursor()
t.execute('SELECT * FROM product_details')
records = t.fetchall() for record in
records:
print(record)

elif choice == 6: t =
conn.cursor()
t.execute('SELECT * FROM worker_details')
records = t.fetchall() for record in
records: print(record)
elif choice == 7:
a = input('Enter the customer name: ') t
= "SELECT * FROM customer_details WHERE
cust_name = %s"
c.execute(t, (a,))
v = c.fetchall()
for record in v:
print(record)

elif choice == 8:
a = input('Enter product name: ') t =
"SELECT * FROM product_details WHERE
product_name = %s"
c.execute(t, (a,))
v = c.fetchall()
for record in v:
print(record)

elif choice == 9:
a = input('Enter the worker name: ') t
= "SELECT * FROM worker_details WHERE
worker_name = %s"
c.execute(t, (a,))
v = c.fetchall()
for record in v:
print(record)

elif choice == 10: t


= conn.cursor()
t.execute('SELECT * FROM stocks')
records = t.fetchall() for record
in records:
print(record)

elif choice == 12:


print('Exiting...')
break

else: print('Invalid choice, please try


again.')

else: print('Wrong username or password, try


again.')

elif choice == 2:
print('Exiting...')
else: print('Invalid choice. Please enter 1 or
2.')

conn.close()
else:
print("Failed to connect. Please check your database settings.")
outPutS
User authentication:-

Main Menu:-

Adding Custommer Details:-


Adding Product Details:-

Adding Worker Details:-


Viewing all customer details:-

Viewing all product details:-

Viewing all worker details:-

View only one Custommer details:-

Viewing only one product details:-

Viewing only one worker details:-


Exit:-

tableS

You might also like