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

cs prj final 11

The document outlines an investigatory project titled 'ARM Dairy Management System' completed by K. Mithun Krishna at Chennai Public School for the academic year 2024-2025. It details the system's objectives, technical specifications, database structure, and functionalities for managing dairy product inventory and sales. Future enhancements and a bibliography of resources used in the project are also included.

Uploaded by

dhany27r
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)
4 views

cs prj final 11

The document outlines an investigatory project titled 'ARM Dairy Management System' completed by K. Mithun Krishna at Chennai Public School for the academic year 2024-2025. It details the system's objectives, technical specifications, database structure, and functionalities for managing dairy product inventory and sales. Future enhancements and a bibliography of resources used in the project are also included.

Uploaded by

dhany27r
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/ 42

CHENNAI PUBLIC SCHOOL

INVESTIGATORY PROJECT

Computer Science
2024 -2025

ARM DAIRY MANAGEMENT SYSTEM

STUDENT NAME : K.Mithun Krishna


REGISTER NUMBER :
CERTIFICATE

This is to certify that, K.Mithun krishna student of Class XII C, Chennai


Public School, Anna Nagar, has completed the project titled during the
academic year 2024-2025 towards partial fulfillment of credit for the
AISSCE Practical Evaluation, under my supervision.

_______________ _______________

Mrs. Thushantha Balaji External Examiner


Computer Science Teacher

_______________________

Mrs. Sukanya M
Principal School Seal

2
ACKNOWLEDGMENT
My sincere thanks go to Mrs.Sukanya M, Our Principal Ma'am, for
her coordination in extending every possible support for the
completion of this project. I would like to express a deep sense of
thanks and gratitude to my project guide Mrs. Thushantha Ma'am
for guiding me immensely through the course of the project. She
always evinced keen interest in my work. Her constructive advice and
constant motivation have been responsible for the successful
completion of this project. I would also like to convey my gratitude to
Jayalakshmi Ma’am, Our Lab Assistant who has helped us
throughout the completion of our project.

I also thank my parents for their motivation and support. I must


thank my classmates for their timely help and support for the
compilation of this project. Last but not least, I would like to thank all
those who had helped directly or indirectly towards the completion
of this project.

3
CONTENTS:

S.NO TOPIC Page No


1 Case Study 5

6
2 Objectives

3 Technical Specifications 8

4 Database Used 9

6 Modules and User-Defined 12


Functions
Code 16
7
28
8 Output
9 Future enhancement 39

10 Bibliography 42

4
CASE STUDY
1)The ARM Dairy Store Inventory and Sales (Stock)
Management System software is a program which makes it easy
to maintain a record of dairy products available in the list and
track orders issued to suppliers in The Dairy Store

2) To monitor and control inventory(stock) and sales in ‘ARM


Dairy Store’. The objective of this project is to let students apply
the programming knowledge that they’ve acquired in a real-
world situation/problem and expose the students to how
programming skills can help in developing a good software

3) It’s a user-friendly application built with the front end as


MySQL and the back end as Python.

4) It’s used to store, update, delete, and display the user’s data
among other functions

5) It uses certain conditions to extract the data desired by the


user.

5
OBJECTIVES
 Inventory Management: The system will efficiently

track and manage inventory levels, ensuring that

dairy products are always available to meet

customer demand while minimizing waste and

spoilage.

 Sales Tracking: By monitoring daily sales, the system

can help identify popular products and analyze sales

trends. This data- driven approach will enable better

decision-making and business optimization.

 Customer Management: Maintaining a comprehensive

database of customers allows for better order

management and enhances customer relationships

through personalized services and promotions.

 Financial Management: Automating billing processes

and managing expenses will streamline accounting

operations. The system can generate detailed financial

reports to help the business stay financially healthy.

6
TECHNICAL
SPECIFICATIONS

Processor: 11th Gen Intel(R) Core i9-14900K


3.0 GHz
Installed RAM: 16 GB (15.87 GB usable)
System Type: 64-bit operating system, x64-based
processor
Pen and touch: No pen or touch input is needed for
this display

SOFTWARE
SPECIFICATIONS:
 Pycharm community
 SQL 5.
 OS-Windows

7
TABLES USED

DATABASE USED:

TABLES:

8
TABLE PRODUCT :

DESCRIBING PRODUCT:

DESCRIBING SALES:

9
DESCRIBING USER :

TABLE SALES:

TABLE USER:

10
Modules and User-Defined
Functions
Modules Used
1. mysql.connector:
o A Python library to connect and interact with MySQL databases.
o Functions like connect(), cursor(), and execute() are used to
interact with the database.

2. mysql.connector.Error:
o Used to handle database connection and query execution errors.

Functions in the Code


1. Database Connection (connect_to_db)
 Establishes a connection to the MySQL database using credentials like
host, user, password, and database.
 If successful, returns the connection object; otherwise, handles and
prints the error.

2. Table Creation (create_tables)


 Creates three tables:
1. Product: Stores product details such as name, company,
description, price, and stock quantity.
2. Sales: Records sales transactions, including product ID, quantity
sold, and sale date.
11
3. User: Stores user credentials and roles (e.g., admin or staff).

CRUD and Management Functions


3. Add Product (add_product)
 Takes product details (name, company, description, price, and
quantity) as input.
 Inserts the data into the Product table.

4. View Products (view_products)


 Fetches and displays all records from the Product table.

5. Modify Product (modify_product)


 Allows the user to modify a specific product's details by selecting a field
and entering a new value.
 Updates the Product table with the new information.

6. Make a Sale (make_sale)


 Records a sale:
o Checks if enough stock is available for the specified product.
o Reduces the stock in the Product table.
o Records the transaction in the Sales table.

7. View Sales (view_sales)


 Fetches and displays sales records, including product details, quantity
sold, and sale date.

8. Add User (add_user)


 Adds a new user (admin or staff) to the User table with a unique
username.

12
Main Functionality (main)
1. Connects to the database using connect_to_db().

2. Creates tables using create_tables() (if they don’t exist).

3. Displays a menu with the following options:


o Add a product
o View products
o Modify product details
o Make a sale
o View sales
o Add a user
o Exit the system

4. Calls the corresponding function based on user input.

5. Keeps running until the user chooses to exit.

How Modules and Functions Work Together

1. Modules:
o mysql.connector handles all database interactions, such as
connecting to MySQL, executing queries, and committing
changes.

2. User-Defined Functions:
o connect_to_db(): Establishes the connection for all database
operations.
13
o create_tables(): Prepares the database structure.

o add_product(), view_products(), modify_product(): Manage


product details.

o make_sale(), view_sales(): Handle transactions and sales


reporting.

o add_user(): Manages user roles.

3. Integration:
o The main() function orchestrates all operations, ensuring the
database connection is established, and user inputs are processed
effectively.

14
CODE

import mysql.connector
from mysql.connector import Error

def connect_to_db():

try:

connection = mysql.connector.connect(
host='localhost',
user='root',
password='sample'
database='diary_shop'
)
if connection.is_connected(
print("Connected to the database")
return connection
except Error as e:
print(f"Error connecting to MySQL: {e}")
return None

15
def create_tables(connection):
cursor = connection.cursor()
try:

cursor.execute("""
CREATE TABLE IF NOT EXISTS Product (
product_id INT AUTO_INCREMENT PRIMARY KEY,
product_name VARCHAR(255),
product_company VARCHAR(255),
product_description TEXT,
unit_price FLOAT,
quantity INT
);

""")

cursor.execute("""
CREATE TABLE IF NOT EXISTS Sales (
sale_id INT AUTO_INCREMENT PRIMARY KEY,
16
product_id INT,
sale_quantity INT,
sale_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (product_id) REFERENCES Product(product_id)
);
""")

cursor.execute("""
CREATE TABLE IF NOT EXISTS User (
user_id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) UNIQUE,
role ENUM('admin', 'staff')
);
""")
print("Tables created successfully.")
except Error as e:
print(f"Error creating tables: {e}")
finally:
cursor.close()

17
def add_product(connection):
cursor = connection.cursor()
product_name = input("Enter product name: ")
product_company = input("Enter product company: ")
product_description = input("Enter product description: ")
unit_price = float(input("Enter unit price: "))
quantity = int(input("Enter quantity: "))

try:
cursor.execute("""
INSERT INTO Product (product_name, product_company,

product_description, unit_price, quantity)


VALUES (%s, %s, %s, %s, %s)
""", (product_name, product_company, product_description, unit_price,
quantity))
connection.commit()
print("Product added successfully.")
except Error as e:
18
print(f"Error adding product: {e}")
finally:
cursor.close()

def view_products(connection):
cursor = connection.cursor()
try:
cursor.execute("SELECT * FROM Product")
products = cursor.fetchall()
print("Products:")
for product in products:
print(product)
except Error as e:
print(f"Error fetching products: {e}")
finally:
cursor.close()

def modify_product(connection):
cursor = connection.cursor()
product_id = int(input("Enter product ID to modify: "))
print("What do you want to modify?")
print("1. Name\n2. Company\n3. Description\n4. Unit Price\n5. Quantity")
choice = int(input("Enter choice: "))
field = {1: "product_name", 2: "product_company", 3:
19
"product_description", 4: "unit_price", 5: "quantity"}[choice]
new_value = input(f"Enter new value for {field}: ")

try:
if choice in [4, 5]:
cursor.execute(f"UPDATE Product SET {field} = %s WHERE product_id
= %s", (float(new_value) if choice == 4 else int(new_value), product_id))

else:
cursor.execute(f"UPDATE Product SET {field} = %s WHERE product_id
= %s", (new_value, product_id))
connection.commit()
print("Product updated successfully.")
except Error as e:

print(f"Error updating product: {e}")


finally:
cursor.close()

def make_sale(connection):
cursor = connection.cursor()
product_id = int(input("Enter product ID: "))
20
sale_quantity = int(input("Enter sale quantity: "))

try:

cursor.execute("SELECT quantity FROM Product WHERE product_id =


%s", (product_id,))
available_quantity = cursor.fetchone()[0]
if sale_quantity > available_quantity:
print("Insufficient stock!")
else:
cursor.execute("""
INSERT INTO Sales (product_id, sale_quantity)
VALUES (%s, %s)
""", (product_id, sale_quantity))

cursor.execute("""
UPDATE Product
SET quantity = quantity - %s
WHERE product_id = %s
""", (sale_quantity, product_id))
connection.commit()
print("Sale recorded successfully.")
except Error as e:

21
print(f"Error making sale: {e}")
finally:

cursor.close()

def view_sales(connection):
cursor = connection.cursor()
try:
cursor.execute("""
SELECT Sales.sale_id, Product.product_name, Sales.sale_quantity,
Sales.sale_date
FROM Sales
JOIN Product ON Sales.product_id = Product.product_id
""")
sales = cursor.fetchall()

print("Sales:")
for sale in sales:
print(sale)
except Error as e:
print(f"Error fetching sales: {e}")
22
finally:
cursor.close()

def add_user(connection):
cursor = connection.cursor()
username = input("Enter username: ")
role = input("Enter role (admin/staff): ").lower()
try:
cursor.execute("""
INSERT INTO User (username, role)
VALUES (%s, %s)
""", (username, role))
connection.commit()
print("User added successfully.")
except Error as e:
print(f"Error adding user: {e}")
finally:
23
cursor.close()

def main():
connection = connect_to_db()
if connection is None:
return

create_tables(connection)

24
while True:
print("\nARM Diary Shop Management System")
print("1. Add Product")
print("2. View Products")
print("3. Modify Product")
print("4. Make Sale")
print("5. View Sales")
print("6. Add User")
print("7. Exit")
choice = int(input("Enter your choice: "))

if choice == 1:
add_product(connection)
elif choice == 2:
view_products(connection)
elif choice == 3:
modify_product(connection)
elif choice == 4:
make_sale(connection)
elif choice == 5:
view_sales(connection)
elif choice == 6:
add_user(connection)

25
elif choice == 7:
connection.close()
print("Goodbye!")
break
else:
print("Invalid choice! Try again.")

if __name__ == "__main__":
main()

26
OUTPUT

27
28
29
30
31
32
33
34
35
36
37
FUTURE
ENHANCEMENTS
Future Enhancements for Diary Management System

The Diary Management System can be significantly enhanced to

improve functionality, user experience, and operational efficiency.

Here are some potential future enhancements:

1. Advanced Inventory Management:

o Implement real-time stock tracking with low-stock alerts to

avoid shortages.

o Enable automatic reordering by integrating with suppliers

when inventory levels fall below a defined threshold.

2. Comprehensive Reporting and Analytics:

o Add dashboards for sales trends, top-performing products,

and profit margins.

o Generate detailed monthly and yearly reports to help

decision-making.

3. User Role Management:


38
o Enhance user management by implementing granular role-

based access controls (e.g., read-only, manager-level

editing).

o Include activity logs for better accountability.

4. Mobile and Web Integration:

o Develop mobile and web apps for remote management of

products and sales, accessible by both staff and admins.

5. Integration with Payment Systems:

o Allow integration with payment gateways to process digital

transactions seamlessly.

6. AI-Powered Features:

o Use predictive analytics to forecast demand based on

historical sales data.

o Incorporate natural language processing for conversational

interfaces.

7. Enhanced Security:

o Use encrypted databases and implement multi-factor


39
authentication for secure logins.

These improvements will modernize the system, make it scalable,

and ensure it meets the evolving needs of businesses.

40
BIBLIOGRAPHY
• Computer Science with Python - Class XII by Preeti Arora

• NCERT Computer Science Textbook - Class XII

• Python Programming Projects & Practical for CBSE Class XI & XII:

GUI Based Projects & Practical -By Reema Thareja and Vedant Bahel

• https://www.geeksforgeeks.org/python/default.com

•https://www.w3schools.com/python/default.asp

• https://realpython.com

41
42

You might also like