You are on page 1of 23

INFORMATICS PRACTICS PROJECT

_________________________________________________________________________________________

Sales Management System


INFORMATICS PRACTICES
PROJECT

DEVELOPED BY:
Lakshya Soni

All Saints’ Sr. Sec. School

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

INDEX
S No. Description Page No.
1. Certificate 3
2. Acknowledgement & References 4
3. Introduction to Python 5
4. Introduction to Pandas 7
5. Introduction to Matplotlib 9
6. Source Code 11
7. Output Screen 16
8. Hardware & Software Requirement 20

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

CERTIFICATE
This is to certify that Sales Management System Informatics
Practices project is developed by Lakshya Soni, Rishabh
Khoal and Mansi Saini under my supervision in the computer
lab of All Saints’ Sr. Sec. School in the session 2023-2024. The
work done by them is original.

Sharon Amus
Informatics Teacher
Date: 8/12/2023

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

ACKNOWLEDGEMENT

I would like to express my sincere gratitude to my computer


teacher Sharon Amus for her vital support, guidance and
encouragement without which this project would not come
forth from my side. Who helped me completing the project
by giving ideas, thoughts and made this project easy and
accurate.
I wish to thank my parents for their undivided support and
interest who inspired me and encouraged me to go my own
way, without which I would be unable to complete my
project.

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

INTRODUCTION TO PYTHON
**Introduction to Python Programming**

Python is a versatile and powerful high-level programming language that has


gained immense popularity for its simplicity, readability, and flexibility.
Guido van Rossum created Python in the late 1980s, and it has since evolved
into a widely-used language for a variety of applications, ranging from web
development to scientific computing.

**1. ** **Ease of Learning:**


One of Python's standout features is its clean and straightforward syntax.
Readability is a key focus, and its code is designed to be easily
understandable, making it an excellent choice for beginners and experienced
developers alike. The indentation-based block structure eliminates the need
for curly braces or keywords, contributing to code clarity.

**2. ** **Versatility:**

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

Python is a general-purpose programming language suitable for a wide array


of applications. Whether you're developing web applications using frameworks
like Django or Flask, scripting tasks, data analysis with libraries such as
NumPy and Pandas, or building machine learning models using TensorFlow or
PyTorch, Python provides the tools and libraries to get the job done.

**3. ** **Large Standard Library:**


Python comes with an extensive standard library that simplifies many common
programming tasks. This library includes modules for file I/O, networking,
regular expressions, and more. This wealth of built-in functionality helps
developers accomplish tasks efficiently without having to reinvent the wheel.

**4. ** **Community and Support:**


The Python community is vibrant and supportive. An abundance of
documentation, tutorials, and forums make it easy for developers to find help
and resources. Python's open-source nature encourages collaboration, and a
vast number of third-party packages and frameworks are available, further
expanding its capabilities.

**5. ** **Cross-Platform Compatibility:**


Python is platform-independent, meaning you can write code on one
operating system and run it on another with minimal adjustments. This cross-
platform compatibility makes it an excellent choice for developing
applications that need to run on various systems.

**6. ** **Dynamic Typing:**


Python uses dynamic typing, allowing developers to create more flexible and
adaptable code. Variables don't need explicit declarations, making the
development process more agile. This dynamic nature enhances code
readability and simplifies maintenance.

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

Introduction to Pandas
**Introduction to Pandas: Data Manipulation with Python**

Pandas is a powerful open-source library for data manipulation and analysis in


Python. Developed by Wes McKinney, Pandas provides data structures and
functions that simplify working with structured data, making it a fundamental
tool for tasks such as data cleaning, exploration, and preparation.

**1. Data Structures:**

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

Pandas introduces two primary data structures: Series and DataFrame. A


Series is a one-dimensional array with labeled indices, while a DataFrame is a
two-dimensional table with labeled rows and columns. These structures are
highly flexible and can handle a wide variety of data types.

**2. Data Cleaning and Preparation:**


Pandas excels in handling missing data, duplicate entries, and outliers. It
offers methods for filling in missing values, dropping duplicates, and
transforming data to the desired format. This makes it an essential tool for
preparing datasets before analysis or modeling.

**3. Data Exploration:**


With Pandas, you can quickly explore and understand your data. Descriptive
statistics, summary functions, and various data visualization tools help
uncover patterns, trends, and outliers in your datasets. This facilitates a
deeper understanding of the data's characteristics.

**4. Data Indexing and Selection:**


Pandas allows for intuitive indexing and selection of data. You can use labels,
boolean indexing, or even SQL-like queries to extract specific portions of your
dataset. This flexibility simplifies the process of isolating and working with
subsets of your data.

**5. Grouping and Aggregation:**


Pandas supports grouping data based on specified criteria and performing
aggregations on the groups. This functionality is invaluable for tasks like
calculating summary statistics for different groups in your dataset. The
combination of grouping and aggregation allows for efficient analysis of large
datasets.

**6. Time Series Analysis:**

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

Pandas has robust support for time series data. It includes functionalities for
resampling, time zone handling, and date range generation. These features
make Pandas a preferred choice for working with time-stamped data, common
in financial, scientific, and business applications.

**7. Integration with Other Libraries:**


Pandas seamlessly integrates with other popular Python libraries such as
NumPy, Matplotlib, and scikit-learn. This integration enhances its capabilities
and makes it part of a powerful ecosystem for data analysis, visualization, and
machine learning.

**8. Flexibility and Extensibility:**


Pandas provides the flexibility to handle various file formats, including CSV,
Excel, SQL, and more. Additionally, it allows users to define custom functions
and operations, extending its capabilities according to specific needs.

In summary, Pandas is a crucial tool for any data scientist, analyst, or


developer working with structured data in Python. Its user-friendly and
expressive API simplifies complex data manipulation tasks, making it an
indispensable library for data cleaning, exploration, and preparation in
diverse domains.

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

Introduction to Matplotlib

**Introduction to Matplotlib: Data Visualization in Python**

Matplotlib is a comprehensive and widely-used 2D plotting library for Python.


Created by John D. Hunter, Matplotlib provides a flexible and versatile
platform for creating static, animated, and interactive visualizations.
Whether you're a scientist, engineer, or data analyst, Matplotlib is a go-to tool
for conveying insights and trends in your data through compelling visual
representations.

**1. Simple and Powerful Plotting:**


Matplotlib offers a straightforward and easy-to-use interface for creating a
wide range of plots, including line plots, scatter plots, bar plots, histograms,
and more. Its simplicity allows users to quickly generate basic plots while
offering extensive customization options for advanced users.

**2. Publication-Quality Figures:**


Matplotlib is designed to create high-quality, publication-ready figures. Users
have precise control over every element of a plot, from colors and line styles
to text annotations and axis properties. This level of control ensures that the
produced visualizations meet professional standards.

**3. Multifunctional Plotting:**


Beyond basic plots, Matplotlib supports complex visualizations like contour
plots, 3D plots, and heatmaps. This versatility makes it suitable for a wide
array of applications, from scientific research and engineering to business
analytics and data exploration.

**4. Seamless Integration with NumPy:**


Matplotlib seamlessly integrates with NumPy, a fundamental library for
numerical computing in Python. This integration allows users to plot data
directly from NumPy arrays, making it a natural choice for visualizing
scientific and mathematical data.

**5. Interactive Plotting:**


Matplotlib provides interactive plotting capabilities through tools like Jupyter
Notebooks and interactive backends. This interactivity is particularly useful
for data exploration and analysis, enabling users to zoom in, pan, and interact
with plots in real-time.

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

**6. Large and Active Community:**


Matplotlib boasts a large and active community of users and contributors. This
community support ensures a wealth of tutorials, examples, and forums where
users can seek help, share insights, and stay updated on the latest
developments in the library.

**7. Matplotlib and Data Science Ecosystem:**


Matplotlib is a cornerstone of the Python data science ecosystem and is often
used in conjunction with other libraries like NumPy, Pandas, and scikit-learn.
This integration allows users to seamlessly incorporate visualizations into their
data analysis and machine learning workflows.

**8. Extensibility:**
Matplotlib is extensible, enabling users to create custom plots and
visualizations. Additionally, the library supports various backends, allowing
users to choose the most suitable rendering environment for their specific
needs, whether it's generating static images or interactive plots.

In conclusion, Matplotlib stands as a powerful and flexible tool for data


visualization in Python. Its simplicity, customization options, and broad range
of supported plot types make it a versatile choice for users across different
domains, contributing significantly to the effective communication of insights
derived from data.

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

Overview of the Project

1. **Imports:**
- `pandas` is used for data manipulation and analysis.
- `date` from the `datetime` module is used to handle date-related operations.
- `csv` is used to read and write CSV files.
- `matplotlib.pyplot` is used for plotting graphs.

2. **Main Function (`main()`):**


- Asks the user to choose between User and Manager roles.
- If User is selected, it calls the `user()` function.
- If Manager is selected, it prompts for a password. If the password is correct, it calls
the `manager()` function; otherwise, it prompts for the password again.

3. **User Functions:**
- `user()`: Provides options for checking products, buying a product, canceling an
order, or exiting.
- `cproducts()`: Lists available products.
- `buy()`: Takes input for buying a product and adds the order to the orders CSV file.
- `cancel()`: Takes input for canceling an order and removes the order from the
orders CSV file.

4. **Manager Functions:**
- `manager()`: Provides options for adding products, showing products, deleting
products, checking orders, showing sales graphs, or exiting.
- `add()`: Takes input for adding a new product and adds it to the products CSV file.
- `products()`: Lists available products.
- `delete()`: Takes input for deleting a product and removes it from the products CSV
file.
- `coders()`: Lists the orders.
- `sales_plot()`: Generates a bar chart showing total sales for each product.

5. **Sales Graph:**
- Loads orders and products data from CSV files using pandas.
- Groups products by name and calculates the total sales.
- Generates a bar chart using matplotlib to visualize the total sales for each product.

6. **Execution:**

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

- The `main()` function is called to start the program.

Source Code
import pandas as pd
from datetime import date
import csv
import matplotlib.pyplot as plt

def main():
print("1. User 2. Manager ")
c= input('Enter Choice : ')
if c=="1":
user()
elif c=='2':
p= input('Enter Password : ')
if p== '3443':
manager()
else:
print("Incorrect Password")
main()

else:
main()
def user():
print('1. Check Products. 2. Buy a Product. 3. Cancel Order. 4.Exit.')
c = input('Enter Choice : ')
if c== '1':
cproducts()
elif c =='2':
buy()
elif c=='3':
cancel()
elif c=='4':
main()
else:
user()
def cproducts():
l=r'D:\Sales Managment System\products.csv'
with open(l,'r')as cf:

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

cw = csv.reader(cf)
cd = pd.DataFrame(cw)
print('|-------------------------------------|')
for i in cd.index:
x=list(cd.loc[i])
print('PID : ',i)
print('NAME : ',x[0])
print('COST : ',x[1])
print('REMARKS : ',x[2])
print('|-------------------------------------|')
cf.close()
user()
def buy():
p=input('Product ID: ')
n=input('Your Name : ')
a=input('Address : ')
t = date.today()
row = [p,n,a,t]
print('Kindly Pay On Delivery')
ol =r'D:\Sales Managment System\oders.csv'
with open(ol,'a+',newline='')as cf:
cw = csv.writer(cf)
cw.writerow(row)
cf.close()
user()
def cancel():
p=input('Product ID : ')
n = input('Your Name : ')
a = input('Address : ')
t= input('Date')
row=[p,n,a,t]
l = r'D:\Sales Managment System\oders.csv'
with open(l,'r+')as cf:
cw = csv.reader(cf)
cd = pd.DataFrame(cw)
for i in cd.index:
x = list(cd.loc[i])
if row== x:
cd.drop([i],inplace=True)
cf.close
with open(l,'w',newline='') as cf:
cw=csv.writer(cf)

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

for i in cd.index:
x = list(cd.loc[i])
cw.writerow(x)
cf.close()
user()
def manager():
print('1. Add Products. 2. Show Products. 3. Delete. 4. Check Order.
5. Show Sales Graph. 6.exit')
c=input('Enter Choice : ')
if c == '1':
add()
elif c=='2':
products()
elif c=='3':
delete()
elif c=='4':
coders()
elif c=='5':
sales_plot()
elif c=='6':
main()
else:
manager()
def add():
n=input('Name : ')
c = input('Cost : ')
d = input('Details : ')
row = [n,c,d]
l=r'D:\Sales Managment System\products.csv'
with open(l,'a+',newline='')as cf:
cw =csv.writer(cf)
cw.writerow(row)
cf.close()
manager()
def products():
l=r'D:\Sales Managment System\products.csv'
with open(l,'r')as cf:
cw= csv.reader(cf)
cd= pd.DataFrame(cw)
print('|-------------------------------------|')
for i in cd.index:
x = list(cd.loc[i])

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

print('PID : ',i)
print('NAME : ',x[0])
print('COST : ',x[1])
print('REMARKS : ',x[2])
print('|-------------------------------------|')
cf.close()
manager()
def delete():
d = int(input('Enter PID : '))
l= r'D:\Sales Managment System\products.csv'
with open(l,'r+')as cf:
cw = csv.reader(cf)
cd = pd.DataFrame(cw)
cd.drop([d],inplace=True)
cf.close()
with open(l,'w',newline='') as cf:
cw = csv.writer(cf)
for i in cd.index:
x = list(cd.loc[i])
cw.writerow(x)
cf.close()
manager()
def coders():
l=r'D:\Sales Managment System\oders.csv'
with open(l,'r')as cf:
cw = csv.reader(cf)
cd = pd.DataFrame(cw)
print('|-------------------------------------|')
for i in cd.index:
x = list(cd.loc[i])
print('PID : ',x[0])
print('NAME : ',x[1])
print('ADDRESS : ',x[2])
print('DATE : ',x[3])
print('|-------------------------------------|')
cf.close()
manager()

def sales_plot():

# Load the orders CSV data with tab delimiter and set the column names

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

orders_df = pd.read_csv(r'D:\Sales Managment System\oders.csv', delimiter='\t',


names=["Product ID", "Name", "Address", "Date"])

# Load the products CSV data with appropriate column names


products_df = pd.read_csv(r'D:\Sales Managment System\products.csv',
names=["Name", "Cost", "Remarks"])

# Load the orders CSV data with tab delimiter and set the column names
orders_df = pd.read_csv(r'D:\Sales Managment System\oders.csv', delimiter='\t',
names=["Product ID", "Name", "Address", "Date"])

# Group the DataFrame by the `Name` column and sum the `Cost` column
total_sales = products_df.groupby('Name')['Cost'].sum()

# Create a bar chart of the total sales for each product


plt.bar(total_sales.index, total_sales.values)
plt.xlabel('Product Name')
plt.ylabel('Total Sales')
plt.title('Total Sales by Product')
plt.show()
manager()

main()

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

Output Screens:

User Login

1. Check Products to Purchase:

2. Buy a Product:

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

3. Cancel Order:

4. Exit to Main Menu:

Manager Login
1. Password Verification :

2. Adding Products :

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

3. Show all Products Listed in Shop:

4. Delete a Product:

5. Check for Orders:

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

6. Showing Sales Graph:

7. Going back to main menu:

Sales Managment System


INFORMATICS PRACTICS PROJECT
_________________________________________________________________________________________

Hardware Requirement:
Pentium 3/4/Core 2 Duo/Dual core/Pentium/i3/i5/i7, 256
MB RAM
2 MB free space on Hard Disk Colour
Monitor/LCD

Operating System & Compiler


MS Windows
Python with related libraries used of Data Analysis
Pandas
Matplotlib
Numpy

Sales Managment System

You might also like