Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
30 views26 pages

Main Print

The document summarizes a student project on a sales management system. It describes the key features of the system, including user authentication, database setup, data insertion and deletion, and a dashboard for data analysis. The system is designed to help businesses manage sales data and gain insights. It uses Python, pandas, matplotlib, and MySQL and aims to teach students practical skills in system development and data analysis.

Uploaded by

whitehacker6002
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)
30 views26 pages

Main Print

The document summarizes a student project on a sales management system. It describes the key features of the system, including user authentication, database setup, data insertion and deletion, and a dashboard for data analysis. The system is designed to help businesses manage sales data and gain insights. It uses Python, pandas, matplotlib, and MySQL and aims to teach students practical skills in system development and data analysis.

Uploaded by

whitehacker6002
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/ 26

SALES

MANAGEMENT
SYSTEM

Submitted to SACHIN SIR


ACKNOWLEDGMENT

This project on "Sales Management System" would


not have been possible without the invaluable
guidance and support of our respected teacher, Mr.
Sachin Sir. We extend our sincere gratitude to him
for his constant encouragement, valuable insights,
and expert advice throughout the development of this
project. Their insights were instrumental in shaping
the final outcome. Finally, we would like to thank
our parents for their unwavering support and
understanding during the challenging yet rewarding
journey of completing

Name ANSHUL
Class XII,B
CERTIFICATE

This is to certify that the ANSHUL has successfully


completed the project on "Sales Management
System" under the guidance of Mr. Sachin Sir, in
partial fulfillment of the requirements for the Class
XII Informatics Practices curriculum.

**Project Details:**
**Project Title:** Sales Management System
**Project Guide:** Mr. Sachin Sir
TABLE OF CONTENT

01 BRIEF OVERVIEW OF PROJECT

MODULE USED
02

FILES GENERATED
03

WORKING DESCRIPTION
04

SOURCE CODE
05

OUTPUT SCREENSHOTS
06

BIBLIOGRAPHY
07
SALES MANAGEMENT
PROJECT
The Sales Management System is a sophisticated project
developed to enhance the efficiency of sales processes
and provide valuable insights for businesses. Designed
for 12th-grade students, this project incorporates
Python, pandas for data manipulation, and MySQL for
database management. The system ensures secure user
authentication, allowing individuals to log in with a
unique username and login code.

Upon authentication, the system establishes a database,


creating a 'Sales' table to store critical sales data.
Sample data is inserted into the system, showcasing its
practical application in managing sales information.
Users can also delete specific sales records based on
order date, units, and item type.

The project boasts a dynamic dashboard, offering


analytics such as monthly sales revenue, region-wise
sales revenue, and salesperson-wise revenue. These
features empower users to gain insights into sales
performance and make informed decisions.

To enhance security and user experience, the system


enables individuals to sign up by entering a unique
username. A random login ID is generated for each user.
The main menu provides options for accessing the
dashboard, inserting new data, deleting records, or
exiting the system.

In summary, the Sales Management System is a


comprehensive tool designed to equip students with
practical skills in system development and data
analysis, providing a holistic understanding of
Informatics Practices within a business context.
MODULES USED

01 02

Pandas Matplotlib

PROGRAMING LANGUAGES USED

30% 70%
MYSQL PYTHON

Stores data Provides CUI


in backend interaction
Files
Generated

Main.py Admin.py
The script The script is for
gracefully handles user signup in the
user input and Inventory and Sales
provides options to Data Management
navigate through System.
the system.

Functions.py User.csv

This Python This file saves


script defines the username and
functions for password for
managing sales login
data in the
Inventory and
Sales Data
Management System
WORKING DESCRIPTION

The Sales Management System is a comprehensive

project designed to help businesses streamline their

sales processes, manage data efficiently, and gain

valuable insights through data analysis. The project

is implemented in Python, utilizing libraries such

as pandas for data manipulation, matplotlib for data

visualization, and MySQL for database management.

Key Features:

User Authentication:
● Users log in with a username and a login
code. The system ensures valid user
authentication, reading user details from
a CSV file.
Database Setup:
● The system checks for the existence of a
database and creates one if not found. It
establishes a 'Sales' table to store
sales-related data.
Data Insertion:
● Sample sales data is inserted into the
'Sales' table, demonstrating how real-
world sales information can be added to
the system.
WORKING DESCRIPTION

Data Deletion:
● Users can delete sales data based on
specified criteria, such as order date,
number of units, and item type.
Dashboard for Data Analysis:
● The project includes a dashboard with
various analytical options:
● Monthly Sales Revenue: Displays total
sales revenue for each month.
● Region-wise Sales Revenue: Shows
sales revenue by manager for a
selected region.
● Salesperson-wise Revenue: Presents
sales revenue distribution among
salespersons.
User Sign-Up:
● The system allows users to sign up by
entering a unique username. A random login
ID is generated for each user, enhancing
security.

How to Use:

Users log in using their username and login code.


Once authenticated, users can access the main menu
with options for the dashboard, data insertion,
data deletion, or system exit.
WORKING DESCRIPTION

In the dashboard, users can choose specific


analytics, such as monthly sales revenue or
region-wise sales revenue, to gain insights
into the sales performance.
Data insertion enables users to add new sales
records to the system.
Data deletion allows users to remove specific
sales records based on order date, units, and
item type.
The sign-up process ensures a secure and unique
user experience.

Objective:

The Sales Management System project aims to provide

a user-friendly platform for managing sales data,

facilitating efficient data analysis, and promoting

informed decision-making within a business context.

It equips users with practical skills in system

development and data analysis, essential for

professionals in the field of Informatics Practices.


SOURCE CODE

Main.py

# Library Used
import pandas as pd
import mysql.connector as sqLtor
from sqlalchemy import create_engine
# from sqlalchemy import m
import function

# Variable Used
IsValid User = False
DatabaseName = "IPProjectDB"
Working = True
Working2 = True

# Login Page
user_df = pd.read_csv("user.csv", names=["UserName", "LoginId"])

if user_df.empty:
print("!!!No One Is Login!!!")
print("!!!Please First Login!!!")
else:
print("+-----------------+")
print("| Login |")
print("+-----------------+")
username = input("Enter UserName : ").replace(" ","")
login_code = input("Enter Login Code : ")
Main.py

for i in user_df.itertuples():
if username == i[1] and login_code == i[2]:
print("Successfully Logged")
IsValid User = True
else:
print("Invalid Login ID or Username")
try:
raise ValueError
except:
print("Not Allowed To Enter In System")

if IsValid User:
try:
myconnection = sqLtor.connect( host = 'localhost' , user
= 'root', password = '1234')
cursor = connection.cursor()
table_create = '''
CREATE TABLE IF NOT EXISTS Sales (OrderDate DATE,Region
VARCHAR(30),Manager VARCHAR(30),SalesMan VARCHAR(30),Item
VARCHAR(20),Units INT,Unit_price FLOAT,Sale_amt FLOAT);
'''
cursor.execute(CREATE DATABASE IF NOT EXISTS
{DatabaseName}')
connection = sqLtor.connect(host = "localhost", user =
"root", password = "1234", database = f"{DatabaseName}")

db_cursor = connection.cursor()
db_cursor.execute(table_create)
Main.py

print ("Database created successfully")


print("Table created successfully.")
myconnection.close()
connection.close()

except Exception as e:
print(e)

try:
Query = 'SELECT * FROM SALES'
dbengine =
create_engine("mysql+pymysql://root:1234@localhost/IP ProjectDB")

alc_connection = dbengine.connect()
Management System Database = pdf.read_sql(Query ,
alc_connection)
if Management System Database.empty:
function.insert_data()
except Exception as e:
print(e)
Admin.py

import function

print("+--------------------+")
print("| SignUp |")
print("+--------------------+")

UserName1 = input("Enter User Name : ")


UserName = UserName1.replace(" ","")
LoginId = function.LoginId()

if function.AlphaInUserName(UserName) == True:
if function.unique_(UserName) != False:
print(f"Your LoginId : {LoginId}")
with open("user.csv", "at") as file:
file.write(f"{UserName},{LoginId}\n")
else:
print("Enter Another Name !!!")
else:
print("User Cannot Be Assign")
Function.py

# Library Used
import pandas as pd
import mysql.connector as sqLtor
from matplotlib import pyplot
from sqlalchemy import create_engine

# UDF To Be Used

def insert_data():
try:
db_connection =
sqLtor.connect(host='localhost',user='root',password='1234',databas
e='IPProjectDB')
cursor = db_connection.cursor()
# INSERT SAMPLE DATA
insert_query = '''
INSERT INTO Sales (Orderdate, Region, Manager, salesMan, Item, Units, Unit_price, Sale_amt)

VALUES
('2018-01-06', 'East', 'Martha', 'Alexander', 'Television', 95, 1198.00, 113810.00),
('2018-01-23', 'Central', 'Hermann', 'Shelli', 'Home Theater', 50, 500.00, 25000.00),
('2018-02-09', 'Central', 'Hermann', 'Luis', 'Television', 36, 1198.00, 43128.00),
('2018-02-26', 'Central', 'Timothy', 'David', 'Cell Phone', 27, 225.00, 6075.00),
('2018-03-15', 'West', 'Timothy', 'Stephen', 'Television', 56, 1198.00, 67088.00),
('2018-04-01', 'East', 'Martha', 'Alexander', 'Home Theater', 60, 500.00, 30000.00),
('2018-04-18', 'Central', 'Martha', 'Steven', 'Television', 75, 1198.00, 89850.00),
('2018-05-05', 'Central', 'Hermann', 'Luis', 'Television', 90, 1198.00, 107820.00),
('2018-05-22', 'West', 'Douglas', 'Michael', 'Television', 32, 1198.00, 38336.00),
('2018-06-08', 'East', 'Martha', 'Alexander', 'Home Theater', 60, 500.00, 30000.00),
('2018-06-25', 'Central', 'Hermann', 'Sigal', 'Television', 90, 1198.00, 107820.00),
('2018-07-12', 'East', 'Martha', 'Diana', 'Home Theater', 29, 500.00, 14500.00),
('2018-07-29', 'East', 'Douglas', 'Karen', 'Home Theater', 81, 500.00, 40500.00),
('2018-08-15', 'East', 'Martha', 'Alexander', 'Television', 35, 1198.00, 41930.00),
('2018-09-01', 'Central', 'Douglas', 'John', 'Desk', 2, 125.00, 250.00),
('2018-09-18', 'East', 'Martha', 'Alexander', 'Video Games', 16, 58.50, 936.00),
('2018-10-05', 'Central', 'Hermann', 'Sigal', 'Home Theater', 28, 500.00, 14000.00),
('2018-10-22', 'East', 'Martha', 'Alexander', 'Cell Phone', 64, 225.00, 14400.00),
('2018-11-08', 'East', 'Douglas', 'Karen', 'Cell Phone', 15, 225.00, 3375.00),
('2018-11-25', 'Central', 'Hermann', 'Shelli', 'Video Games', 96, 58.50, 5616.00),
('2018-12-12', 'Central', 'Douglas', 'John', 'Television', 67, 1198.00, 80266.00),
('2018-12-29', 'East', 'Douglas', 'Karen', 'Video Games', 74, 58.50, 4329.00),
('2019-01-15', 'Central', 'Timothy', 'David', 'Home Theater', 46, 500.00, 23000.00),
('2019-02-01', 'Central', 'Douglas', 'John', 'Home Theater', 87, 500.00, 43500.00),
('2019-02-18', 'East', 'Martha', 'Alexander', 'Home Theater', 4, 500.00, 2000.00),
('2019-03-07', 'West', 'Timothy', 'Stephen', 'Home Theater', 7, 500.00, 3500.00),
('2019-03-24', 'Central', 'Hermann', 'Luis', 'Video Games', 50, 58.50, 2925.00),
('2019-04-10', 'Central', 'Martha', 'Steven', 'Television', 66, 1198.00, 79068.00),
('2019-04-27', 'East', 'Martha', 'Diana', 'Cell Phone', 96, 225.00, 21600.00),
('2019-05-14', 'Central', 'Timothy', 'David', 'Television', 53, 1198.00, 63494.00),
('2019-05-31', 'Central', 'Timothy', 'David', 'Home Theater', 80, 500.00, 40000.00),
('2019-06-17', 'Central', 'Hermann', 'Shelli', 'Desk', 5, 125.00, 625.00),
('2019-07-04', 'East', 'Martha', 'Alexander', 'Video Games', 62, 58.50, 3627.00),
('2019-07-21', 'Central', 'Hermann', 'Sigal', 'Video Games', 55, 58.50, 3217.50),
('2019-08-07', 'Central', 'Hermann', 'Shelli', 'Video Games', 42, 58.50, 2457.00),
('2019-08-24', 'West', 'Timothy', 'Stephen', 'Desk', 3, 125.00, 375.00),
('2019-09-10', 'Central', 'Timothy', 'David', 'Television', 7, 1198.00, 8386.00),
('2019-09-27', 'West', 'Timothy', 'Stephen', 'Cell Phone', 76, 225.00, 17100.00),
('2019-10-14', 'West', 'Douglas', 'Michael', 'Home Theater', 57, 500.00, 28500.00),
('2019-10-31', 'Central', 'Martha', 'Steven', 'Television', 14, 1198.00, 16772.00),
('2019-11-17', 'Central', 'Hermann', 'Luis', 'Home Theater', 11, 500.00, 5500.00),
('2019-12-04', 'Central', 'Hermann', 'Luis', 'Home Theater', 94, 500.00, 47000.00);

'''
Function.py

cursor.execute(insert_query)
print("Table data inserted successfully.")
db_connection.commit()
db_connection.close()
except Exception as e:
print(e)

def monthwise_sales_graph():
try:
myconnection =
sqLtor.connect(host='localhost',user='root',password='1234',p
ort='3306',database='IPProjectDB')

cursor = myconnection.cursor()
query = '''
SELECT MONTHNAME(MIN(OrderDate)) AS Month,
SUM(Sale_amt) AS TotalSales FROM Sales
GROUP BY MONTH(OrderDate)
ORDER BY MONTH(OrderDate);
'''
cursor.execute(query)
result = cursor.fetchall()
df = pd.DataFrame(result, columns=['Month',
'TotalSales'])
df.plot(x='Month' , y='TotalSales')
pyplot.title('Total Monthwise Sales')
pyplot.show()
myconnection.close()

except Exception as e:
print(e)
Function.py

def region_sales_graph():
dbengine1 =
create_engine("mysql+pymysql://root:1234@localhost/IPProjectD
B")
connection = dbengine1.connect()
regions_query = "SELECT DISTINCT Region FROM Sales;"
regions_df = pd.read_sql(regions_query, connection)
print("Select a region from the following list:")
for index, row in regions_df.iterrows():
print(f"{index + 1}. {row['Region']}")

region_index = int(input("Enter the number corresponding


to the region: ")) - 1
selected_region = regions_df.loc[region_index, 'Region']

query = f"""
SELECT Manager, SUM(Sale_amt) AS SalesRevenue
FROM Sales
WHERE Region = '{selected_region}'
GROUP BY Manager;
"""

df = pd.read_sql_query(query, connection)
df.plot.bar(x='Manager',y='SalesRevenue')
pyplot.title(f'{selected_region} Region - Sales Revenue
by Manager')
pyplot.show()

def sales_person_graph():
dbengine1 =
create_engine("mysql+pymysql://root:1234@localhost/IPProjectD
B")
connection = dbengine1.connect()
Function.py

query = f""" select salesman ,sum(sale_amt) AS SalesRevenue


from sales GROUP BY salesman; """
df = pd.read_sql_query(query, connection)
df.plot.bar(x='salesman',y='SalesRevenue')
pyplot.title(" Sales Revenue - SALESMAN")
pyplot.show()
connection.close()
def insert_query(lst_of_record,table_name = "sales"):
con = sqLtor.connect(host = 'localhost' ,user = 'root' ,
passwd = '1234' , database = "IPProjectDB")
tup_of_records = tuple(lst_of_record)
mycursor = con.cursor()
query = f"insert into {table_name} values (%s , %s , %s ,
%s ,%s , %s , %s ,%s)"
mycursor.execute(query, tup_of_records)
print("Data Enter Successfully")
con.commit()
con.close()

def delete_query(userdate , unit_enter, item_enter ,tbname =


"sales", ):
con = sqLtor.connect(host = 'localhost' ,user = 'root' ,
passwd = '1234' , database = "IPProjectDB")
mycursor = con.cursor()

query = f"delete from {tbname} where Orderdate =


{userdate} and units = {unit_enter} and item = {item_enter}"
mycursor.execute(query)
con.commit()
con.close()
Function.py

def LoginId():
import random
letters =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
login_id = ''
for i in range(2):
login_id += random.choice(letters)
for i in range(2):
login_id += random.choice(letters)
for j in range(2):
numbers = random.randint(0, 10)
login_id += str(numbers)
for j in range(2):
numbers = random.randint(0, 10)
login_id += str(numbers)
return login_id

# Function - 2 ==> This Function Prevent Repetition Of User Name


def unique_(matchcase):
df = pd.read_csv("user.csv", names=["UserName", "LoginId"])
for row in df.itertuples():
lst_of_data = list(row)
user_name = lst_of_data[1]
if str(user_name).capitalize() ==
str(matchcase).capitalize():
return False

def AlphaInUserName(username):
letters =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
total = 0
for letter in letters :
if letter in username:
if len(str(username)) >= 4 and len(str(username)) < 12:
return True
User.csv

#==================================================
==
# Default username and password
#==================================================
===
admin,123e
TABLES
CREATED

Database name:IPProjectDB
SALES

Field Type Null Key Default Extra

OrderDate date Yes Null

Region varchar(30) Yes Null

Manager varchar(30) Yes Null

SalesMan varchar(30) Yes Null

Item varchar(20) Yes Null

Units int(11) Yes Null

Unit_price float Yes Null

Sale_amt float Yes Null


OUTPUT
SCREENSHOTS
OUTPUT
SCREENSHOTS
OUTPUT
SCREENSHOTS
BIBLIOGRAPHY

Pandas Documentation:

● Pandas Documentation - Essential for


understanding and using pandas library
for data manipulation.

MySQL Documentation:

● MySQL Documentation - A comprehensive


guide for MySQL, used in the project for
database management.

Matplotlib Documentation:

● Matplotlib Documentation - Reference for


creating visualizations using the
Matplotlib library.

SQLAlchemy Documentation:

● SQLAlchemy Documentation - Useful for


understanding SQLAlchemy, used for
database interaction in the project.

Informatics Practices Class 12 Textbooks:

● Reference your Informatics Practices


textbooks, as they may cover relevant
concepts and methodologies.

You might also like