CS Project Main

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 20

Acknowledgement

INDEX

1.INTRODUCTION
2.PROJECT ABSTRACTION
3.SURVEY OF
TECHNOLOGIES
4.HARDWARE & SOFTWARE
REQUIREMENTS
5.HARDWARE &SOFTWARE
USED 6.SOURCE CODE

7.DATABASE DETAILS
8.OUTPUT
9.CONCLUSION
10.BIBLIOGRAPHY
INTRODUCTION
The JEWELLERY SHOP SOFTWARE is a system
which allows user to add a product,
update the stock, add a new customer
and record to purchase the Jewellery.

NOTE:

♦Allow the user to input their


question.

♦Show an in-progress message.


♦Create 10/20 responses, and show
random responses.

♦Allow the user to ask another


question/advice or quit the
software.
PROJECT ABSTRACT
The Jewellery Management System divided into
following functions as per their functionality.

1.ADD PRODUCT:

This module is used to add a new product, for this we


had to enter the basic informations like Product
name, Product category, Price, Quantity.

2.UPDATE STOCK:

This module is used to Update the stock quantity of a


product with validation by entering Product ID and
Quantity.

3.ADD CUSTOMER:
This module is used to Add a new customer to the
customers table by entering Customer Name, Email,
Phone Number.

4.RECORD PURCHASE

This module is used to Record a purchase and


update stock with validation by entering Customer
ID, Product ID, Quantity.

5.EXIT:

This module is used to exit from from the whole


program.

SURVEY OF TECHNOLOGIES
The following software are used in the project for the
development of JEWELLERY SHOP MANAGEMENT
SYSTEM.

1.Python: Python is an interpreter, high level, general


purpose programming language developed by Guido
Van Rossum in 1991. Python is dynamically typed and
garbage-collected. It supports multiple programming
paradigms, including procedural, object-oriented, and
functional programming. Python is often described as a
“Batteries Included” languages due to its
comprehensive standard library.

There are two major python versions-Python 2 and


Python 3. The version used for this project is PYTHON
3.11

2.MySQL: MySQL is an open-source relational database


management system (RDBMS). Its name is a
combination of "My", the name of co-founder Michael
Widenius's daughter My, and "SQL", the acronym for
Structured Query Language. A relational database
organizes data into one or more data tables in which
data may be related to each other; these relations
help structure the data.

3.MySQL Connector-Python: Python needs a My SQL


driver to access the MySQL database. This is a driver
“MySQL connector” used to connect python and MySQL
databases. We can install this connector using pip
command. PIP install MySQL-connector-python.

HARDWARE & SOFTWARE

REQUIREMENTS HARDWARE

Processor : Pentium™ Dual Core or Above RAM : 2


GB

HARD DISK : 500 GB

SOFTWARE

Operating System : Windows® 7 or Above Front End :

Python 3 or Above Middleware : Python-MySQL

connector Backend : MySQL

HARDWARE & SOFTWARE USED FOR THIS


PROJECT
HARDWARE

Processor : INTEL® Core™ i7 8700

RAM : 16 GB

SSD : 1 TB
SOFTWARE

Operating System : Windows® 11 Pro Front

End : Python 3.11

Middleware : Python-MySQL connector Backend :

MySQL

SOURCE CODE
import mysql.connector

from mysql.connector import Error

def create_connection():

"""Create a database connection."""

try:

connection =

mysql.connector.connect( host='localhost',

user='root',

password='',

database='Jewellery'

if connection.is_connected():
print("Connection successful")

return connection

except Error as e:

print(f"Error: {e}")

return None

def get_current_quantity(product_id):

"""Retrieve the current quantity of a product."""

connection = create_connection()

if connection is None:

return None
try:

cursor = connection.cursor()

query = "SELECT quantity FROM products WHERE id = %s"

cursor.execute(query, (product_id,))

result = cursor.fetchone()

if result:

return result[0] # Return the quantity

else:

print("Product not found.")

return None

except Error as e:

print(f"Error: {e}")

return None
finally:

cursor.close()

connection.close()

def add_product():

"""Add a new product to the inventory."""

name = input("Enter product name: ")

category = input("Enter product category: ")

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

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

connection = create_connection()

if connection is None:
return

try:

cursor = connection.cursor()

query = "INSERT INTO products (name, category, price, quantity) VALUES


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

values = (name, category, price, quantity)

cursor.execute(query, values)

connection.commit()

print("Product added successfully.")

except Error as e:

print(f"Error: {e}")
finally:

cursor.close()

connection.close()

def update_stock():

"""Update the stock quantity of a product with validation."""

product_id = int(input("Enter product ID to update stock: "))

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

connection = create_connection()

if connection is None:

return
try:

cursor = connection.cursor()

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

values = (new_quantity, product_id)

cursor.execute(query, values)

connection.commit()

print("Stock updated successfully.")

except Error as e:

print(f"Error: {e}")
finally:

cursor.close()

connection.close()

def add_customer():

"""Add a new customer to the customers table."""

name = input("Enter customer name: ")

email = input("Enter customer email: ")

phone = int(input("Enter customer phone: "))

connection = create_connection()

if connection is None:

return

try:

cursor = connection.cursor()

query = "INSERT INTO customers (name, email, phone) VALUES (%s, %s, %s)"
values = (name, email, phone)

cursor.execute(query, values)

connection.commit()

print("Customer added successfully.")

except Error as e:

print(f"Error: {e}")

finally:

cursor.close()
connection.close()

def record_purchase():

"""Record a purchase and update stock with validation."""

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

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

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

current_quantity = get_current_quantity(product_id)

if current_quantity is None:

return # Product does not exist

if quantity <= 0:

print("Error: Purchase quantity must be positive.")

return

if quantity > current_quantity:

print("Error: Not enough stock to fulfill the purchase.")


return

connection = create_connection()

if connection is None:

return

try:
cursor = connection.cursor()

# Record the purchase

query = "INSERT INTO purchases (customer_id, product_id, quantity,


purchase_date) VALUES (%s, %s, %s, CURDATE())"

values = (customer_id, product_id, quantity)

cursor.execute(query, values)

# Update stock

update_stock_query = "UPDATE products SET quantity = quantity - %s WHERE id


= %s"

update_values = (quantity, product_id)

cursor.execute(update_stock_query, update_values)

connection.commit()

print("Purchase recorded successfully.")

except Error as e:

print(f"Error: {e}")

finally:

cursor.close()

connection.close()
def display_menu():

"""Display the menu options."""

print("\nJewellery Shop Management System")

print("1. Add Product")


print("2. Update Stock")

print("3. Add Customer")

print("4. Record Purchase")

print("5. Exit")

def main():

"""Main function to run the menu-driven program."""

while True:

display_menu()

choice = input("Enter your choice (1-5): ")

if choice == '1':

add_product()

elif choice == '2':

update_stock()

elif choice == '3':

add_customer()

elif choice == '4':

record_purchase()

elif choice == '5':

print("Exiting the program.")

break
else:

print("Invalid choice. Please enter a number between 1 and 5.")


if __name__ == "__main__":

main()

DATABASE DETAILS

TABLE : Products
CREATE TABLE Products(Name varchar(25),
Category varchar(25), Price int, ID int, Quantity
int);

TABLE : Customers
CREATE TABLE Customers(Name varchar(25),
Email varchar(25), Phone int);

TABLE : Purchases
CREATE TABLE Purchases(Customer_ID int,
Product_ID int, Quantity int, Purchase_Date
varchar(25));
OUTPUT
1.TO ADD A PRODUCT

2.TO UPDATE THE STOCK

3.TO ADD A CUSTOMER


4.TO RECORD THE PURCHASE

5.TO EXIT
DATABASE

CONCLUSION
The Jewellery Shop Management System developed
as part of this project provides an efficient solution for
managing various operations within a jewellery store.
From inventory tracking and customer management
to generating bills and sales reports, the system
streamlines these tasks, reducing human error and
increasing operational efficiency.

Through this project, I gained practical experience in


database management, programming, and system
design. The integration of key functions such as stock
management, sales tracking, and customer
information storage ensures that the system meets
the demands of a modern jewellery business,
facilitating smoother and more reliable operations.

The project also helped me improve problem-solving


skills by addressing challenges such as managing
large amounts of data and ensuring data security.
Furthermore, this experience demonstrated the
importance of technology in enhancing business
processes and customer service in the jewellery retail
industry.

Hence this software project has been developed to


fulfill the academic learning in CBSE class XII,
Computer Science curriculum.

BIBLIOGRAPHY

https://docs.python.org
www.geeksforgeeks.org
https://www.w3resource.co
m https://en.wikipedia.org
https://www.openai.com
NCERT TEXTBOOK

You might also like