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

Project_file cs

The document outlines a project on a Cloth Store Management System developed by Ritvik Mahajan for the academic year 2024-25. It includes acknowledgments, a certificate of authenticity, an index, and detailed sections on the introduction, aims, future prospects, database schemas, source code, and outputs. The project aims to streamline the management of employee and client data, inventory, and sales for cloth retailers.

Uploaded by

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

Project_file cs

The document outlines a project on a Cloth Store Management System developed by Ritvik Mahajan for the academic year 2024-25. It includes acknowledgments, a certificate of authenticity, an index, and detailed sections on the introduction, aims, future prospects, database schemas, source code, and outputs. The project aims to streamline the management of employee and client data, inventory, and sales for cloth retailers.

Uploaded by

walk master
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 54

PROJECT FILE

COMPUTER SCIENCE
CLOTH STORE MANAGEMENT
SYSTEM
SESSION 2024-25

NAME: Ritvik Mahajan


CLASS: XII-C
SCHOOL: MAXFORT SCHOOL DWARKA, NEW
DELHI
BOARD ROLL NO:

1|Page
Acknowledgement

I wish to express my great gratitude and sincere thanks to the HoS,


Ms. Dipika Sharma for her encouragement and all the facilities which
were provided to complete the project. I sincerely appreciate her
efforts for taking me into her fold for which I shall remain forever in
debt.

I extend my heartiest thanks to Ms. Bhumika Dwivedi, our Computer


Science teacher, who guided me towards the successful completion
of this project. I take this opportunity to express my sincere gratitude
for her immense guidance constant encouragement and motivation
which has sustained my efforts at all stages of this project.

I can't forget to offer my sincere thanks to my parents, team-mates


and friends who help me carry out this project successfully.

2|Page
Certificate

Name: Ritvik Mahajan Class: XII – C


Roll No:

This is certified to be the bonafide work of the student in


the Computer Science Project during the academic year
2024 – 2025 .

Signature of Teacher

Signature of Examiner Signature of HoS

Date:

3|Page
Index

Page
S.no Description
numbers
5
01 Introduction & Aim

02 Future prospect 6

03 Database 7-9

04 Schemas 10-11

12-43
05 Source code

06 Output 44-48

07 Bibliography 49

4|Page
INTRODUCTION

The "Cloth-Store management system" has


been designed with the intention to efficiently
handle employee and client data, as well as
inventory and sales in the store.

AIM
With the help of our assigned advanced system,
which can efficiently handle and manipulate
employee and customer databases as well as
other things collectively, our project aims to
assist the managers and administrators of cloth
stores in carrying out all internal operations
successfully. This will make it easier for the
cloth retailers to manage data efficiently.

5|Page
FUTURE PROSPECT
1) Upgrade to a user-friendly and visually
appealing interface with modern web technologies
(e.g., React, Angular).

2) Robust Authentication: Implement strong


password hashing and multi-factor
authentication.

3) Data Encryption: Encrypt sensitive data like


customer information and financial records.
4) Functionality:
 Advanced Inventory Management:
Incorporate features like barcode scanning,
automated reorder points, and real-time
inventory tracking.
 Customer Relationship Management
(CRM): Build customer profiles, track
purchase history, and personalize offers.
 Employee Management: Manage employee
schedules, payroll, and performance metrics.

6|Page
DATABASE

1) Database:

create database clothesmanagement;

2) Use Database:

Use clothesmanagement;

3) Customers Table
CREATE TABLE customers (

cust_ID int NOT NULL,

cust_FirstName varchar(10) NOT NULL,

cust_LastName varchar(10) NOT NULL,

cust_phoneno_ bigint NOT NULL,

cust_address varchar(30) NOT NULL,

cust_email varchar(40) DEFAULT

NULL, membership char(4) DEFAULT

NULL
);

7|Page
4) Employees Table
CREATE TABLE employees

( Emp_ID char(4) NOT

NULL,

EmpName varchar(10) DEFAULT

NULL, DOB date DEFAULT NULL,


DOJ date DEFAULT NULL,

Designation varchar(20) DEFAULT

NULL, Salary bigint DEFAULT NULL

);

5) Inventory Table

CREATE TABLE inventory (

cloth_ID varchar(10) NOT NULL,

cloth_name varchar(10) DEFAULT NULL,

cloth_price bigint NOT NULL,

Quantity int DEFAULT NULL,

manufacturingdate date DEFAULT NULL,

clothType varchar(6) DEFAULT NULL,

cloth_colour varchar(10) DEFAULT

NULL
);
8|Page
6) Sales Table

CREATE TABLE sales (


InvoiceNo int NOT NULL,
cloth_ID varchar(10) DEFAULT NULL,
cust_ID int DEFAULT NULL,
SaleDate date DEFAULT NULL, PaymentMode
varchar(10) DEFAULT NULL, Emp_ID char(4)
DEFAULT NULL,
SalePrice bigint DEFAULT NULL
);

9|Page
SCHEMAS

1) Customers

2) Employees

10 | P a g e
3) Inventory

4) Sales

11 | P a g e
SOURCE CODE

import time
import datetime
import mysql.connector as mysql
from mysql.connector import errorcode
import sys

con = mysql.connect(host='localhost', user='root',


password='pass123', database='clothesmanagement')
cursor = con.cursor()
dic_tables = { 1: 'customers', 2: 'employees', 3:
'inventory', 4: 'sales'}

def main():
"""
This function serves as the entry point for the program.
It typically contains the main logic and orchestrates the
flow of the program.
"""
while True:
try:
print("*"*50)
choice2 = int(input("Please enter your choice from
the above options: "))
print("*"*50)
except Exception:

12 | P a g e
print("Invalid Input. Please enter only
numeric value(1-6)")
else:
break

if choice2 == 1:
fetch_data()
elif choice2 == 2:
update_data()
fetch_data()
elif choice2 == 3:
PK = f'SELECT COLUMN_NAME FROM
INFORMATION_SCHEMA.COLUMNS WHERE
TABLE_SCHEMA = "clothesmanagement" AND
TABLE_NAME = "{dic_tables[choice1]}" AND
COLUMN_KEY = "PRI"'
cursor.execute(PK)
PK_name = cursor.fetchall()
if choice1 == 1:
print("""1) Retrieve using customer ID
2) Retrieve using Phone Number""")
while True:
try:
choice4 = int(input("Please enter
your choice(1-2): "))
if choice4 != 1 and choice4 != 2:
print("Invalid Input. Please select from
the
above options.")

13 | P a g e
else:

14 | P a g e
break
except Exception:
print("Please enter only numeric value(1-2).")
if choice4 == 1:
PK = f'SELECT COLUMN_NAME FROM
INFORMATION_SCHEMA.COLUMNS WHERE
TABLE_SCHEMA = "clothesmanagement" AND
TABLE_NAME = "{dic_tables[choice1]}" AND
COLUMN_KEY = "PRI"'
cursor.execute(PK)
PK_name = cursor.fetchall()
PK_value = int(input(f"Please enter the
{PK_name[0][0]} from which you want to get data: "))
query10 = f'SELECT * FROM {dic_tables[choice1]}
WHERE {PK_name[0][0]} = {PK_value}'
cursor.execute(query10)
fetched_data = cursor.fetchall()
if fetched_data:
for row in fetched_data:
for i in range(len(cursor.description)):
print(cursor.description[i][0] + ": " +
str(row[i]))
elif choice4 == 2:
query_PhoneNos = 'select cust_phoneno_ from
customers'
cursor.execute(query_PhoneNos)
PhoneNos = cursor.fetchall()
while True:
try:

15 | P a g e
cust_phone_no = int(input("Please enter the
customer's phone number: "))
if len(str(cust_phone_no)) != 10:
print("Please enter only 10 digit phone
number."
) else:
break
except Exception:
print("Please enter only numeric value.")
for phone_no in PhoneNos:
if phone_no[0] == cust_phone_no:
query_fetch = f'select * from customers
where cust_phoneno_ = {cust_phone_no}'
cursor.execute(query_fetch)
fetched_data = cursor.fetchall()
if fetched_data:
for row in fetched_data:
for i in range(len(cursor.description)):
print(cursor.description[i][0] + ": " +
str(row[i]))
else:
print(f"No data found for the provided
{PK_name[0][0]}.")
elif choice1 == 2:
PK_value = input(f"Please enter the
{PK_name[0][0]} from which you want to get data: ")
query10 = f'SELECT * FROM {dic_tables[choice1]}
WHERE {PK_name[0][0]} = "{PK_value}"'
cursor.execute(query10)

16 | P a g e
fetched_data = cursor.fetchall()
if fetched_data:
for row in fetched_data:
for i in range(len(cursor.description)):
print(cursor.description[i][0] + ": " +
str(row[i]))
else:
print(f"No data found for the provided
{PK_name[0][0]}.")
elif choice1 == 3:
PK_value = input(f"Please enter the
{PK_name[0][0]} from which you want to get data: ")
query10 = f'SELECT * FROM {dic_tables[choice1]}
WHERE {PK_name[0][0]} =
"{PK_value}"'
cursor.execute(query10)
fetched_data = cursor.fetchall()
if fetched_data:
for row in fetched_data:
for i in range(len(cursor.description)):
print(cursor.description[i][0] + ": " +
str(row[i]))
else:
print(f"No data found for the provided
{PK_name[0][0]}.")
elif choice1 == 4:
PK_value = int(input(f"Please enter the
{PK_name[0][0]} from which you want to get data: "))
query10 = f'SELECT * FROM {dic_tables[choice1]}

17 | P a g e
WHERE {PK_name[0][0]} = {PK_value}'

18 | P a g e
cursor.execute(query10)
fetched_data = cursor.fetchall()
if fetched_data:
for row in fetched_data:
for i in range(len(cursor.description)):
print(cursor.description[i][0] + ": " +
str(row[i]))
else:
print(f"No data found for the provided
{PK_name[0][0]}.")
elif choice2 ==
4: if choice1
== 1:
def newCustomer():
sql = ""
Info = ()
sql="Insert into customers values(%s,%s,%s,
%s,%s,%s,%s)"
Info=(cust_ID,cust_FirstName,cust_LastName,
cust_phoneno_,cust_address,cust_email,ch)
cursor.execute(sql,Info)
con.commit()
query11 = 'select cust_ID from customers'
cursor.execute(query11)
cust_IDS = cursor.fetchall()
while True:
cust_ID = int(input("Enter customer id:
")) for cust_iD in cust_IDS:
if cust_ID == cust_iD[0]:

19 | P a g e
print("Customer ID already exists. Please
enter a different customer ID.")
break
else:
break
cust_FirstName=input('Enter customers first
name:
') cust_LastName=input('Enter customers Last

name: while True:


') cust_phoneno_=int(input('Enter customer
phone no: '))
if len(str(cust_phoneno_)) == 10:
break
else:
print("Please enter only 10 digit number.")
cust_address=input('Enter customer address: ')
cust_email=input('Enter customer email id: ')
while True:
ch = input("Is membership required\n1:Yes\
n2:No: ").lower()
if ch == 'yes' or ch == 'no':
break
else:
print("Invalid Input. pls enter only string
value(Yes or no).")
newCustomer()
print('New Customer Added successfully!')
else:

20 | P a g e
try:
data_tuple = []
query4 = f"SELECT COLUMN_NAME FROM
INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME
= '{dic_tables[choice1]}' AND TABLE_SCHEMA =
'clothesmanagement' ORDER BY ORDINAL_POSITION"
cursor.execute(query4)
result = cursor.fetchall()
for col_name in result:
col_value = input(f"Please enter the new
{col_name[0]}: ")
data_tuple.append(col_value)
placeholders = ', '.join(['%s'] * len(data_tuple))
query7 = f'INSERT INTO VALUES ({placeholders})'
cursor.execute(query7,tuple(data_tuple))
con.commit()
fetch_data()
print("Successfully added new data!")
except Exception:
print("An error occured")
elif choice2 == 5:
PK = f'SELECT COLUMN_NAME FROM
INFORMATION_SCHEMA.COLUMNS WHERE
TABLE_SCHEMA = "clothesmanagement" AND
TABLE_NAME = "{dic_tables[choice1]}" AND
COLUMN_KEY = "PRI"'
cursor.execute(PK)
PK_name = cursor.fetchall()
if choice1 == 1:

21 | P a g e
while True:
query_check1 = 'select cust_ID from
customers'
cursor.execute(query_check1)
cust_ids = cursor.fetchall()
PK_value = int(input(f"Please enter the
{PK_name[0][0]} of the record to delete: "))
for cust_id in cust_ids:
if PK_value == cust_id[0]:
break
else:
print(f"{PK_value} does not exist.")
continue
query_delete = f'DELETE FROM
{dic_tables[choice1]} WHERE {PK_name[0][0]} =
{PK_value}'
cursor.execute(query_delete)
con.commit()
fetch_data()
print(f"Successfully deleted record with
{PK_name[0][0]} = {PK_value}")
break
elif choice1 == 2:
while True:
query_check2 = 'select emp_ID from
employees'
cursor.execute(query_check2)
emp_ids = cursor.fetchall()

22 | P a g e
PK_value = input(f"Please enter the
{PK_name[0][0]} of the record to delete: ")
for emp_id in emp_ids:
if PK_value == emp_id[0]:
break
else:
print(f"{PK_value} does not exist.")
continue
query_delete = f'DELETE FROM
{dic_tables[choice1]} WHERE {PK_name[0][0]} =
"{PK_value}"'
cursor.execute(query_delete)
con.commit()
fetch_data()
print(f"Successfully deleted record with
{PK_name[0][0]} = {PK_value}")
break
elif choice1 == 3:
while True:
query_check3 = 'select cloth_ID from
inventory
' cursor.execute(query_check3)
cloth_ids = cursor.fetchall()
PK_value = input(f"Please enter the
{PK_name[0][0]} of the record to delete: ")
for cloth_id in cloth_ids:
if PK_value == cloth_id[0]:
break
else:

23 | P a g e
print(f"{PK_value} does not exist.")
continue
query_delete = f'DELETE FROM
{dic_tables[choice1]} WHERE {PK_name[0][0]} =
"{PK_value}"'
cursor.execute(query_delete)
con.commit()
fetch_data()
print(f"Successfully deleted record with
{PK_name[0][0]} = {PK_value}")
break
elif choice1 == 4:
while True:
query_check4 = 'select InvoiceNo from sales'
cursor.execute(query_check4)
invoice_nos = cursor.fetchall()
PK_value = int(input(f"Please enter the
{PK_name[0][0]} of the record to delete: "))
for invoice_no in invoice_nos:
if PK_value ==
invoice_no[0]: break
else:
print(f"{PK_value} does not exist.")
continue
query_delete = f'DELETE FROM
{dic_tables[choice1]} WHERE {PK_name[0][0]} =
{PK_value}'
cursor.execute(query_delete)
con.commit()

24 | P a g e
fetch_data()
print(f"Successfully deleted record with
{PK_name[0][0]} = {PK_value}")
break
elif choice2 not in [1,2,3,4,5,6]:
print("Please choose from only the above 6 options")

def customers_options():
"""
This function seems to be a placeholder or a stub that
does not contain any implementation.
"""

continue_ques = input("Do you want to continue?(Y/N):


")
if continue_ques.lower() == 'y':
pass
else:
print("*" * 50)
print(f"""1) Retrieve all customers data
2) Update Data of customers
3) Retrieve data of a particular customer
4) Add new customer
5) Delete data from customers
6) Exit""")
def employees_options():
"""

25 | P a g e
This function seems to be a placeholder for a function
that would provide options related to employees.
"""
print("*" * 50)
print(f"""1) Retrieve all employees data
2) Update Data of employees
3) Retrieve data of a particular employee
4) Add a new employee
5) Delete data from employees
6) Exit""")
def inventory_options():
"""
This function does not have any code inside it. It
appears to be a placeholder for inventory options.
"""
print("*" * 50)
print(f"""1) Retrieve all data from inventory
2) Update Data of inventory
3) Retrieve data of a particular cloth item
4) Add a new Item
5) Delete data from inventory
6) Exit""")

def
sales_options():
"""
This function seems to be a placeholder or a stub.
It does not contain any code or description of what it
is supposed to do.

26 | P a g e
"""

27 | P a g e
print("*" * 50)
print(f"""1) Retrieve all data from sales
2) Update Data of sales
3) Retrieve data of a particular sale
4) Add a new sale
5) Delete data from sales
6) Exit""")

def fetch_data():
"""
This function fetches data from a data source.
"""
query3 = 'SELECT * FROM ' + dic_tables[choice1]
cursor.execute(query3)
result = cursor.fetchall()
for record in result:
print(record)

def update_data():
"""
This function updates data in a database table based on
user input.

Parameters:
None

Returns
: None
"""

28 | P a g e
dic_data = {}
if choice1 == 1:
customer_update()
elif choice1 == 2:
employee_update()
elif choice1 == 3:
inventory_update()
elif choice1 == 4:
sales_update()

PK = f'SELECT COLUMN_NAME FROM


INFORMATION_SCHEMA.COLUMNS WHERE
TABLE_SCHEMA = "clothesmanagement" AND
TABLE_NAME = "{dic_tables[choice1]}" AND
COLUMN_KEY = "PRI"'
cursor.execute(PK)
PK_name = cursor.fetchall()

for key, value in dic_data.items():


print(f"{key}: {value}")
PK_value = input(f"Please enter the {PK_name[0][0]}
where you want to update: ")
print("Available columns:")
query4 = f"SELECT COLUMN_NAME FROM
INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME
= '{dic_tables[choice1]}' AND TABLE_SCHEMA =
'clothesmanagement'"
cursor.execute(query4)
column_names = [col[0] for col in cursor.fetchall()]

29 | P a g e
for col_name in column_names:
print(col_name)
column_name = input("Please enter the column name
you want to update: ")
new_val = input("Please enter the new value: ")
query5 = f'SELECT DATA_TYPE FROM
INFORMATION_SCHEMA.COLUMNS WHERE
TABLE_SCHEMA = "clothesmanagement" AND
TABLE_NAME = "{dic_tables[choice1]}" AND
COLUMN_NAME = "{PK_name[0][0]}"'
cursor.execute(query5)
PK_data_type = cursor.fetchone()[0]

if PK_data_type in ['varchar', 'char', 'text']:


try:
query5 = f'UPDATE {dic_tables[choice1]} SET
{column_name} = "{new_val}" WHERE {PK_name[0][0]} =
"{PK_value}"'
cursor.execute(query5)
con.commit()
print("Successfully updated")
except Exception:
print("error occured")
else:
try:
query5 = f'UPDATE {dic_tables[choice1]} SET
{column_name} = "{new_val}" WHERE {PK_name[0][0]} =
{PK_value}'
cursor.execute(query5)

30 | P a g e
con.commit()
print("Successfully updated")
except Exception:
print("Error occured")

def column_names():
"""
This function retrieves and prints the names of all
columns in the database table
specified by the 'choice1' variable.

Parameters:
None

Returns:
None. The function prints the column names directly.
"""
query4 = f"SELECT COLUMN_NAME FROM
INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME
= '{dic_tables[choice1]}' AND TABLE_SCHEMA =
'clothesmanagement'"
cursor.execute(query4)
for column_name in cursor:
print(column_name[0])

def customer_update():
"""
This function retrieves customer data from the
'customers' table and stores it in a dictionary.

31 | P a g e
It then prints the customer IDs and their
corresponding names.

Parameters:
None

Returns:
None. The function prints the customer data directly.
"""
global dic_data
dic_data = {}
queryc = 'SELECT cust_ID, cust_FirstName,
cust_LastName FROM customers order by cust_ID ASC'
cursor.execute(queryc)
data = cursor.fetchall()
for custid, firstname, Lastname in data:
dic_data[custid] = [firstname,Lastname]
for custid, firstname, Lastname in data:
print(f'{custid}: {dic_data[custid][0]}
{dic_data[custid][1]}')

def employee_update():
"""
This function retrieves employee data from the
'employees' table and stores it in a dictionary.
It then prints the employee IDs and their corresponding
names.

Parameters:

32 | P a g e
None

Returns:
None. The function prints the employee data directly.
"""
global dic_data
dic_data = {}
querye = 'SELECT Emp_ID, EmpName FROM employees'
cursor.execute(querye)
data = cursor.fetchall()
for empid, empname in data:
dic_data[empid] = empname
print(dic_data)

def inventory_update():
"""
This function retrieves inventory data from the
'inventory' table and stores it in a dictionary.
It then prints the cloth IDs and their corresponding
names.

Parameters:
None

Returns:
None. The function prints the inventory data directly.
"""
global dic_data
dic_data = {}

33 | P a g e
queryi = 'SELECT cloth_ID, cloth_name FROM inventory'
cursor.execute(queryi)
data = cursor.fetchall()
for clothid, clothname in data:
dic_data[clothid] = clothname
print(dic_data)

def sales_update():
"""
This function retrieves sales data from the 'sales' table
and stores it in a dictionary.
It then prints the Invoice numbers and their
corresponding cloth IDs.

Parameters:
None

Returns:
None. The function prints the sales data directly.
"""
global dic_data
dic_data = {}
querys = 'SELECT InvoiceNo, cloth_ID FROM sales'
cursor.execute(querys)
data = cursor.fetchall()
for invoiceno, clothid in data:
dic_data[invoiceno] = clothid
print(dic_data)

34 | P a g e
tempadmin_name = "Ritvik"
tempadmin_ID = 1809
tempadmin_password = "admin123"
while True:
print("*" * 50,"Welcome To Cloth Store Managament
System","*"*50)
print("""Please select from the below options:
1) Admin
2) User""")
print("*" * 50)
while True:
try:
Identify = input("Please enter your choice(or enter
'q' to exit): ")
if Identify.lower() == 'q':
print("Exited from program!")
sys.exit()
Identify = int(Identify)
break
except ValueError:
print("Invalid choice Input. Please enter again")
if Identify == 1:
while True:
try:
admin_name = input("Please enter your name:
")
except Exception:
print("Please enter a valid name.")
else:

35 | P a g e
break

while True:
try:
admin_ID = int(input("Please enter you
admin_ID (only 4 numbers): "))
except Exception:
print("Please enter only numeric value.")
else:
break
while True:
try:
admin_password = input("Please Enter your
password (12 characters maximum): ")
except Exception:
print("Please create a valid password.")
else:
break
def Authentication():
"""
Authenticates the admin user by comparing the
provided credentials with the stored ones.

Parameters:
None

Returns:
bool: True if the credentials match, False
otherwise.

36 | P a g e
"""
if tempadmin_name.lower() == admin_name and
tempadmin_ID == admin_ID and
tempadmin_password.lower() ==
admin_password.lower():
return True
else:
return False

Authentication()

if Authentication() == True:
def main_menu(admin_name):
"""
This function displays the main menu for the
admin user. It allows the admin to navigate through
different
management options for customers,
employees, inventory, and sales.

Parameters:
admin_name (str): The name of the admin
user.

Returns:
None. The function displays the main menu
and handles user input.
"""
global choice1

37 | P a g e
print("Welcome Admin: ", admin_name)
while True:
print("\rPlease wait. Loading... ")
time.sleep(3)
print("Main Menu: ")
print("*" * 50)
query1 = 'SHOW TABLES'
cursor.execute(query1)
num = 1
for table in cursor:
print(str(num) + ")", table[0],
"management")
num += 1
print("*" * 50)
while True:
try:
choice1 = int(input("Please enter your
choice (Enter 8 to exit): "))
except Exception:
print("Invalid Input. Please enter only
numeric value(1-4)")
else:
break
if choice1 == 1:
customers_options()
main()
elif choice1 == 8:
break
elif choice1 == 2:

38 | P a g e
employees_options()
main()
elif choice1 == 3:
inventory_options()
main()
elif choice1 == 4:
sales_options()
main()
else:
print("Invalid table choice.")

main_menu(admin_name)
else:
print("Authentication failed. Please check your
credentials.")

elif Identify == 2:
print("Welcome To Our Cloth Store")
while True:
print('*'*50)
print("""1) Generate Bill
2) Show membership details
3) Exit """)
print('*'*50)
while True:
try:
choice3 = int(input("Please enter
your choice(1-3): "))
except Exception:

39 | P a g e
print("Invalid Input. please enter only
numeric value.(1-3)")
else:
break
if choice3 == 1:
def display_clothes():
"""
This function retrieves and displays the
available clothes from the inventory.

Parameters:
None

Returns:
None. The function prints the available clothes
directly
. """
query_display = 'select cloth_ID, cloth_name,
cloth_price from inventory'
cursor.execute(query_display)
clothes = cursor.fetchall()
print("Available Products:")
for cloth in clothes:
print(f"{cloth[0]}. {cloth[1]} : ₹{cloth[2]}")

def process_order(cart, cloth_ID, Quantity,


InvoiceNo, cust_ID, emp_ID, membership):
"""

40 | P a g e
Processes an order by adding the selected
cloth item to the shopping cart, calculating the total cost,
and updating the sales database.

Parameters:
cart (list): The current shopping cart. Each item
in the cart is a tuple containing the cloth ID, total price,
quantity, invoice number, customer ID,
employee ID, sale date, and payment mode.
cloth_ID (str): The ID of the cloth item being
ordered.
Quantity (int): The quantity of the cloth item
being ordered.
InvoiceNo (int): The invoice number for the
order.
cust_ID (int): The ID of the customer placing
the
order. emp_ID (str): The ID of the employee
processing the order.
membership (str): The membership status of
the customer ('yes' or 'no').

Returns:
float: The total cost of the order after
applying any applicable discounts.
"""
queryorder = f'SELECT cloth_name, cloth_price
FROM inventory WHERE cloth_ID = "{cloth_ID}"'
cursor.execute(queryorder)

41 | P a g e
cloth = cursor.fetchone()
if cloth:
total_price = cloth[1] * Quantity
cart.append((cloth_ID, total_price, Quantity,
InvoiceNo, cust_ID, emp_ID, datetime.datetime.now(),
PaymentMode))
print(f"Added to cart: {Quantity} {cloth[0]}(s)
- Total: ₹{total_price}")
else:
print("Cloth not found.")

total_cost = generate_bill(cart, membership)


return total_cost

def generate_bill(cart, membership):


"""
This function calculates and prints the total
cost of an order, taking into account any applicable
discounts.

Parameters:
cart (list): A list of tuples, where each tuple
represents an item in the shopping cart. Each tuple
contains the cloth ID, total price, quantity, invoice
number, customer ID, employee ID, sale date, and
payment mode.
membership (str): A string indicating whether
the customer has a membership ('yes' or 'no').

42 | P a g e
Returns:
float: The total cost of the order after
applying any applicable discounts.
"""
print("Order Summary:")
total_cost = 0
for item in cart:
print(f"{item[0]} - Quantity: {item[2]}, Total:
₹{item[1]}")
if membership == 'yes':
total_cost += item[1] * 0.9
print(f"Total Cost: ₹{total_cost} after applied
discount of 10%")
else:
total_cost += item[1]
print(f"Total Cost: ₹
{total_cost}")
return total_cost

cart = []
InvoiceNo = int(input("Enter Invoice ID: "))
cust_ID = int(input("Enter Customer ID: "))
emp_ID = input("Enter Employee ID: ")
PaymentMode= input("Please enter the
payment mode(Cash or card): ")

while True:
display_clothes()
choice = input("\nEnter the cloth ID you want

43 | P a g e
to buy (or 'q' to finish): ")

44 | P a g e
if choice.lower() == 'q':
if cart:
total_cost = generate_bill(cart, cust[3])
for item in cart:
try:
query_insert = "INSERT INTO sales
(cloth_ID, SalePrice , Quantity, InvoiceNo, cust_ID,
Emp_ID, SaleDate, PaymentMode) VALUES (%s, %s, %s,
%s, %s, %s, %s, %s)"
cursor.execute(query_insert, item)
except mysql.Error as err:
if err.errno ==
errorcode.ER_DUP_ENTRY:
print("Invoice No. already exists.")
con.commit() # Commit the transaction
print("Thank you for shopping!")
break
try:
query = 'SELECT cust_ID, cust_FirstName,
cust_LastName, membership FROM customers WHERE
cust_ID = %s'
cursor.execute(query, (cust_ID,))
cust = cursor.fetchone()

if cust:
cloth_Id = choice
Quantity = int(input("Enter the quantity:
"))

45 | P a g e
total_cost = process_order(cart, cloth_Id,
Quantity, InvoiceNo, cust[0], emp_ID, cust[3])
else:
print("Customer not found.")
except ValueError:
print("Invalid input. Please enter a valid
cloth ID and quantity.")
except mysql.Error as err:
print(f"Database error: {err}")

elif choice3 == 2:
query = 'select cust_ID, cust_FirstName,
cust_LastName, membership from customers'
cursor.execute(query)
cust =
cursor.fetchall()
customer_update()
cust_id = int(input("Please enter the customer
ID: "))
for cust_ID, cust_FirstName, cust_LastName,
membership in cust:
if cust_ID == cust_id:
print(f"customer
name:{cust_FirstName}\ncustomer Last name:
{cust_LastName}\nMembership Taken:
{membership}")
break
else:
print("Customer Id not found")

46 | P a g e
elif choice3 == 3:

47 | P a g e
break
print("Thankyou for visiting us!")

48 | P a g e
OUTPUT

1) Welcome Page:

2) Admin Menu:

3)Customers
management:

49 | P a g e
3) Customers management:

4) Employees Management

50 | P a g e
5) Inventory Management

6) Sales Management

51 | P a g e
7) User

8) User : Generate Bill

52 | P a g e
9) User : Membership Details

10) Exit User Menu

53 | P a g e
BIBLIOGRAPHY

1)https://www.academia.edu/122711380/Clothes
_store_management_system_project_report
2) Website used to study about the different functions

used in this project: https://ncert.nic.in

3) https://www.slideshare.net/slideshow/clothes-

store-management-system-project-report-

pdf/270891656#9

54 | P a g e

You might also like