0% found this document useful (0 votes)
12 views18 pages

Nikki Cs Project

Yaa tell us

Uploaded by

msarathikavya
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)
12 views18 pages

Nikki Cs Project

Yaa tell us

Uploaded by

msarathikavya
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/ 18

VELAMMAL VIDHYASHRAM

SURAPET

COMPUTER SCIENCE PROJECT

TOPIC: EXPENSE MANAGEMENT

NAME: S.NIKHILESH
CLASS: 12
ROLL NUMBER:
BATCH NO:
DATE:

SSCE -2024 -2025


1
BONAFIDE CERTIFICATE

This is to certify that this COMPUTER SCIENCE Project on the topic

" ” has been successfully completed by

of class , Roll.no at Velammal Vidhyashram Surapet,

for the partial fulfilment of Computer Science Practical examination conducted by

Senior School Certificate Examination-CBSE, New Delhi for the academic Year

2024 - 2025.

Date: …………………….

Signature of Principal Teacher Incharge

Signature of the Signature of the


Internal Examiner External Examiner

2
ACKNOWLEDGEMENT

Apart from the efforts taken by me, the success of the project depends largely on the
encouragement and guidelines of many others. I take this opportunity to express my gratitude
to the people who have been instrumental in the successful completion of this project.

I express deep sense of gratitude to almighty God for giving me the strength to
complete the project successfully.

I express my heartfelt gratitude to my parents for the constant encouragement while


carrying out this project.

I express my deep sense of gratitude to the luminary, the Principal of Velammal


Vidhyashram, who has been continuously motivating and extending a helping hand to us.

My sincere thanks to MR. R RAHUL a guide, mentor, above all a friend, who
critically reviewed my project and guided me during the implementation of the project.

The guidance and support received from all the members who contributed, was vital
for the success of the project. I am grateful for their constant support and help.

Signature of the Student

3
TABLE OF CONTENT
S NO. TOPICS PAGE
NO.
1 ABSTRACT 5

2 SYSTEM CONFIGURATION 5

3 INTRODUCTION 7

4 OBJECTIVES OF THE PROJECT 7

5 LIBRARIES AND FUNCTIONS USED 8

6 MYSQL QUERIES USED IN THIS PROJECT 10

7 SOURCE CODE 10

8 OUTPUT (SCREENSHOT) 16

9 CONCLUSION 18

10 BIBLIOGRAPHY 18

4
ABSTRACT:
The Expense Management System is a Python-based software application
designed to help individuals or businesses efficiently track, manage, and analyze their
financial transactions. This project offers users a simple and intuitive interface to input and
categorize their expenses, providing a comprehensive overview of their financial activities.
The system allows users to record daily expenses, categorize them by type (e.g., food,
entertainment, bills, etc.), and generate periodic reports to track spending patterns over time.
Key features of the project include:

1. Expense Recording: Users can log their expenses, specifying the amount, category, and
date of each transaction.

2. Categorization: Expenses can be categorized for better tracking (e.g., groceries, rent,
utilities, etc.).

3. Data Storage: The system uses a file-based approach (or a database, if preferred) to
store records, ensuring that users' data is persistent across sessions.

4. Reporting: Users can view summary reports of their spending over different time
periods (daily, weekly, monthly) to analyze spending habits and make informed
financial decisions.

This Python project is implemented using libraries such as Tkinter (for GUI development),
SQL(for data storage). It aims to streamline personal financial management, providing an
easy way to track and analyze daily expenses, helping users to stay within budget and make
better financial choices.

SYSTEM CONFIGURATION:
HARDWARE CONFIGURATION
Microsoft windows 7 professional/windows 8/windows 8.2:
● Processor : Intel Core i3 or equivalent
● Memory : 2 GB (32-bit), 4 GB (64-bit)
● Disk space : 1.5 GB of free disk space
5
SOFTWARE REQUIREMENTS
● 1 GB RAM (2 GB+ recommended)
● 9-58 GB free hard disk space depending on edition and configuration, including
space required for temporary files
● DVD-ROM drive (if installing from a Media Kit DVD)
● Basic GPU – Any vendor DirectX 9.0 class or better (Pixel Shader Level 2)
● Intel® Pentium® or compatible, 1.6 GHz minimum (2GHz+ recommended)
● 1024x768 or higher-resolution monitor

● MOUSE OR OTHER POINTING DEVICE

6
INTRODUCTION

The Expense Management System project serves as a practical tool for individuals or
small businesses to take control of their finances. By allowing users to track expenses, set
budgets, and visualize spending trends, the system provides the necessary functionality to
promote better financial decision-making. Whether it's for personal budgeting or small business
management, this project helps users maintain financial discipline, avoid unnecessary
expenditures, and ultimately achieve greater financial stability.

OBJECTIVES OF THE PROJECT


The primary objectives of the Expense Management System project are
designed to help users effectively manage their finances by tracking, analyzing, and controlling
their expenses. The key objectives of this project include:

1. Expense Tracking:
o To provide an easy-to-use platform where users can log all their financial
transactions, including the amount, date, and category of each expense. This allows
for accurate and consistent tracking of daily spending.

2. Budget Management:
o To enable users to set budget limits for different expense categories (e.g., groceries,
utilities, entertainment, etc.) and receive alerts when spending exceeds the allocated
budget. This helps users stay within their financial limits.

3. Categorization of Expenses:
o To organize expenses into predefined categories (e.g., food, rent, transportation,
etc.) to provide a clearer picture of where money is being spent and help users
identify areas of excessive spending.

4. Financial Reporting:
o To generate detailed and summary reports that display the user's financial activity
over different time periods (daily, weekly, monthly). These reports help users assess
their spending behavior, make informed decisions, and identify trends.

5. Enhanced Financial Awareness:


o To raise the user’s awareness of their financial habits, encouraging them to make
more conscious spending decisions by displaying categorized spending breakdowns
and trends over time.

7
6. Ease of Use and Accessibility:
o To develop an intuitive and user-friendly interface that enables individuals,
regardless of their technical skills, to easily input and manage their expenses
without any complexity.

7. Expense Comparison:
o To allow users to compare expenses over different periods (monthly, weekly, etc.),
helping them track their financial progress and identify if they are improving in
terms of budgeting and savings.

8. Data Persistence:
o To store expense records in a secure and persistent database (e.g., SQLite), so users’
financial information remains intact across multiple sessions and devices.

9. Notification System:
o To implement notifications or alerts for users when they approach or exceed their
set budget, providing proactive reminders to help maintain financial discipline.

By achieving these objectives, the Expense Management System aims to help individuals or
businesses gain control over their finances, track their expenses with accuracy, and make
informed decisions to improve their financial health over time.

LIBRARIES AND FUNCTIONS USED:

1. MYSQLCONNECTOR - MySQL Connector/Python enables Python programs to access


MySQL databases, using an API that is compliant with the Python Database API
Specification v2.0 (PEP 249). It is written in pure Python and does not have any
dependencies except for the Python Standard Library.
2. Tkinter module - Tkinter is the standard Python interface to the Tk GUI toolkit. It is the
most commonly used library for creating Graphical User Interfaces (GUIs) in
Python. Tkinter allows developers to create windows, buttons, labels, text boxes, menus,
and other widgets in a Python application. It provides a simple and efficient way to build
interactive
user interfaces for desktop applications.

8
FUNCTIONS USED:

1. Add_expense() - This function is used to add the expense at the particular date and time

2. Get_expenses( ) – This function is used to retrieve the data from the user’s input

3. Generate_report( ) – This function is used to generate the report category wise

4. Generate_monthy_report( ) – This function is used to generate a report of the monthly


expenses

5. close() - If you are not going perform any of the above operation we
can come out of the login

9
SQL QUERIES:

SOURCE CODE:
import tkinter as tk
from tkinter import ttk, messagebox
import mysql.connector
import datetime

# Class to manage the expense tracker with MySQL database

class ExpenseTracker:
def init (self, host="localhost", user="root", password="enter_your_password",
database="expense_tracker"):
# Connect to MySQL database
self.conn = mysql.connector.connect(
host='localhost',
user='root',
password='enter_your_password',
database='expense_tracker'
)
self.cursor = self.conn.cursor()

# Create the expenses table if it doesn't exist


self.cursor.execute('''
CREATE TABLE IF NOT EXISTS expenses (
id INT AUTO_INCREMENT PRIMARY KEY,
category VARCHAR(255) NOT NULL,
amount FLOAT NOT NULL,
date DATE NOT NULL
10
)
''')
self.conn.commit()

def add_expense(self, category, amount, date=None):


"""Add a new expense to the database."""
if not date:
date = datetime.datetime.today().strftime('%Y-%m-%d')

query = "INSERT INTO expenses (category, amount, date) VALUES (%s, %s, %s)"
self.cursor.execute(query, (category, amount, date))
self.conn.commit()
return f"Expense added: {category} - ${amount:.2f} on {date}"

def get_expenses(self, month=None, year=None):


"""Retrieve all expenses or expenses for a particular month/year from the database."""
if month and year:
query = "SELECT * FROM expenses WHERE MONTH(date) = %s AND YEAR(date) =
%s"
self.cursor.execute(query, (month, year))
else:
self.cursor.execute("SELECT * FROM expenses")
return self.cursor.fetchall()

def generate_report(self):
"""Generate a report of total expenses and expenses by category."""
self.cursor.execute("SELECT SUM(amount) FROM expenses")
total_expenses = self.cursor.fetchone()[0]
total_expenses = total_expenses if total_expenses else 0

self.cursor.execute("SELECT category, SUM(amount) FROM expenses GROUP BY


category")
category_summary = self.cursor.fetchall()

report = f"Total Expenses: ${total_expenses:.2f}\n\nExpenses by Category:\n"


for category, amount in category_summary:
report += f"{category}: ${amount:.2f}\n"

return report

def generate_monthly_report(self, month, year):


11
"""Generate a report of total monthly expenses."""
self.cursor.execute("SELECT SUM(amount) FROM expenses WHERE MONTH(date) =
%s AND YEAR(date) = %s", (month, year))
total_expenses = self.cursor.fetchone()[0]
total_expenses = total_expenses if total_expenses else 0

report = f"Total Expenses for {month}/{year}: ${total_expenses:.2f}\n"

self.cursor.execute("SELECT category, SUM(amount) FROM expenses WHERE


MONTH(date) = %s AND YEAR(date) = %s GROUP BY category", (month, year))
category_summary = self.cursor.fetchall()
report += "\nExpenses by Category:\n"
for category, amount in category_summary:
report += f"{category}: ${amount:.2f}\n"

return report

def close(self):
"""Close the database connection."""
self.cursor.close()
self.conn.close()

# Main Tkinter GUI class


class ExpenseTrackerApp:
def init (self, root):
self.root = root
self.root.title("Personal Expense Tracker")
self.root.geometry("600x450")

# Create an instance of the ExpenseTracker class


self.tracker = ExpenseTracker(host="localhost", user="root", password="yourpassword",
database="expense_tracker")

# Expense form labels and entries


self.category_label = tk.Label(self.root, text="Category")
self.category_label.grid(row=0, column=0, padx=10, pady=5)

self.category_entry = tk.Entry(self.root)
self.category_entry.grid(row=0, column=1, padx=10, pady=5)

12
self.amount_label = tk.Label(self.root, text="Amount ($)")
self.amount_label.grid(row=1, column=0, padx=10, pady=5)

self.amount_entry = tk.Entry(self.root)
self.amount_entry.grid(row=1, column=1, padx=10, pady=5)

# Buttons
self.add_button = tk.Button(self.root, text="Add Expense", command=self.add_expense)
self.add_button.grid(row=2, column=0, columnspan=2, pady=10)

self.view_button = tk.Button(self.root, text="View Expenses",


command=self.view_expenses)
self.view_button.grid(row=3, column=0, columnspan=2, pady=10)

self.view_monthly_button = tk.Button(self.root, text="View Monthly Expenses",


command=self.view_monthly_expenses)
self.view_monthly_button.grid(row=4, column=0, columnspan=2, pady=10)

self.report_button = tk.Button(self.root, text="Generate Report",


command=self.generate_report)
self.report_button.grid(row=5, column=0, columnspan=2, pady=10)

# Month and Year for Monthly Report


self.month_label = tk.Label(self.root, text="Month (1-12):")
self.month_label.grid(row=6, column=0, padx=10, pady=5)

self.month_entry = tk.Entry(self.root)
self.month_entry.grid(row=6, column=1, padx=10, pady=5)

self.year_label = tk.Label(self.root, text="Year:")


self.year_label.grid(row=7, column=0, padx=10, pady=5)

self.year_entry = tk.Entry(self.root)
self.year_entry.grid(row=7, column=1, padx=10, pady=5)

# Treeview to display expenses


self.tree = ttk.Treeview(self.root, columns=("Category", "Amount", "Date"),
show="headings")
self.tree.grid(row=8, column=0, columnspan=2, padx=10, pady=10)

self.tree.heading("Category", text="Category")
13
self.tree.heading("Amount", text="Amount")
self.tree.heading("Date", text="Date")

def add_expense(self):
category = self.category_entry.get()
try:
amount = float(self.amount_entry.get())
except ValueError:
messagebox.showerror("Input Error", "Please enter a valid amount.")
return

if not category:
messagebox.showerror("Input Error", "Please enter a category.")
return

message = self.tracker.add_expense(category, amount)


messagebox.showinfo("Expense Added", message)

# Clear the form fields


self.category_entry.delete(0, tk.END)
self.amount_entry.delete(0, tk.END)

def view_expenses(self):
# Clear the existing entries in the tree
for item in self.tree.get_children():
self.tree.delete(item)

# Retrieve expenses and insert them into the tree


expenses = self.tracker.get_expenses()
for expense in expenses:
self.tree.insert("", "end", values=(expense[1], f"${expense[2]:.2f}", expense[3]))

def view_monthly_expenses(self):
# Get month and year from user input
try:
month = int(self.month_entry.get())
year = int(self.year_entry.get())
except ValueError:
messagebox.showerror("Input Error", "Please enter a valid month (1-12) and year.")
return

14
if not (1 <= month <= 12):
messagebox.showerror("Input Error", "Month must be between 1 and 12.")
return

# Retrieve monthly expenses and display in tree


expenses = self.tracker.get_expenses(month, year)
if not expenses:
messagebox.showinfo("No Expenses", f"No expenses found for {month}/{year}.")
return

# Clear the existing entries in the tree


for item in self.tree.get_children():
self.tree.delete(item)

for expense in expenses:


self.tree.insert("", "end", values=(expense[1], f"${expense[2]:.2f}", expense[3]))

# Generate monthly report


report = self.tracker.generate_monthly_report(month, year)
messagebox.showinfo(f"Monthly Report for {month}/{year}", report)

def generate_report(self):
report = self.tracker.generate_report()
messagebox.showinfo("Expense Report", report)

def close(self):
self.tracker.close()

# Create the main application window


root = tk.Tk()
app = ExpenseTrackerApp(root)

# Start the Tkinter main loop


root.mainloop()

15
SQL Output:

16
PYTHON OUTPUT:

17
CONCLUSION:

In conclusion, the Expense Management System project effectively addresses the


need for an accessible and reliable tool to help individuals and small businesses manage their
finances. By offering key features such as expense tracking, budgeting, categorization, reporting,
and data visualization, it empowers users to gain control over their spending habits and improve
their financial well-being. This project not only enhances the financial management process but
also provides a foundation for future enhancements to meet evolving user needs.

BIBILOGRAPHY:

Computer Science with Python by Sumita Arora for Class 11& 12

HTTPS://WWW.W3SCHOOLS.COM/PYTHON/PYTHON_MYSQL_GETSTARTED.AS P

HTTPS://WWW.TUTORIALSPOINT.COM/PYTHON/PYTHON_DATABASE_ACCESS.

HTM HTTPS://PYTHONSPOT.COM/MYSQL-WITH-PYTHON/

18

You might also like