0% found this document useful (0 votes)
11 views49 pages

Dbms Report Abc

The document outlines a mini-project report for a 'Budget and Expense Tracker' developed by students at Visvesvaraya Technological University as part of their Computer Science curriculum. The project aims to create a full-stack web application that helps users manage their finances through features like expense categorization, budget monitoring, and visual data representation. It emphasizes the practical application of database management concepts and modern web technologies, while also addressing the limitations of traditional expense tracking methods.

Uploaded by

megha200520
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)
11 views49 pages

Dbms Report Abc

The document outlines a mini-project report for a 'Budget and Expense Tracker' developed by students at Visvesvaraya Technological University as part of their Computer Science curriculum. The project aims to create a full-stack web application that helps users manage their finances through features like expense categorization, budget monitoring, and visual data representation. It emphasizes the practical application of database management concepts and modern web technologies, while also addressing the limitations of traditional expense tracking methods.

Uploaded by

megha200520
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/ 49

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

“JnanaSangama”, Machhe, Belagavi, Karnataka-590018

2024 – 2025

DBMS Mini-Project Report


On
“BUDGET and EXPENSE TRACKER”

Submitted in partial fulfilment of the requirement in 4th semester


DBMS Laboratory with Mini-Project work (BCS403)

Bachelor of Engineering
in
Computer Science and Engineering
Submitted by

Megha R (4VM23CS032)
Ramya N (4VM23CS040)
Shashanya G (4VM23CS048)
Shilpa P R (4VM23CS049)

4th Semester

Under the Supervision of


Prof. Namithadevi N N
Assistant Professor
Dept. of CSE, VVIET

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


VIDYA VIKAS INSTITUTE OF ENGINEERING & TECHNOLOGY
#127-128, Mysore - Bannur Road, Alanahally, Mysuru, Karnataka 570028
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Certificate

Certified that DBMS Mini Project Work entitled “Budget and Expense Tracker”
carried Out by Megha R (4VM23CS032), Ramya N (4VM23CS040), Shashanya G
(4VM23CS048), Shilpa P R (4VM23CS049) Bonafide student of VVIET in partial
fulfilment for the award of degree Bachelor of Engineering in COMPUTER
SCIENCE and ENGINEERING as prescribed by VISVESVARYA
TECHNOLOGY UNIVERSITY, BELGAUM during the academic year 2024-25.
It is certified that all corrections/suggestions indicated for internal assessment have
been incorporated in the report deposited in the department library. The project report
has been approved as it satisfies the academic requirement in respect of mini project
work prescribed for the said degree.

_____________________ ____________________
Prof. Namithadevi N N Dr. Somashekhar B M
Assistant Professor HOD, CSE
Acknowledgment
We would like to thank and express our heartfelt gratitude to God almighty for the
abundant blessings without which this project would not have been successful.We
would like to express our sincere gratitude to Late Sri. Vasu Sir, Founder Chairman
of VVIET, Sri.Ritesh Gowda V ,Chairman of VVIET, Sri.Kaveesh Gowda V, Hon
Secretary of VVIET and all management members of VVIET, for their constant
support.
We acknowledge and express our sincere thanks to our beloved Principal Dr.
Karibasappa K, VVIET, Mysuru who is the source of inspiration.
We would like to express our deepest sense of gratitude towards Dr.
Somashekhar B M, Head of the Department, CSE, VVIET, Mysuru for his valuable
suggestions, support, and encouragement.
We would liketo extend our heart felt gratitude to Mrs. Namithadevi N N, Assistant
Professor, Dept. of CSE, for the valuable guidance and advice. We would also like to
thank her for guidance and useful suggestions, which helped us in completing the
project work on time.
We would also thank all other teaching and non-teaching staff of the Computer
Science Department who have directly or indirectly helped us in the completion of this
project. Our thanks and appreciation also go to our family and friends who have
willingly helped us out with their abilities.

Regards,
Megha R
Ramya
Shashanya G
Shilpa P R
Abstract
This mini-project titled Smart Budget and Expense Tracker aims to build a full-stack
web application that empowers users to track, manage, and analyze their financial
activities. With core functionalities such as expense categorization, budget monitoring,
pie chart visualization, and real-time summary, the application not only encourages
disciplined spending but also acts as a comprehensive tool for personal financial
planning.

The application is developed using modern web technologies including HTML, CSS,
JavaScript (optionally React), Node.js with Express.js for backend, and MongoDB for
data persistence.

Our key contributions include a Budget Alert System that notifies users when spending
approaches or exceeds budget limits and Pie Chart Visualization for clear financial
insights.

This project serves as a practical application of DBMS concepts and full-stack


development, making it an ideal mini-project for Computer Science student.
TABLE OF CONTENTS
Chapter 1: Introduction
1.1 Introduction to Expense Tracker
1.2 Background of Study
1.3 Significance
1.4 Objectives
1.5 Scope

Chapter 2: Requirements Analysis


2.1 Functional Requirements
2.2 Non-Functional Requirements
2.3 Problems with Traditional Expense Tracking
2.4 Software & Hardware Requirements
2.5 Frontend & Backend Tech Stack

Chapter 3: System Design


3.1 ER Diagram
3.2 Schema Diagram
3.3 Wireframes / UI Mockups

Chapter 4: Code and Implementation


4.1 Dashboard and Authentication
4.2 Expense Entry Module
4.3 Budget Alert Module (Highlight)
4.4 Pie Chart Visualization
4.5 Summary Calculations (Income/Expense/Balance)
4.6 Code Snippet

Chapter 5: Testing and Evaluation


5.1 Test Plan

Chapter 6: Conclusion
6.1 Summary of Learnings
6.2 Project Impact
6.3 Real-world Applicability
Chapter 7: Future Enhancements
7.1 Login system, export reports, mobile PWA, etc.

Chapter 8: Screenshots:
8.1 Home, Add Entry, Pie Chart, Budget Alert pop-up, etc.

References
Budget and Expense Tracker

Chapter 1
Introduction
1.1 Introduction to Expense Tracker
In the modern era of digital transformation, personal finance management is no longer a luxury—it is
a necessity. The Smart Budget and Expense Tracker is a web-based application built to simplify the
way users manage their income and expenses. The primary aim is to help individuals monitor their
financial activities in a structured, efficient, and visually appealing manner.
This application is tailored for users of all backgrounds, whether students managing limited budgets,
professionals juggling multiple expenses, or families overseeing household finances. By allowing
users to add, categorize, and analyze their income and expenses, the tool ensures that users can take
full control over their financial decisions.
The core technologies used in this application include:
 Frontend: HTML, CSS, JavaScript
 Backend: Node.js with Express.js
 Database: MongoDB for persistent and scalable data storage
Advanced features such as a Budget Alert System ensure that users are notified when their expenses
approach or exceed a defined threshold. Additionally, the inclusion of Pie Chart Visualization offers a
graphical representation of spending patterns, making financial review both engaging and
informative.
In summary, the application acts as a comprehensive personal finance assistant, demonstrating the
powerful intersection of full-stack development and database management system (DBMS)
principles in solving everyday problems.

1.2 Background of Study


With the rise of digital transactions and cashless economies, the visibility of one's own financial
activity is paradoxically decreasing. Swiping a card or tapping a phone at a terminal often doesn’t
carry the same psychological weight as handing over cash, leading many to overspend unknowingly.
Traditional expense tracking solutions—such as notebooks, spreadsheets, or manual logs—lack the
flexibility, accessibility, and real-time feedback necessary for effective personal finance
management. These methods often result in incomplete records, lack of analysis, and poor budgeting
discipline.This gap presents an opportunity to develop a more intelligent and user-oriented solution.
The Smart Budget and Expense Tracker is designed to:
 Digitize financial tracking in a simple and accessible interface
 Offer real-time monitoring and alerts
 Provide categorized breakdowns and trend analyses
 Facilitate the formation of better spending habits

Dept of CSE, VVIET, MYSORE 2024-2025 1


Budget and Expense Tracker

Moreover, from an educational standpoint, this project reflects the real-world application of CRUD
operations, database schemas, API development, data visualization, and responsive web design—
skills essential for a computer science student.
Through this mini-project, we bridge the gap between theoretical DBMS concepts and practical,
impactful software development.

1.3 Significance
The significance of the Smart Budget and Expense Tracker lies in its dual benefit: solving a common
real-life problem and providing a hands-on development experience that deepens the understanding
of DBMS and full-stack systems.
Practical Importance:
Empowers financial literacy: Users learn to understand, interpret, and manage their financial
health.
Encourages budget-conscious behavior: With the help of alerts, users can prevent overspending.
Increases transparency: A clear record of every transaction, categorized and timestamped, gives
users confidence in their budgeting strategy.
Supports goal setting: The app allows users to set financial goals and track progress effectively.
Academic Significance:
Applies key concepts of data persistence, querying, and real-time feedback mechanisms.
Demonstrates backend handling of user data using Node.js and Express.js.
Shows practical implementation of a NoSQL database (MongoDB) for semi-structured data.
Encourages modular design thinking through component-based architecture and RESTful APIs.
In essence, the project is a synergy of technology and personal empowerment, providing tangible
value to both users and developers.

1.4 Objectives
The project’s objectives are aimed at building a full-fledged financial tracker that is not only
functionally sound but also visually and technically robust. The main objectives include:

Functional Objectives:
 To create a responsive and intuitive user interface for income and expense tracking.
 To enable detailed categorization of expenses for better spending analysis.
 To generate summary reports that include total income, expenses, and current balance.
 To allow edit/delete operations on any record, supporting full CRUD functionality.
 To implement a budget setting module that lets users define monthly limits.

Dept of CSE, VVIET, MYSORE 2024-2025 2


Budget and Expense Tracker

Key Features and Contributions:


 Budget Alert System:
 Triggers notifications when expenses exceed 90% of the budget.
 Encourages users to reevaluate their spending before overshooting.
 Pie Chart Visualization:
 Offers a graphical breakdown of expenses by category.
 Simplifies the process of identifying where money is being spent the most.

Educational Objectives:
 To explore and apply DBMS concepts such as schema design and query optimization.
 To utilize backend development with Node.js and Express for handling APIs securely.
 To implement a modular and scalable architecture suitable for future expansions.

1.5 Scope
The scope of the Smart Budget and Expense Tracker is comprehensive yet focused on usability and
modularity. It is designed to cover essential financial tracking needs while leaving room for
advanced future developments.

In-Scope Functionalities:
User Data Entry: Add income/expense entries with date, category, description, and amount.
Data Management: View, edit, and delete transaction records.
Budget Monitoring:
 Set and adjust monthly budgets.
 View remaining budget in real time.
Category Management: Track spending by category (e.g., Food, Rent, Utilities).
Graphical Analysis: Pie charts show distribution of expenses.
Alert System: Pop-up notifications when budget is nearly consumed.

Technical Scope:
 Frontend Technologies: HTML, CSS, JS (optionally React)
 Backend Technologies: Node.js, Express.js
 Database: MongoDB with Mongoose schema modeling
 Responsive Design: Works across desktops and mobile devices

Dept of CSE, VVIET, MYSORE 2024-2025 3


Budget and Expense Tracker

 Modular API Development: Easy to plug in future features


 Future-Ready Architecture:
 Easily extendable to include features such as:
 Login/Signup with Authentication
 PDF/Excel Export Options
 Bar Graphs and Trend Charts
 Multi-user or Family Budget Support
 Mobile App with Offline Mode
In conclusion, the Smart Budget and Expense Tracker serves as a foundation for financial
responsibility and technical excellence. It is simple enough for a casual user yet robust enough to
support real-world scaling and extensibility.

Dept of CSE, VVIET, MYSORE 2024-2025 4


Budget and Expense Tracker

Chapter 2
Requirements Analysis
2.1 Funtional Requirements
Functional requirements define the essential operations and features that the system must support.
For the Smart Budget and Expense Tracker, the core functional requirements include:
 User Input for Financial Records: The system must allow users to add income and expense
records, including attributes such as amount, date, category, and description. These records
should be editable and deletable.
 Category-Based Classification: Each financial transaction must be categorized (e.g., Food,
Transport, Bills, Entertainment), enabling easier analysis and filtering of data.
 Budget Setting and Alerts: Users must be able to define monthly budgets. The system
should continuously monitor expenses and trigger an alert when the spending approaches a
specified threshold, such as 90% of the total budget.
 Visual Reports: The application should generate visual reports like pie charts that show the
distribution of expenses by category. This helps users quickly interpret their spending
behavior.
 Financial Summary: A dashboard must display summary statistics such as total income,
total expenses, and current balance.
 Date-Based Filtering: Users should be able to filter transactions by day, week, or month to
view financial activity over a selected timeframe.

These functionalities ensure a complete user experience for managing and analyzing personal
finances efficiently while fulfilling the goal of promoting responsible budgeting behavior.

2.2 Non – Functional Requirements


Non-functional requirements are critical for determining the performance, scalability, and user
experience of the system. For the Smart Budget and Expense Tracker, these include:
 Usability: The application must have a simple and intuitive user interface so that users of all
ages and backgrounds can easily navigate it without needing technical knowledge. Clear
labels, input validation, and visual cues should enhance user experience.
 Performance: The system should deliver fast response times for data entry, visualization,
and summary calculations. Page loading time must be minimal, especially when handling a
large volume of financial records.
 Scalability: The backend infrastructure should be designed to scale horizontally as the user
base or volume of data increases. MongoDB’s NoSQL nature supports dynamic schema
handling, making it suitable for future feature expansions.
 Security: Though authentication is considered a future enhancement, the current version
must securely handle and store user data. Sensitive data should be sanitized and stored in
protected databases to prevent injection attacks or data leaks.

Dept of CSE, VVIET, MYSORE 2024-2025 5


Budget and Expense Tracker

 Portability: The application should be accessible across different devices, browsers, and
platforms. A responsive layout should ensure that users on mobile, tablet, or desktop can
access the tracker seamlessly.
 Maintainability: The codebase should be modular and well-documented so that future
developers can easily understand and maintain or upgrade it.

Meeting these non-functional requirements ensures that the system is reliable, user-friendly, and
prepared for long-term usage.

2.3 Problems with Traditional Expense Tracking


Despite growing awareness about financial literacy, many individuals still rely on outdated methods
of expense tracking, such as paper logs, notebooks, or Excel spreadsheets. These methods, while
simple, come with a host of challenges that limit their effectiveness in today’s digital world.
One major problem is lack of real-time insights. Users cannot immediately assess how much of their
budget they’ve spent or how their current balance looks. Budget overspending often goes unnoticed
until it is too late. In contrast, a smart application can monitor financial limits and send timely
warnings.
Another limitation is manual effort and human error. Users must enter every detail by hand, and even
small mistakes—like a wrong category or skipped date—can distort overall financial records. These
tools also lack automatic calculations and summaries, increasing the risk of inaccuracy.
Traditional tools are also static and non-visual. There is no graphical representation to analyze
spending trends over time. As a result, users cannot identify problem areas or optimize budgets
without in-depth manual analysis.
Finally, data redundancy and lack of cloud storage mean that data is not easily retrievable across
devices or backed up. If a device is lost, the user loses all records.
Hence, the transition to a digital, cloud-based, interactive system like the Smart Budget and Expense
Tracker addresses all these inefficiencies while offering enhanced features, speed, and ease of use.

2.4 Software and Hardware Requirements


To successfully develop, test, and deploy the Smart Budget and Expense Tracker, a combination of
software tools and minimal hardware is required. These resources ensure the application performs
smoothly in both development and user environments.
Software Requirements:
Frontend Development:
 HTML5: for structuring web content.
 CSS3: for styling the interface.
 JavaScript (or React): for dynamic behavior and interactivity.

Dept of CSE, VVIET, MYSORE 2024-2025 6


Budget and Expense Tracker

Backend Development:
 Node.js: for handling server-side logic.
 Express.js: for routing and API management.
Database:
 MongoDB: NoSQL database to store users' financial data, categories, and settings.
 Mongoose (optional): for schema modeling and validation.
Visualization Tools:
 Chart.js or Google Charts: for generating pie charts and graphical summaries.
 Code Editor: Visual Studio Code or any IDE compatible with JavaScript, Node.js, and
MongoDB.
 Browser: Google Chrome, Mozilla Firefox, or Microsoft Edge for testing UI responsiveness
and performance.

Hardware Requirements:
 A computer with at least:
 Intel i3 processor or higher
 4 GB RAM (minimum)
 512 MB graphics (optional, for smoother rendering)
 Stable internet connection for using cloud database and packages

These requirements ensure that the system runs efficiently during development and meets the basic
conditions for deployment on a typical user’s machine.

2.5 Frontend and Backend Tech Stack


The choice of tech stack is pivotal for the efficiency, scalability, and maintainability of the
application. The Smart Budget and Expense Tracker adopts a modern full-stack architecture, utilizing
proven technologies in both frontend and backend development.
Frontend:
 HTML5 is used to structure content such as forms, tables, and summaries.
 CSS3 ensures a visually appealing and responsive design, with support for media queries and
animations.
 JavaScript handles all client-side interactivity, including form validations, dynamic data
rendering, and event handling.
 Optionally, React.js may be used to build reusable components, optimize UI updates through
a virtual DOM, and improve maintainability.

Dept of CSE, VVIET, MYSORE 2024-2025 7


Budget and Expense Tracker

Backend:
 Node.js is chosen for its non-blocking, event-driven architecture, which is ideal for handling
real-time financial updates.
 Express.js, a lightweight Node.js framework, is used to create RESTful APIs that manage
transactions, retrieve summaries, and communicate with the database securely and efficiently.

Database:
 MongoDB is used for its flexibility in handling financial data. Its document-based structure
aligns well with transaction records and user-specific budgets. Collections for expenses,
income, users, and settings are designed for quick retrieval and analytics.

This technology stack supports modularity, scalability, and future enhancement, and it reflects a solid
understanding of full-stack development within the DBMS framework. It also allows seamless
integration of features like chart generation, budget alerts, and mobile responsiveness.

Dept of CSE, VVIET, MYSORE 2024-2025 8


Budget and Expense Tracker

Chapter 3
Design
3.1 ER Diagram (UML Notation)

Dept of CSE, VVIET, MYSORE 2024-2025 9


Budget and Expense Tracker

3.2 Schema Diagram


The Schema Diagram is a refined and implementation-ready version of the ER diagram. It outlines
how data will be stored in the actual database—specifying collections, document structure, field
types, and relations (in NoSQL like MongoDB, these are typically embedded or referenced).In this
project, the application uses MongoDB, which is a NoSQL database. The schema design favors
flexibility and scalability, which is ideal for storing transaction records with varying details and
evolving user requirements.
Here are the main collections and their schema outlines:
 Users:
{
_id: ObjectId,
name: String,
email: String,
budgetLimit: Number
}
 Transactions:
{
_id: ObjectId,
userId: ObjectId (ref: users),
amount: Number,
type: String ("income" or "expense"),
category: String,
description: String,
date: ISODate
}
 Alerts:
{
_id: ObjectId,
userId: ObjectId (ref: users),
message: String,
timestamp: ISODate
}

Dept of CSE, VVIET, MYSORE 2024-2025 10


Budget and Expense Tracker

 Categories:
{
_id: ObjectId,
name: String
}
 Budgets:
{
_id: ObjectId,
userId: ObjectId,
month: String,
year: Number,
budgetAmount: Number
}

3.3 Wireframes/ UI Mockups


Wireframes serve as the blueprint for the user interface, helping both developers and stakeholders
understand how users will interact with the application. In this project, wireframes were created for
major components like the dashboard, transaction form, budget setup, and report screens.
Key Wireframes:
 Login & Signup Page:
 Simple form with email and password fields.
 Option for new user registration.
 Designed with clear labels and validation feedback.
Dashboard:
 Displays current budget, total income, total expenses, and remaining balance.
 A pie chart shows expense distribution by category.
 A summary bar or table lists recent transactions.

Add Transaction Page:


 Form includes amount, date, category, type (income/expense), and description.
 Drop-down for selecting categories.
 Submit button triggers data validation and storage.

Dept of CSE, VVIET, MYSORE 2024-2025 11


Budget and Expense Tracker

Budget Configuration Page:


 Form for setting monthly budget.
 Displays visual tracker (like a progress bar) indicating budget consumption.

Alerts/Notifications:
 Visual pop-ups or highlighted messages when expenses reach a critical threshold.

These mockups were initially designed on paper or tools like Figma/Balsamiq before coding. They
guide frontend developers in implementing consistent and user-friendly layouts, while also helping
testers understand expected behavior and navigation flow.

Dept of CSE, VVIET, MYSORE 2024-2025 12


Budget and Expense Tracker

Chapter 4
Code and Implementation
4.1 Dashboard and Implementation
The dashboard is the central interface where users interact with their financial data. It provides an
overview of the user's income, expenses, balance, and budget utilization. The dashboard is the first
screen shown after successful login and is designed to be clean, user-friendly, and
responsive.Although full user authentication is considered a future enhancement, a basic version can
be simulated using session-based state handling for the current user during testing. The dashboard
includes:
 A summary card showing Total Income, Total Expenses, and Current Balance
 A budget tracker (progress bar or percentage indicator)
 A pie chart showing expense distribution by category
 A table or list displaying recent transactions

This structure ensures the user has a clear picture of their financial health at a glance.

4.2 Expense Entry Model


This module allows users to add new income or expense entries. The form captures the following:
 Amount
 Date
 Description
 Category (dropdown list)
 Type (radio buttons: Income or Expense)

Once submitted, the entry is validated and stored in the transactions collection in MongoDB.
// Example transaction object
{
userId: "abc123",
amount: 500,
type: "expense",
category: "Food",
description: "Dinner at restaurant",
date: "2025-05-15"
}

Dept of CSE, VVIET, MYSORE 2024-2025 13


Budget and Expense Tracker

All fields are validated using both client-side JavaScript and server-side Express middleware.
Invalid entries are rejected, and users are prompted to correct inputs.

4.3 Budget Alert Model


The Budget Alert System is the standout feature of this project. It notifies users when their expenses
approach or exceed the set monthly budget. Here’s how it works:
Users configure their monthly budget via a simple form.
Each time a new expense is added, the backend checks the current total expense for that month.
If the expenses reach 90% or more of the budget, the system triggers an alert.
Alerts are stored in the alerts collection and also shown on the dashboard as a popup notification or
highlighted banner.
// Alert trigger logic (Node.js + MongoDB)
if (monthlyExpense >= 0.9 * budgetLimit) {
createAlert(userId, "You have reached 90% of your budget!");
}
This proactive feature helps users rethink unnecessary expenses and make adjustments before going
over budget.

4.4 Pie Chart Visualization

To make the spending pattern easily understandable, we implement a pie chart using libraries like
Chart.js or Google Charts. Each category’s total is calculated and passed to the chart renderer to
display the proportion of spending.

const categoryTotals = {

Food: 250,

Travel: 100,

Bills: 150,

Entertainment: 80

};

The chart is rendered on the dashboard and updates dynamically as transactions are added or
removed.

Dept of CSE, VVIET, MYSORE 2024-2025 14


Budget and Expense Tracker

Benefits of this visualization:

 Intuitive overview of category-wise spending


 Helps identify spending leaks
 Enhances financial self-awareness

4.5 Summary Calculations(Income/Expense/Balance)

The dashboard provides users with three key financial summaries:

 Total Income: Sum of all transactions where type = "income"


 Total Expenses: Sum of all transactions where type = "expense"
 Current Balance: Difference between income and expenses

These values are calculated server-side and sent via API on page load.

const income = await Transaction.aggregate([

{ $match: { userId, type: "income" }},

{ $group: { _id: null, total: { $sum: "$amount" } }}

]); const expenses = await Transaction.aggregate([

{ $match: { userId, type: "expense" }},

{ $group: { _id: null, total: { $sum: "$amount" } }}

]); const balance = income.total - expenses.total;

These figures are updated in real-time and visually displayed in cards on the dashboard for clarity.

Dept of CSE, VVIET, MYSORE 2024-2025 15


Budget and Expense Tracker

4.6 CODE SNIPPET

<?php

include('includes/db.php');

$user_id = 1; // Example user id

// Fetch total expenses and budget allocation

$stmt = $pdo->prepare("SELECT b.category, b.amount AS budget, b.alert_threshold,

SUM(CASE WHEN t.type = 'expense' THEN t.amount ELSE 0 END) AS total_spent

FROM budgets b

LEFT JOIN transactions t ON b.user_id = t.user_id AND b.category = t.category

WHERE b.user_id = ?

GROUP BY b.category");

$stmt->execute([$user_id]);

$budgets = $stmt->fetchAll(PDO::FETCH_ASSOC);

?>

<!DOCTYPE html>

<html>

<head>

<title>Budget Alerts</title>

</head>

<body>

<h1>Budget Alerts</h1>

<ul>

<?php foreach ($budgets as $budget): ?>

<li>

<?php

Dept of CSE, VVIET, MYSORE 2024-2025 16


Budget and Expense Tracker

$remaining_budget = $budget['budget'] - $budget['total_spent'];

if ($remaining_budget <= $budget['alert_threshold']) {

echo "Alert: You are nearing your budget limit for " .
htmlspecialchars($budget['category']) . "!";

} else {

echo "No alerts for " . htmlspecialchars($budget['category']) . ".";

?>

</li>

<?php endforeach; ?>

</ul>

</body>

</html>

<?php

include('includes/db.php');

session_start();

// Check if user is logged in

if (!isset($_SESSION['user_id'])) {

header('Location: login.php');

exit;

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

// Get form data

$user_id = $_SESSION['user_id'];

$category = $_POST['category'];

$amount = $_POST['amount'];

Dept of CSE, VVIET, MYSORE 2024-2025 17


Budget and Expense Tracker

// Set alert_threshold to NULL if it is empty

$alert_threshold = !empty($_POST['alert_threshold']) ? $_POST['alert_threshold'] : NULL;

// Validate form inputs

if (!empty($category) && !empty($amount)) {

try {

// Insert data into the budgets table

$stmt = $pdo->prepare("INSERT INTO budgets (user_id, category, amount, alert_threshold)


VALUES (?, ?, ?, ?)");

$stmt->bindValue(1, $user_id);

$stmt->bindValue(2, $category);

$stmt->bindValue(3, $amount);

$stmt->bindValue(4, $alert_threshold, PDO::PARAM_NULL); // Allow NULL for


alert_threshold

$stmt->execute();

echo "Budget allocated successfully!";

} catch (PDOException $e) {

echo "Error: " . $e->getMessage();

} else {

echo "Category and amount are required fields.";

?>

<!DOCTYPE html>

<html>

<head>

Dept of CSE, VVIET, MYSORE 2024-2025 18


Budget and Expense Tracker

<title>Allocate Budget</title>

</head>

<body>

<h1>Allocate Budget</h1>

<form method="POST">

<label for="category">Category:</label>

<input type="text" name="category" required><br>

<label for="amount">Amount:</label>

<input type="number" step="0.01" name="amount" required><br>

<label for="alert_threshold">Alert Threshold (optional):</label>

<input type="number" step="0.01" name="alert_threshold"><br>

<button type="submit">Allocate Budget</button>

</form>

</body>

</html>

<?php

include('includes/db.php');

$user_id = 1; // Example user id

$currency_code = isset($_GET['currency']) ? $_GET['currency'] : 'USD';

// Fetch currency rate

$stmt = $pdo->prepare("SELECT rate FROM currency_rates WHERE currency_code = ?");

$stmt->execute([$currency_code]);

$rate = $stmt->fetchColumn();

// Fetch budgets and convert them

$stmt = $pdo->prepare("SELECT category, amount FROM budgets WHERE user_id = ?");

Dept of CSE, VVIET, MYSORE 2024-2025 19


Budget and Expense Tracker

$stmt->execute([$user_id]);

$budgets = $stmt->fetchAll(PDO::FETCH_ASSOC);

?>

<!DOCTYPE html>

<html>

<head>

<title>Currency Conversion</title>

</head>

<body>

<h1>Budget in <?php echo htmlspecialchars($currency_code); ?></h1>

<form method="GET">

<label for="currency">Choose Currency:</label>

<select name="currency" onchange="this.form.submit()">

<option value="USD" <?php if ($currency_code == 'USD') echo 'selected';


?>>USD</option>

<option value="EUR" <?php if ($currency_code == 'EUR') echo 'selected';


?>>EUR</option>

<option value="CAD" <?php if ($currency_code == 'CAD') echo 'selected';


?>>CAD</option>

</select>

</form>

<table border="1">

<tr>

<th>Category</th>

<th>Budget (Converted)</th>

</tr>

<?php foreach ($budgets as $budget): ?>

Dept of CSE, VVIET, MYSORE 2024-2025 20


Budget and Expense Tracker

<tr>

<td><?php echo htmlspecialchars($budget['category']); ?></td>

<td><?php echo number_format($budget['amount'] * $rate, 2); ?></td>

</tr>

<?php endforeach; ?>

</table>

</body>

</html>

<?php

include('includes/db.php');

session_start();

if (!isset($_SESSION['user_id'])) {

// Redirect to login if not logged in

header('Location: login.php');

exit;

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

$user_id = $_SESSION['user_id']; // Use the logged-in user ID

$type = $_POST['type'];

$category = $_POST['category'];

$amount = $_POST['amount'];

$date = $_POST['date'];

$notes = $_POST['notes'];

// Validate and insert data

Dept of CSE, VVIET, MYSORE 2024-2025 21


Budget and Expense Tracker

if (!empty($type) && !empty($category) && !empty($amount) && !empty($date)) {

try {

$stmt = $pdo->prepare("INSERT INTO transactions (user_id, type, category, amount, date,


notes) VALUES (?, ?, ?, ?, ?, ?)");

$stmt->execute([$user_id, $type, $category, $amount, $date, $notes]);

echo "Transaction logged successfully!";

} catch (PDOException $e) {

echo "Error: " . $e->getMessage();

} else {

echo "All fields are required!";

?>

<!DOCTYPE html>

<html>

<head>

<title>Log Income and Expense</title>

</head>

<body>

<h1>Log Income & Expenses</h1>

<form method="POST">

<label for="type">Type:</label>

<select name="type" required>

<option value="income">Income</option>

<option value="expense">Expense</option>

Dept of CSE, VVIET, MYSORE 2024-2025 22


Budget and Expense Tracker

</select><br>

<label for="category">Category:</label>

<input type="text" name="category" required><br>

<label for="amount">Amount:</label>

<input type="number" step="0.01" name="amount" required><br>

<label for="date">Date:</label>

<input type="date" name="date" required><br>

<label for="notes">Notes:</label>

<textarea name="notes"></textarea><br>

<button type="submit">Log Transaction</button>

</form>

</body>

</html>

<?php include('includes/db.php'); ?>

<?php

session_start();

if (!isset($_SESSION['user_id'])) {

header('Location: login.php');

exit;

if (isset($_SESSION['username'])) {

echo "Welcome, " . htmlspecialchars($_SESSION['username']) . "!";

?>

<!DOCTYPE html>

Dept of CSE, VVIET, MYSORE 2024-2025 23


Budget and Expense Tracker

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Smart Budget Tracker</title>

<link rel="stylesheet" href="css/style.css">

</head>

<body>

<header>

<?php if (isset($_SESSION['user_id'])): ?>

<a href="logout.php">Logout</a>

<?php else: ?>

<a href="login.php">Login</a> | <a href="register.php">Register</a>

<?php endif; ?>

<h1>Welcome to Smart Budget and Expense Tracker</h1>

</header>

<section>

<h2>Track your budget easily</h2>

<a href="income_expense.php" class="button">Log Income & Expenses</a>

<a href="budget.php" class="button">Allocate Budgets</a>

<a href="report.php" class="button">Generate Monthly Report</a>

<a href="prediction.php" class="button">Predict Future Expenses</a>

</section>

<footer>

<p>&copy; 2024 Smart Budget Tracker</p>

Dept of CSE, VVIET, MYSORE 2024-2025 24


Budget and Expense Tracker

</footer>

</body>

</html>

<?php if (isset($_SESSION['user_id'])): ?>

<a href="logout.php">Logout</a>

<?php else: ?>

<a href="login.php">Login</a> | <a href="register.php">Register</a>

<?php endif; ?>

<?php

session_start();

session_unset();

session_destroy();

header('Location: login.php');

exit;

<?php

include('includes/db.php');

session_start();

$user_id = $_SESSION['user_id']; // Use the logged-in user ID

// Fetch expenses for each category over the last 3 months

// Assigning weights to each month (Month 1: weight 1, Month 2: weight 2, Month 3: weight 3)

$query = "

SELECT category,

SUM(CASE WHEN MONTH(date) = MONTH(CURDATE()) - 2 THEN amount * 1 ELSE 0


END) AS month1,

SUM(CASE WHEN MONTH(date) = MONTH(CURDATE()) - 1 THEN amount * 2 ELSE 0


END) AS month2,

Dept of CSE, VVIET, MYSORE 2024-2025 25


Budget and Expense Tracker

SUM(CASE WHEN MONTH(date) = MONTH(CURDATE()) THEN amount * 3 ELSE 0


END) AS month3

FROM transactions

WHERE user_id = ? AND type = 'expense'

AND date >= DATE_SUB(CURDATE(), INTERVAL 3 MONTH)

GROUP BY category

";

$stmt = $pdo->prepare($query);

$stmt->execute([$user_id]);

$expenses = $stmt->fetchAll(PDO::FETCH_ASSOC);

// Calculate weighted average for each category

$predictions = [];

foreach ($expenses as $expense) {

$total_weight = 6; // (1 + 2 + 3)

$weighted_avg = ($expense['month1'] + $expense['month2'] + $expense['month3']) /


$total_weight;

$predictions[] = [

'category' => $expense['category'],

'avg_expenses' => $weighted_avg

];

?>

<!DOCTYPE html>

<html>

<head>

<title>Expense Prediction</title>

Dept of CSE, VVIET, MYSORE 2024-2025 26


Budget and Expense Tracker

</head>

<body>

<h1>Predicted Future Expenses</h1>

<table border="1">

<tr>

<th>Category</th>

<th>Predicted Average Expenses (Weighted)</th>

</tr>

<?php foreach ($predictions as $prediction): ?>

<tr>

<td><?php echo htmlspecialchars($prediction['category']); ?></td>

<td><?php echo number_format($prediction['avg_expenses'], 2); ?></td>

</tr>

<?php endforeach; ?>

</table>

</body>

</html>

<?php

include('includes/db.php');

session_start();

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

$username = $_POST['username'];

$email = $_POST['email'];

$password = password_hash($_POST['password'], PASSWORD_DEFAULT); // Hash the


password

// Check if the user already exists

Dept of CSE, VVIET, MYSORE 2024-2025 27


Budget and Expense Tracker

$stmt = $pdo->prepare("SELECT * FROM users WHERE email = ?");

$stmt->execute([$email]);

if ($stmt->rowCount() > 0) {

echo "User already exists with this email!";

} else {

// Insert the user into the database

$stmt = $pdo->prepare("INSERT INTO users (username, email, password) VALUES (?, ?, ?)");

$stmt->execute([$username, $email, $password]);

echo "Registration successful! You can now <a href='login.php'>login</a>.";

?>

<!DOCTYPE html>

<html>

<head>

<title>Register</title>

</head>

<body>

<h1>Register</h1>

<form method="POST">

<label for="username">Username:</label>

<input type="text" name="username" required><br>

<label for="email">Email:</label>

<input type="email" name="email" required><br>

<label for="password">Password:</label>

Dept of CSE, VVIET, MYSORE 2024-2025 28


Budget and Expense Tracker

<input type="password" name="password" required><br>

<button type="submit">Register</button>

</form>

</body>

</html>

<?php

include('includes/db.php');

$user_id = 1; // Example user id

// Fetch transactions for the current month

$current_month = date('Y-m');

$stmt = $pdo->prepare("SELECT category, SUM(CASE WHEN type = 'income' THEN amount


ELSE 0 END) AS total_income,

SUM(CASE WHEN type = 'expense' THEN amount ELSE 0 END) AS total_expenses

FROM transactions

WHERE user_id = ? AND DATE_FORMAT(date, '%Y-%m') = ?

GROUP BY category");

$stmt->execute([$user_id, $current_month]);

$transactions = $stmt->fetchAll(PDO::FETCH_ASSOC);

// Fetch allocated budgets

$stmt = $pdo->prepare("SELECT category, amount FROM budgets WHERE user_id = ?");

$stmt->execute([$user_id]);

$budgets = $stmt->fetchAll(PDO::FETCH_ASSOC);

$budget_map = [];

foreach ($budgets as $budget) {

$budget_map[$budget['category']] = $budget['amount'];

Dept of CSE, VVIET, MYSORE 2024-2025 29


Budget and Expense Tracker

?>

<!DOCTYPE html>

<html>

<head>

<title>Monthly Report</title>

</head>

<body>

<h1>Monthly Report for <?php echo date('F Y'); ?></h1>

<table border="1">

<tr>

<th>Category</th>

<th>Total Income</th>

<th>Total Expenses</th>

<th>Budget</th>

<th>Overbudget</th>

</tr>

<?php foreach ($transactions as $transaction): ?>

<tr>

<td><?php echo htmlspecialchars($transaction['category']); ?></td>

<td><?php echo number_format($transaction['total_income'], 2); ?></td>

<td><?php echo number_format($transaction['total_expenses'], 2); ?></td>

<td><?php echo isset($budget_map[$transaction['category']]) ?


number_format($budget_map[$transaction['category']], 2) : 'N/A'; ?></td>

<td>

<?php

Dept of CSE, VVIET, MYSORE 2024-2025 30


Budget and Expense Tracker

$overbudget = isset($budget_map[$transaction['category']]) &&


$transaction['total_expenses'] > $budget_map[$transaction['category']];

echo $overbudget ? 'Yes' : 'No';

?>

</td>

</tr>

<?php endforeach; ?>

</table>

</body>

</html>

<?php

include('includes/db.php');

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

$user_id = 1; // Example user id

$categories = $_POST['categories'];

$amounts = $_POST['amounts'];

$date = $_POST['date'];

$notes = $_POST['notes'];

for ($i = 0; $i < count($categories); $i++) {

$stmt = $pdo->prepare("INSERT INTO transactions (user_id, type, category, amount, date,


notes) VALUES (?, 'expense', ?, ?, ?, ?)");

$stmt->execute([$user_id, $categories[$i], $amounts[$i], $date, $notes]);

echo "Expense split successfully!";

?>

Dept of CSE, VVIET, MYSORE 2024-2025 31


Budget and Expense Tracker

<!DOCTYPE html>

<html>

<head>

<title>Split Expense</title>

</head>

<body>

<h1>Split Expense</h1>

<form method="POST">

<div id="expense-splitter">

<label for="date">Date:</label>

<input type="date" name="date" required><br>

<label for="notes">Notes:</label>

<textarea name="notes"></textarea><br>

<div class="split-group">

<label for="categories[]">Category:</label>

<input type="text" name="categories[]" required><br>

<label for="amounts[]">Amount:</label>

<input type="number" step="0.01" name="amounts[]" required><br>

</div>

<button type="button" onclick="addSplit()">Add Another Split</button><br>

<button type="submit">Submit</button>

</div>

</form>

<script>

function addSplit() {

Dept of CSE, VVIET, MYSORE 2024-2025 32


Budget and Expense Tracker

let splitGroup = document.querySelector('.split-group').cloneNode(true);

document.querySelector('#expense-splitter').appendChild(splitGroup);

</script>

</body>

</html>

<?php

include('includes/db.php');

$user_id = 1; // Example user id

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

$transaction_id = $_POST['transaction_id'];

$notes = $_POST['notes'];

$stmt = $pdo->prepare("UPDATE transactions SET notes = ? WHERE id = ? AND user_id = ?");

$stmt->execute([$notes, $transaction_id, $user_id]);

echo "Notes updated successfully!";

// Fetch transactions

$stmt = $pdo->prepare("SELECT id, category, amount, notes FROM transactions WHERE user_id =
?");

$stmt->execute([$user_id]);

$transactions = $stmt->fetchAll(PDO::FETCH_ASSOC);

?>

<!DOCTYPE html>

<html>

<head>

<title>Add Transaction Notes</title>

Dept of CSE, VVIET, MYSORE 2024-2025 33


Budget and Expense Tracker

</head>

<body>

<h1>Add Notes to Transactions</h1>

<form method="POST">

<label for="transaction_id">Select Transaction:</label>

<select name="transaction_id">

<?php foreach ($transactions as $transaction): ?>

<option value="<?php echo $transaction['id']; ?>">

<?php echo htmlspecialchars($transaction['category']) . ' - $' .


number_format($transaction['amount'], 2); ?>

</option>

<?php endforeach; ?>

</select><br>

<label for="notes">Notes:</label>

<textarea name="notes"></textarea><br>

<button type="submit">Update Notes</button>

</form>

</body>

</html>

Dept of CSE, VVIET, MYSORE 2024-2025 34


Budget and Expense Tracker

CHAPTER 5
TESTING AND EVALUATION

5.1 Test Plan

Testing is a vital phase of any software development lifecycle. It ensures that the system functions as
expected and meets the requirements defined during the analysis phase. For the Smart Budget and
Expense Tracker, a black-box testing approach was followed, focusing on input/output behavior
rather than internal code logic.

Objectives of Testing:

 Validate correctness of core functionalities like expense entry, budget setting, and summary
calculations.
 Confirm user input validation (e.g., disallowing negative or empty values).
 Ensure the Budget Alert System triggers correctly.
 Check performance and responsiveness on multiple devices and browsers.
 Verify pie chart and summary outputs reflect real-time data changes.

Tools Used for Testing:

 Browser Dev Tools (Chrome/Firefox)


 Postman (for API testing)
 MongoDB Compass (for database state validation)
 Manual UI testing (for responsiveness and usability)

Testing Environments:

 Browsers: Google Chrome, Mozilla Firefox


 Devices: Laptop (Windows 10), Android Mobile Browser
 Database: MongoDB Local and Cloud

The test plan included unit testing of individual modules (e.g., add transaction), integration testing of
modules working together (e.g., expense entry + budget alert), and user acceptance testing (UAT) to
ensure overall satisfaction with the interface and logic.

Dept of CSE, VVIET, MYSORE 2024-2025 35


Budget and Expense Tracker

CHAPTER 6
CONCLUSION

6.1 Summary of learning

The development of the Smart Budget and Expense Tracker has been a highly educational and
transformative experience. Through this project, we gained hands-on experience with full-stack web
development and a deeper understanding of Database Management Systems (DBMS). Specifically,
we learned how to:

 Design and implement an end-to-end web application using HTML, CSS, JavaScript,
Node.js, and Express.js.
 Work with MongoDB, a NoSQL database, to store and retrieve structured financial data.
 Implement CRUD operations and manage data models using Mongoose schema design.
 Visualize financial data using tools like Chart.js for intuitive pie chart rendering.
 Apply real-time monitoring through budget alerts and dynamic summary calculations.

We also became familiar with the importance of testing, debugging, and creating modular backend
APIs, which are crucial skills for modern software engineering. Importantly, this project highlighted
the value of user experience design (UX), especially in personal finance tools where clarity and
simplicity are essential.Overall, this mini-project not only improved our technical proficiency but
also emphasized the importance of problem-solving, teamwork, and iterative development.

6.2 Project Impact

The impact of the Smart Budget and Expense Tracker project can be observed on two fronts:
technical and societal.

Technical Impact:

 It provided a full-cycle development experience—from planning and coding to testing and


deployment.
 Served as a practical application of classroom DBMS theory in a meaningful, user-oriented
product.
 Strengthened our grasp of backend routing, frontend form handling, and asynchronous
communication using APIs.

Societal/User Impact:

 The system helps users gain financial awareness and discipline by monitoring income and
expenses in real time.
 Features like budget alerts and visual analysis encourage better spending habits.
 By offering a free and simple-to-use tool, it promotes financial literacy, especially among
students and first-time earners.

In conclusion, the project reflects the potential of technology to solve everyday problems through
accessible and well-designed applications.

Dept of CSE, VVIET, MYSORE 2024-2025 36


Budget and Expense Tracker

6.3 Real World Applicability

The Smart Budget and Expense Tracker is highly applicable in real-world scenarios, offering a
practical solution for individuals seeking better control over their finances. It is especially useful for
students, professionals, and small business owners who need a simple yet effective way to track
income and expenses. With features like real-time budget monitoring, visual insights through pie
charts, and customizable categories, the application promotes financial discipline. Its scalable and
modular architecture allows for future enhancements such as mobile support, report generation, and
multi-user access. With continued development, it has strong potential for deployment as a public
utility or educational tool.

Dept of CSE, VVIET, MYSORE 2024-2025 37


Budget and Expense Tracker

CHAPTER 7
FUTURE ENHANCEMENTS

As a scalable and modular application, the Smart Budget and Expense Tracker offers a wide range of
possibilities for future development. While the current system fulfills the essential functions of
personal finance tracking, the following enhancements could significantly improve functionality,
user experience, and system robustness:

 User Authentication and Role Management


Currently, the system operates in a single-user mode for demonstration purposes.
Implementing a secure user authentication module would enable multiple users to maintain
private accounts. This can be achieved using JWT (JSON Web Tokens) or OAuth protocols.
Additionally, role-based access (e.g., admin vs. user) could be introduced for managing group
or family budgets.
 PDF and Excel Report Generation
To help users review or share their financial data offline, the application can be extended to
export summaries and transaction history as downloadable PDF or Excel reports. Libraries
such as jsPDF and xlsx can be integrated into the frontend to support this feature.
 Additional Chart Types and Analytics
Currently, the system uses a pie chart for expense visualization. In the future, bar graphs, line
charts, or monthly trend analysis can be added to track financial behavior over time. This will
allow users to identify spending patterns, set financial goals, and monitor their progress.
 Responsive Mobile App / PWA
Making the app mobile-friendly is essential for real-world usability. This could be achieved
by designing a Progressive Web App (PWA) or developing a mobile application using React
Native or Flutter, enabling users to access their financial dashboard anytime, anywhere.
 AI-Based Budget Recommendations
A more advanced enhancement would be to use machine learning algorithms to suggest
monthly budgets based on user history. AI can also identify unusual spending and provide
tips to improve savings, offering a personalized financial advisor experience.
 Notifications via SMS/Email
Currently, budget alerts are shown only within the application. Integrating email or SMS
notifications would ensure users receive real-time alerts even when they’re not actively using
the app. Services like Twilio or SendGrid can facilitate this feature.
 Cloud Database and Deployment
For real-world deployment, hosting the backend and database on platforms like Heroku,
Vercel, or AWS would be ideal. Using MongoDB Atlas for cloud database management
would also enable data persistence, backup, and better scalability across devices.

Dept of CSE, VVIET, MYSORE 2024-2025 38


Budget and Expense Tracker

CHAPTER 8
SNIPSHOTS

Home page :

Login page :

Dept of CSE, VVIET, MYSORE 2024-2025 39


Budget and Expense Tracker

Entering required data:

Dept of CSE, VVIET, MYSORE 2024-2025 40


Budget and Expense Tracker

Entering multiple for visualisation:

Budget and expense maintenance:

Dept of CSE, VVIET, MYSORE 2024-2025 41


Budget and Expense Tracker

Filters available in transaction history and categories

Final outcomes

Dept of CSE, VVIET, MYSORE 2024-2025 42

You might also like