You are on page 1of 54

Budget and Expense Tracker 1

BUDGET AND EXPENSE TRACKER


A project submitted to the CHRIST (Deemed to be University) in partial fulfilment of the requirements of

Bachelor of computer applications


(BCA)

By
Sakshi Girdhar (21215070), Vikas Gupta (21215090)

UNDER THE SUPERVISION OF


Dr. Madan Singh
CHRIST (Deemed to be University), Delhi, NCR

School of Sciences
CHRIST (Deemed to be University), Delhi, NCR
December 2023

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 2

CERTIFICATE

This is to certify that the report titled ‘Budget and Expense Tracker’ is a bona fide record of work done by
Sakshi Girdhar (21215070) and Vikas Gupta (21215090) of CHRIST (Deemed to be University), Delhi, NCR in
partial fulfilment of the requirements of V Semester BCA during the year 2023.

Faculty In charge Head of the


Department

Valued-by:

MEMBERS: Sakshi Girdhar (21215070) and Vikas Gupta (21215090)

CHRIST (Deemed to be University),

Delhi, NCR

DATE: December 13, 2023

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 3

ACKNOWLEDGEMENT
I would like to express my sincere gratitude towards all those who have supported me during the course of this
project.

First and foremost, I would like to thank my project guide Dr. Madan Singh, for their invaluable guidance,
encouragement, and feedback throughout the project. Their insights and suggestions were instrumental in
shaping the direction of this project.

I would also like to express my thanks to our Dean and Director Dr. Fr. Jossey P George, Head School of
Sciences Dr. Bosco Paul Alapatt and Academic Coordinator Dr. Ashish Sharma for providing me with the
necessary resources and infrastructure to complete this project. Without their support, this project would not
have been possible.

I extend my heartfelt thanks to my family and friends who have provided me with emotional support and
encouragement throughout the project. Their unwavering support has been a constant source of motivation.

Lastly, I would like to acknowledge the help and support extended by my colleagues and classmates. Their
inputs and feedback have been extremely valuable in shaping the outcome of this project.

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 4

ABSTRACT

This Expense Tracker is a web application that facilitates the users to keep track and manage their personal as
well as business expenses. This application helps the users to keep a digital diary. It will keep track of a user's
income and expenses on a daily basis. The user will be able to add his/her expenditures instantly and can review
them anywhere and anytime with the help of the internet. He/she can easily import transactions from his/her
mobile wallets without risking his/her information and efficiently protecting his/her privacy. He can see the
accurate duration for how long a particular product is being used by him. The monthly, and year-wise
comparison of expenditures will be done by the app which will let the user know the area where he is spending
the most. The user will be able to see the detailed analyses with the help of graphical visualizations. This project
will provide a lot of benefits to the users with the help of which they will be surely able to keep track of each
penny. It is time to stop using paper and excel sheets to keep track of your digital as well as cash payments.
Using paper is not easy to manage. It is common to delete files accidentally or misplace files. This expense
tracker provides a complete digital solution to this problem. Excel sheets do very little to help in tracking
expenses. Furthermore, they don't have the advanced functionality of preparing graphical visuals automatically.
Not only it will save the time of the people but also it will assure error-free calculations. The user just has to
enter the income and expenditures and everything else will be performed by the system.

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 5

TABLE OF CONTENT

ACKNOWLEDGMENT 3

ABSTRACT 4

LIST OF TABLES 7

LIST OF FIGURES 7

1. INTRODUCTION 8

1.1 Background of the project 8

1.2 Objectives 8

1.3 Purpose, Scope and Applicability 9

1.4 Overview of the report 9

2. SYSTEM ANALYSIS AND REQUIREMENTS 10

2.1 Existing system: 10

2.2 Limitations of the existing system 10

2.3 Proposed System 10

2.4 Benefits of the proposed system 11

2.5 System Requirements Specification 11

3. SYSTEM DESIGN 12

3.1 System Architecture 12

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 6

3.2 Module Design 13

3.4 Flowchart Diagram 15

3.5 Database Design 15

3.5.1 Data Dictionary 16

3.6 Interface and Procedural Design 17

3.6.1 User Interface Design 17

4. IMPLEMENTATION 19

4.1 Coding Standards 19

4.2 Coding Details 19

4.3 Screen Shots 48

5. TESTING 51

5.1 Testing Approaches 51

5.2 Test Cases 51

6. CONCLUSION 53

6.1 Future Scope of the project 53

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 7

LIST OF TABLES

Chapter No. Title Page No.

3 Flowchart Diagram 14

3 Database Design 14

3 Budget table 15

3 Expense table 15

3 User table 15

LIST OF FIGURES

Chapter no. Figure no. Title Page no.

3 3.1 User interface design 17

3 3.2 UI design 17

3 3.3 UI design 18

3 3.4 UI design 18

4 4.1 Screenshots 48

4 4.2 Screenshots 49

4 4.3 Screenshots 49

4 4.4 Screenshots 50

4 4.5 Screenshots 50

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 8

CHAPTERS

1. INTRODUCTION

a) BACKGROUND OF THE PROJECT


The history of online budget and expense tracker websites is a testament to the evolving landscape of
personal finance and the digital revolution that has reshaped the way individuals manage their money.
While the concept of budgeting and expense tracking predates the internet age, the transition to online
platforms has brought about significant enhancements in accessibility, functionality, and user
experience.
b) OBJECTIVES

 Financial Empowerment: Provide users with a tool that empowers them to take control of
their finances, make informed spending decisions, and achieve their financial goals.
 Simplicity and Accessibility: Design a user interface that is simple, intuitive, and
accessible from various devices, ensuring that users can easily manage their finances on the
go.
 Budget Planning and Tracking: Enable users to create personalized budgets, set spending
limits for different categories, and receive real-time updates on their budget performance.
 Expense Monitoring: Allow users to effortlessly record and categorize their expenses.
The system will provide insights into spending patterns, helping users identify areas where
they can save.
 Financial Insights and Reporting: Implement robust reporting and analytics features to
provide users with clear insights into their financial habits. Visualizations and reports will aid
users in understanding their financial trends over time.

c) PURPOSE, SCOPE AND APPLICABILITY


Purpose:
The primary purpose of this project is to comprehensively evaluate and analyze an online budget and
expense tracker website, with the aim of understanding its features, functionalities, and overall impact on
users' financial management. The project seeks to contribute valuable insights to the field of personal
finance by exploring the effectiveness of the website in helping users set and adhere to budgets, track
day-to-day expenses, and make informed financial decisions. Additionally, the project aims to assess the
user experience, data security measures, and the potential long-term financial impact of using the budget

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 9

and expense tracker. Ultimately, the purpose is to provide users, researchers, and developers with a
deeper understanding of the role and impact of online budget and expense tracker websites in the realm
of personal financial management.

Scope:
The scope of this project encompasses a thorough examination of the selected online budget and expense
tracker website, focusing on key aspects such as budgeting features, expense tracking functionalities,
graphical representations of financial data, user experience, and data security measures. The project will
involve a detailed analysis of the website's impact on users' financial behavior, including its influence on
savings, debt reduction, and overall financial well-being. Additionally, the scope extends to a
comparative analysis with other competing platforms to identify strengths, weaknesses, and potential
areas for improvement. The investigation will cover both web and mobile versions of the website to
assess accessibility and usability across different platforms. While the primary focus is on the selected
website, insights gained may be generalized to contribute to the broader understanding of online budget
and expense tracking tools.

d) OVERVIEW OF THE REPORT:


This Expense Tracker is a web application that facilitates the users to keep track and manage their
personal as well as business expenses. This application helps the users to keep a digital diary. It will
keep track of a user's income and expenses on a daily basis. The user will be able to add his/her
expenditures instantly and can review them anywhere and anytime with the help of the internet. He can
see the accurate duration for how long a particular product is being used by him. The daily, monthly, and
year-wise comparison of expenditures will be done by the app which will let the user know the area
where he is spending the most. The user will be able to see the detailed analyses with the help of
graphical visualizations.

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 10

2. SYSTEM ANALYSIS AND REQUIREMENTS


a) EXISTING SYSTEM
The Existing system is a computerized system but which is maintained at individual databases i.e., in
excels sheets, it’s a time delay process. And maintaining all the expenses in excel sheets is difficult. If
they want any records, they have to search all the records. It doesn’t provide multiple user accessibility
and also doesn’t have different user privileges. So, the system is not accessible for all the end users.

b) LIMITATIONS OF THE EXISTING SYSTEM


One prevalent issue faced by users of budget and expense tracker applications is the absence of a
comprehensive financial overview. Many existing tools may excel at recording day-to-day expenses or
managing a budget, but they often fall short when it comes to providing a holistic perspective of an
individual's financial health. Users often find themselves overwhelmed by the plethora of financial data
spread across various sources – income, expenses, savings, investments, debts, and more. Aggregating
all this information and gaining meaningful insights can be a daunting and time-consuming task.
Consequently, users may miss the forest for the trees, unable to grasp the big picture of their financial
situation.

c) PROPOSED SYSTEM
Our online budget and expense tracker website aims to overcome this issue by offering a solution that
provides users with a comprehensive financial insight. By prompting users to enter their budget and
diligently tracking their day-to-day expenses, the platform becomes a centralized hub for their financial
data.
Furthermore, your website offers a record of past week, month, and yearly expenses, alongside graphical
representations. This feature bridges the gap between data collection and data analysis, transforming raw

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 11

numbers into visually accessible information. Users can instantly see where their money is going, how
their spending patterns evolve over time, and whether they are staying within their budget. This
comprehensive financial overview empowers users to make informed financial decisions, spot potential
issues, and plan for the future with greater confidence.
By tackling the problem of a lack of comprehensive financial insight, your website becomes a valuable
tool for users seeking a clearer understanding of their financial situation, ultimately supporting better
financial management and decision-making.

d) BENEFITS OF THE PROPOSED SYSTEM


It is completely automated system in handling the expenses. This system provides report for the previous
week, month or year’s expenses. This system provides easy access to the expense report with complete
details. This system also provides the graphical representation for the report of the expenses incurred.

e) SYSTEM REQUIREMENTS SPECIFICATION


i) Software and hardware requirements
Web Technologies: HTML, JavaScript, CSS, PHP, Bootstrap

Database: 1920x1080MySQL1920x1200 max resolution


18 MB video ram
512 MB minimum RAM

Operating System: Any Operating System


Browser: Any Browser (IE, Opera, Mozilla, etc.)

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 12

3. SYSTEM DESIGN
Defining a Database: A database is an organized collection of related information about a particular
subject or purpose; for example, information regarding the price of a book or the profile of an individual
in any organization, consider for instances, the example of a boxful of index cards carrying the names
and prices of the books of a particular author. Every time we juggle through the index cards to set them
in an alphabetical order or to look up the price of a particular book, we end up managing the cards.

In computer, a database is like a box containing index cards. The only difference is that instead of index
cards, a computer database is filled with records. While each index card in the box contains information
written in many lines, a record in a database contains all the information related to an item in just one
line. Information in a database is stored in rows (records) and columns (fields).

Objects of a relational database:


Tables: A Table is a collection of information on specific topic. In a table, the information is stored in
rows and columns. We can store different types of data in different tables. Components that need to
make up a table are:
Columns: Each column represents a field. A field stores only a specific category of information.
Rows: Each row in a table is called a record and it consists of a number of related fields. Each field
contains some bits of data about the record.
Domain: The maximum and minimum values a field can have, is called its domain.
Primary key: A primary key refers to one or more fields in a table that uniquely identify each record in
the table i.e.,
it gives a distinct identity to a record.
Foreign key: A foreign key refers to primary key of another table.

a) SYSTEM ARCHITECTURE

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 13

Designing the system architecture for an online budget and expense tracker involves various components
that work together to provide a seamless and efficient user experience. Below is a high-level overview of
the system architecture:

User Interface (UI):


Web Application: The front end of the application is typically a web-based interface that users can
access through their browsers. This interface allows users to input, view, and manage their budget and
expenses.

Client-Side:
Web Browser: Users interact with the application through a web browser, which sends requests to the
server and renders the UI.
Client-Side Frameworks/Libraries: Use JavaScript frameworks or libraries (e.g., React, Angular, Vue.js)
to enhance the user interface and provide a responsive experience.

Application Layer:
Application Server: This layer processes user requests, manages business logic, and interacts with the
database. It is responsible for validating user inputs, handling authentication, and executing core
application functionality.
RESTful API: Create a set of APIs that the client-side application can communicate with. These APIs
handle data retrieval, storage, and manipulation. Use RESTful principles for a standardized and scalable
approach.
Server-Side Framework: Node.js, Django, Flask, or Ruby on Rails: Choose a server-side framework to
streamline development, handle HTTP requests, and manage application logic.

Database Layer:
Database Management System (DBMS): Use a relational database (e.g., MySQL, PostgreSQL) or a
NoSQL database (e.g., MongoDB) to store user data, including budget plans, expenses, and user account
information.
Database Schema: Design an efficient database schema that represents relationships between different
entities (e.g., users, budgets, expenses) and supports data integrity.
Authentication and Authorization: User Authentication: Implement secure user authentication
mechanisms, such as OAuth, JWT (JSON Web Tokens), or traditional username/password
authentication.
Authorization: Control access to different features and data based on user roles and permissions.

Security Layer:
HTTPS: Encrypt data transmission between the client and server using HTTPS to ensure data privacy.
Data Validation and Sanitization: Validate and sanitize user inputs to prevent security vulnerabilities like
SQL injection and cross-site scripting (XSS).
Security Auditing: Regularly audit the system for potential security risks and vulnerabilities.
External Services: Email Service: Integrate with an email service to send account-related notifications
and password reset emails.
Third-Party Integrations: Payment Gateways: If the application supports financial transactions, integrate
with secure payment gateways.

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 14

b) MODULE DESIGN
The developed system is an independent and totally self-contained product which will prove to be
beneficial to both the company hosting it as well as its members. Many features will be present in the
system that will facilitate money management of the users of the system. On the first instance, the
members need to register with the system. They will get unique login information which they can use
every time they visit the system. Our Intelligent Online Budget Tracker will then allow them to:

Track their budget: As an income or expense occurs, the registered members need to feed it to the
system at the same time respecting what they have planned initially for that specific category (for
example, entertainment, or groceries).

Analyze their budget: Based on the data fed to the system, different calculations will be made like
profits, deviations, etc. and monthly/yearly reports will be auto generated which the users can download
and keep as reference for what incomes and expenses they have had for different months or budgets.
Budget Analysis is also done by using the built-in graphs and charting controls provided on the website
where again the generated graphs/charts can be downloaded for reference and as a history for the
different comparisons made.
Predict their future budgets: Our system will also be intelligent where budget prediction will be made
easy. This implies that the users can check their future budgets based on previous data fed and new
issues they want to define like increase in cost of living or other factors that will affect prediction. At the
same time, reports and charts will be generated which will facilitate the comparison and analysis of data.
Budget Prediction is a very tedious process since it involves a number of different parameters that can
affect the budget. Also, unexpected events may occur that change the picture of the financial situation of
the person, for example, winning a lottery or losing a huge amount on the share market.

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 15

c) FLOW CHART DIAGRAM

d) DATABASE DESIGN

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 16

i) Data Dictionary
Budget table

expense

User

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 17

e) INTERFACE AND PROCEDURAL DESIGN


1. User interface design

(figure:3.1)

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 18

(figure :3.2)

(figure: 3.3)

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 19

(figure :3.4)

4. IMPLEMENTATIONS
Coding Stand We utilized a variety of programming languages to develop our project, including HTML, CSS,
JavaScript, PHP, and MySQL.

a) Coding Standards

HTML: HTML stands for HyperText Markup Language, which is a standard markup language used to
create web pages and web applications. HTML uses a set of tags and attributes to describe the structure
and content of a web page.
Here are some common coding standards for HTML:
● Use lowercase for all HTML tags and attributes.
● Use indentation and whitespace to improve readability.
● Use semantic HTML whenever possible to improve accessibility and SEO.

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 20

● Avoid inline styles and scripts, and use external files instead.
● Use valid HTML syntax and follow W3C standards.
Using lowercase for HTML tags and attributes is important because HTML is not case sensitive, but
lowercase tags and attributes improve readability and consistency. Using indentation and whitespace
improves readability and makes the code easier to navigate and understand.
Using semantic HTML, such as headings, paragraphs, lists, and other structural elements, improves
accessibility and SEO by making it easier for search engines and screen readers to understand the
content and structure of a web page.

Avoiding inline styles and scripts and using external files instead improves the maintainability and
scalability of a web page, as it allows developers to make global changes to styles and scripts without
having to modify individual HTML elements.
Using valid HTML syntax and following W3C standards ensures that the web page is compatible with
different browsers and devices, and helps to prevent errors and inconsistencies in the code.

CSS: CSS stands for Cascading Style Sheets, which is a style sheet language used to describe the
presentation of a web page written in HTML or XML. CSS provides a way to separate the presentation
and layout of a web page from its content.

Here are some common coding standards for CSS:


● Use lowercase for all CSS selectors and properties.
● Use indentation and whitespace to improve readability.
● Use semantic class and ID names to improve maintainability.
● Use shorthand syntax wherever possible to reduce file size.
● Use valid CSS syntax and follow W3C standards.

Using lowercase for CSS selectors and properties is important for consistency and readability. Using
indentation and whitespace improves readability and makes the code easier to navigate and understand.
Using semantic class and ID names, such as "header", "footer", "navigation", and "content", helps to
improve the maintainability of a web page by making it easier to identify and modify specific elements.
Using shorthand syntax, such as "margin: 10px 20px" instead of "margin-top: 10px; margin-right: 20px;
margin-bottom: 10px; margin-left: 20px;", can help to reduce the file size and improve performance.
Using valid CSS syntax and following W3C standards ensures that the CSS code is compatible with
different browsers and devices, and helps to prevent errors and inconsistencies in the code.'

JAVASCRIPT: JavaScript (JS) is a high-level programming language used to create interactive and
dynamic web pages. It is commonly used to add functionality to websites, such as creating interactive
forms, validating user input, and manipulating the content of a web page.

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 21

Here are some common coding standards for JavaScript:

● Use camelCase for variable and function names.


● Use indentation and whitespace to improve readability.
● Use single quotes for strings and double quotes for HTML attributes.
● Declare variables before using them.
● Use semicolons to terminate statements.

Using camelCase for variable and function names is a common convention in JavaScript. This involves
starting the first word with a lowercase letter and capitalizing the first letter of subsequent words. For
example, firstName or getUserInfo(). This convention makes code more readable and consistent.
Indentation and whitespace improve the readability of code and make it easier to navigate and
understand. JavaScript code should be indented consistently and whitespace should be used to separate
code blocks.

Single quotes should be used for strings and double quotes should be used for HTML attributes. This
convention makes code more readable and consistent.

Variables should be declared before using them. This makes it easier to catch errors and improves code
readability.
Semicolons should be used to terminate statements in JavaScript. This makes code more reliable and
helps to prevent errors.

PHP: PHP is a server-side scripting language that is used to create dynamic web pages and web
applications. PHP code is executed on the server before the resulting HTML is sent to the client's web
browser.

Here are some common coding standards for PHP:


● Use indentation and whitespace to improve readability.
● Use camelCase for variable and function names.
● Use underscores for naming constants.
● Use single quotes for strings unless string interpolation is required.
● Declare variables before using them.
● Use braces to enclose code blocks, even for single-line statements.
● Use comments to explain code and document functions and classes.

Using indentation and whitespace can improve the readability of PHP code. This convention involves
indenting code blocks consistently and separating code blocks with whitespace.

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 22

CamelCase is commonly used for variable and function names in PHP. This convention involves starting
the first word with a lowercase letter and capitalizing the first letter of subsequent words. For example,
$firstName or getUserInfo().

Underscores are commonly used to separate words in PHP constant names. For example, MAX_SIZE.
Single quotes should be used for strings unless string interpolation is required. This helps to prevent
errors and improve performance.
Variables should be declared before using them. This makes it easier to catch errors and improve the
readability of the code.

Braces should be used to enclose code blocks, even for single-line statements. This makes the code more
readable and easier to maintain.
Comments should be used to explain code and document functions and classes. This makes it easier for
other developers to understand the code and maintain it.

Other coding standards for PHP include avoiding the use of global variables, using descriptive variable
and function names, and following PSR (PHP Standards Recommendation) standards to ensure
compatibility and prevent errors and inconsistencies.

b) Coding Details

Index.php

index.php
<?php
include_once "init.php";

// User login check


if (isset($_SESSION['UserId'])) {
header('Location: templates/dashboard.php');
}

// Validate credentials and log the user in

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 23

if (isset($_POST['login']) && !empty($_POST)) {


$password = $_POST['password'];
$username = $_POST['username'];

if(!empty($username) || !empty($password)) {
$username = $getFromU->checkInput($username);
$password = $getFromU->checkInput($password);
if($getFromU->login($username, $password) === false) {
$error = "The username or password is incorrect";
}
}
}
?>

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="static/images/wallet.png" sizes="16x16" type="image/png">
<link rel="stylesheet" href="static/css/index.css">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@600&display=swap"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Raleway:wght@300&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-
awesome.min.css"
integrity="sha384-
wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN"
crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-
icons.css">

<title>Expense Management</title>
</head>

<body style="background-color: #D9AFD9; background-image: linear-gradient(0deg, #D9AFD9 0%,


#97D9E1 100%);">
<div class="container">

<div class="mob-hidden">
<h1>EMS</h1>
</div>

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 24

<div class="top-heading">
<h1>Expense Management System</h1>
</div>
<form action="index.php" method="post" onsubmit = "return validate()" id="form1">

<div class="group">

<div class="form-controller">
<i class="fa fa-user-plus u3" aria-hidden="true"></i>
<input type="text" name="username" placeholder="Username" id="user1" required>
<br>
<small></small>
</div>

<div class="form-controller">
<i class="fa fa-key u4" aria-hidden="true"></i>
<input type="password" name="password" placeholder="Password" id="pass1"
autocomplete="on" required>
<br>
<small></small>
</div>

</div>
<button type="submit" class="sign-in" name="login">Log In</button>

<br>
<?php
if (isset($error)) {
$font = "Source Sans Pro";
echo '<div style="color: red;font-family:'.$font.';">'.$error.'</div>';
}
?>

<div class="new-account">
<span style="color: rgba(0, 0, 0, 0.54); font-weight: bolder; font-family: 'Source Sans Pro';">Don't
have an account?</span>
<a href="templates/sign-up.php" style="text-decoration: none;"><span style="color: rgba(5, 0, 255,
0.81); font-weight: bolder; font-family: 'Source Sans Pro';">Sign Up Now!</span></a>
</div>

</form>

<div class="img-container">
<img src="static/images/login.png" alt="Login-screen-picture">

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 25

</div>
</div>

<script src="static/js/index.js"></script>
</body>
</html>

Skeleton.php
<?php
include_once "../init.php";

$pic = $getFromU->Photofetch($_SESSION['UserId']);
$pic = '"'. $pic . '"';
?>

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="../static/images/expenseic.png" sizes="16x16" type="image/png">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@600&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.css">
<link rel="stylesheet" href="../static/css/skeleton.css">
<link rel="stylesheet" href="../static/css/changepass.css">
<link rel="stylesheet" href="../static/css/datewise.css">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@600&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-
awesome.min.css">
<link rel="stylesheet" href="../static/css/yearpicker.css">
<link rel="stylesheet" href="../static/css/manage-expenses.css">
<script src="../static/js/jquery-3.3.1.slim.min.js"></script>
<script src="../static/js/yearpicker.js" async></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>

<title>Expense Management</title>

</head>

<body class="overlay-scrollbar sidebar-expand">


<!-- Navbar -->

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 26

<div class="navbar">
<!-- nav-left -->
<ul class="navbar-nav">
<li class="nav-item">
<a class='nav-link'>
<i class="fas fa-bars" onclick="collapseSidebar()"></i>
</a>
</li>
<li class="nav-item">
<img src="../static/images/expenseic.png" alt="" class="logo">
</li>
</ul>

<!-- end nav left -->


<h1 class="navbar-text">Expense Management System</h1>
<!-- nav right -->
<ul class="navbar-nav nav-right">
<li class="nav-item">
<div class="avt dropdown">
<img src=<?php echo $pic ?> alt="" class="dropdown-toggle" data-toggle="user-menu">
<ul id="user-menu" class="dropdown-menu">
<li class="dropdown-menu-item">
<a href="profile.php" class="dropdown-menu-link">
<div>
<i class="fas fa-user-tie"></i>
</div>
<span>Profile</span>
</a>
</li>
<li class="dropdown-menu-item">
<a href="logout.php" class="dropdown-menu-link">
<div>
<i class="fas fa-sign-out-alt"></i>
</div>
<span>Logout</span>
</a>
</li>
</ul>
</div>
</li>
</ul>
</div>
<!-- end navbar -->
<!-- sidebar -->
<div class="sidebar">

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 27

<ul class="sidebar-nav" id="sidebar-nav">


<li class="sidebar-nav-item">
<a href="dashboard.php" class="sidebar-nav-link">
<div>
<i class="fas fa-tachometer-alt"></i>
</div>
<span>
Dashboard
</span>
</a>
</li>
<li class="sidebar-nav-item">
<a href="set-budget.php" class="sidebar-nav-link">
<div>
<i class="fas fa-coins"></i>
</div>
<span>
Set Budget
</span>
</a>
</li>
<li class="sidebar-nav-item" id="Expense" onclick="open1()">
<a href="#" class="sidebar-nav-link">
<div>
<i class="fa fa-plus-circle"></i>
</div>
<span>
Expenses
</span>
</a>
</li>
<li class="sidebar-nav-item" style="display: none;">
<a href="add-expenses.php" class="sidebar-nav-link">
<div>
<i class="fas fa-arrow-right" aria-hidden="true"></i>
</div>
<span>
Add Expenses
</span>
</a>
</li>
<li class="sidebar-nav-item" style="display: none">
<a href="manage-expense.php" class="sidebar-nav-link" style="display: none">
<div>
<i class="fas fa-arrow-right" aria-hidden="true"></i>

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 28

</div>
<span>
Manage Expenses
</span>
</a>
</li>
<li class="sidebar-nav-item" id="ER" onclick="open2()">
<a href="#" class="sidebar-nav-link">
<div>
<i class="fas fa-calendar-day"></i>
</div>
<span>
Expense Report
</span>
</a>
</li>
<li class="sidebar-nav-item" style="display:none;">
<a href="#" class="sidebar-nav-link">
<div>
<i class="fas fa-calendar-day"></i>
</div>
<span>
Datewise Report
</span>
</a>
</li>
<li class="sidebar-nav-item" style="display: none;">
<a href="#" class="sidebar-nav-link">
<div>
<i class="fas fa-calendar-week"></i>
</div>
<span>
Monthly Report
</span>
</a>
</li>
<li class="sidebar-nav-item" style="display:none;">
<a href="#" class="sidebar-nav-link">
<div>
<i class="fas fa-calendar"></i>
</div>
<span>
Yearly Report
</span>
</a>

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 29

</li>
</ul>
</div>
<!-- end sidebar-->
<!-- Main Content -->
<!-- end main content -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js"></script>
<script src="../static/js/skeleton.js"></script>
</body>

Base.php
<!-- base.php -->
<?php
class Base {
protected $pdo;

function __construct($pdo) {
$this->pdo = $pdo;
}

public function create($table, $fields = array()) {


$columns = implode(',', array_keys($fields));
$values = ':' . implode(', :', array_keys($fields));
$sql = "INSERT INTO {$table} ({$columns}) VALUES ({$values})";
if ($stmt = $this->pdo->prepare($sql)) {
foreach ($fields as $key => $data) {
$stmt->bindValue(':'.$key, $data);
}
$stmt->execute();
return $this->pdo->lastInsertId();
}
}

public function update($table, $user_id, $fields = array()) {


$columns = '';
$i = 1;
foreach ($fields as $name => $value) {
$columns .= "{$name} = :{$name}";
if ($i < count($fields)) {
$columns .= ", ";
}
$i++;
}
$sql = "UPDATE {$table} SET {$columns} WHERE UserId = {$user_id}";

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 30

if ($stmt = $this->pdo->prepare("$sql")) {
foreach ($fields as $key => $value) {
$stmt->bindValue(':' . $key, $value);
}
$stmt->execute();
}
}

public function delete($table, $array) {


$sql = "DELETE FROM {$table}";
$where = " WHERE";

foreach ($array as $name => $value) {


$sql .= "{$where} {$name} = :{$name}";
$where = " AND ";
}

if ($stmt = $this->pdo->prepare($sql)) {
foreach ($array as $name => $value) {
$stmt->bindValue(':'.$name, $value);
}
}
$stmt->execute();
}
}

?>

Budget.php
<?php
class Budget extends Base {
function __construct($pdo) {
$this->pdo = $pdo;
}

// To check validity of the set budget


public function budget_validity_checker($UserId){
$stmt = $this->pdo->prepare("SELECT EXTRACT(MONTH FROM RDATE) AS mon FROM budget
WHERE UserId = :user");
$stmt->bindParam(":user", $UserId, PDO::PARAM_INT);
$stmt->execute();
$r = $stmt->fetch(PDO::FETCH_OBJ);
if($r == NULL)
{

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 31

return true;
}
else
{
$val1 = $r->mon;
}

$stmt2 = $this->pdo->prepare("SELECT EXTRACT(MONTH FROM CURRENT_TIMESTAMP()) AS


current");
$stmt2->execute();
$z = $stmt2->fetch(PDO::FETCH_OBJ);
$val2 = $z->current;

if($val1 === $val2)


{
return true;
}
else
{
return false;
}
}

// To set the budget


public function setbudget($UserId, $budget) {
$stmt = $this->pdo->prepare("INSERT INTO budget(UserId, Budget) VALUES(:user , :amount)");
$stmt->bindParam(":user", $UserId, PDO::PARAM_INT);
$stmt->bindParam(":amount", $budget, PDO::PARAM_INT);
$stmt->execute();
}

// To check the current budget


public function checkbudget($UserId) {
$stmt = $this->pdo->prepare("SELECT Budget AS currentbudget FROM budget WHERE UserId=:user");
$stmt->bindParam(":user", $UserId, PDO::PARAM_INT);
$stmt->execute();
$rows = $stmt->fetch(PDO::FETCH_OBJ);
if($rows == NULL)
{
return NULL;
}
else
{
return $rows->currentbudget;
}

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 32

// To update current budget


public function updatebudget($UserId, $budget) {
$stmt = $this->pdo->prepare("UPDATE budget SET Budget = :amount, RDATE =
CURRENT_TIMESTAMP() WHERE UserId = :user");
$stmt->bindParam(":user", $UserId, PDO::PARAM_INT);
$stmt->bindParam(":amount", $budget, PDO::PARAM_INT);
$stmt->execute();
}

// To delete the monthly budget record (Once the month changes)


public function del_budget_record($UserId){
$stmt = $this->pdo->prepare("DELETE FROM budget WHERE UserId = :user");
$stmt->bindParam(":user", $UserId, PDO::PARAM_INT);
$stmt->execute();
}

}
?>

Expense.php
<?php
class Expense extends Base {
function __construct($pdo) {
$this->pdo = $pdo;
}

// Returns total expense amount within n days from now


public function Expenses($UserId, $n) {
$stmt = $this->pdo->prepare("SELECT SUM(Cost) AS TOTAL FROM expense WHERE UserId = :UserId
AND DATE(`Date`) >= CURDATE() - INTERVAL :n DAY");
$stmt->bindParam(":UserId", $UserId, PDO::PARAM_INT);
$stmt->bindParam(":n", $n, PDO::PARAM_INT);
$stmt->execute();
$today = $stmt->fetch(PDO::FETCH_OBJ);
if($today == NULL)
{
return NULL;
}
else
return $today->TOTAL;
}

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 33

// Returns yesterday's expense amount


public function Yesterday_expenses($UserId) {
$stmt = $this->pdo->prepare("SELECT SUM(Cost) AS TOTAL FROM expense WHERE UserId = :UserId
AND DATE(`Date`) = CURDATE() - INTERVAL 1 DAY");
$stmt->bindParam(":UserId", $UserId, PDO::PARAM_INT);
$stmt->execute();
$yest = $stmt->fetch(PDO::FETCH_OBJ);
if($yest == NULL)
{
return NULL;
}
else
return $yest->TOTAL;
}

// Returns total expense amount till date


public function totalexp($UserId) {
$stmt = $this->pdo->prepare("SELECT SUM(Cost) AS TOTAL FROM expense WHERE UserId
= :UserId");
$stmt->bindParam(":UserId", $UserId, PDO::PARAM_INT);
$stmt->execute();
$total = $stmt->fetch(PDO::FETCH_OBJ);
if($total == NULL)
{
return NULL;
}
else
return $total->TOTAL;
}

// Expenses of Current Month(Datewise)


public function Current_month_expenses($UserId) {
$stmt = $this->pdo->prepare("SELECT EXTRACT(MONTH FROM CURRENT_TIMESTAMP()) AS
CurrentMonth");
$stmt->execute();
$rows1 = $stmt->fetch(PDO::FETCH_OBJ);
$val = $rows1 -> CurrentMonth;

$stmt = $this->pdo->prepare("SELECT SUM(Cost) AS exp1 FROM expense WHERE UserId = :UserId


AND MONTH(Date) = :currmon");
$stmt->bindParam(":UserId", $UserId, PDO::PARAM_INT);
$stmt->bindParam(":currmon", $val, PDO::PARAM_INT);
$stmt->execute();
$rows2 = $stmt->fetch(PDO::FETCH_OBJ);
if($rows2 == NULL)

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 34

{
return NULL;
}
else
{
return $rows2->exp1;
}

// Returns expense records between 2 given dates


public function dtwise($UserId, $FROM, $TO){
$stmt = $this->pdo->prepare("SELECT * FROM expense WHERE (Date >= :fromdate AND Date <=
(:todate + INTERVAL 1 DAY)) AND UserId = :user ORDER BY Date");
$stmt->bindParam(":user", $UserId, PDO::PARAM_INT);
$stmt->bindParam(":fromdate", $FROM, PDO::PARAM_STR);
$stmt->bindParam(":todate", $TO, PDO::PARAM_STR);
$stmt->execute();
$dt = $stmt->fetchAll(PDO::FETCH_OBJ);
if($dt == NULL)
{
return NULL;
}
else
{
return $dt;
}
}

// Returns expense records between any two given months


public function mthwise($UserId, $FROM, $TO){
$stmt = $this->pdo->prepare("SELECT * FROM expense WHERE (Date >= :fromdate AND Date <=
(:todate + INTERVAL 1 MONTH)) AND UserId = :user ORDER BY Date ");
$stmt->bindParam(":user", $UserId, PDO::PARAM_INT);
$stmt->bindParam(":fromdate", $FROM, PDO::PARAM_STR);
$stmt->bindParam(":todate", $TO, PDO::PARAM_STR);
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_OBJ);
if($rows == NULL)
{
return NULL;
}
else
{
return $rows;

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 35

}
}

// Returns expense records(rows) between any two given years


public function yrwise($UserId, $FROM, $TO){
$stmt = $this->pdo->prepare("SELECT * FROM expense WHERE (EXTRACT(year FROM Date)
>= :fromdate AND EXTRACT(year FROM Date) <= (:todate)) AND UserId = :user ORDER BY Date");
$stmt->bindParam(":user", $UserId, PDO::PARAM_INT);
$stmt->bindParam(":fromdate", $FROM, PDO::PARAM_STR);
$stmt->bindParam(":todate", $TO, PDO::PARAM_STR);
$stmt->execute();
$dt = $stmt->fetchAll(PDO::FETCH_OBJ);
if($dt == NULL)
{
return NULL;
}
else
{
return $dt;
}
}

// Returns all rows from expense table


public function allexp($UserId) {
$stmt = $this->pdo->prepare("SELECT * FROM expense WHERE UserId = :UserId ORDER BY Date");
$stmt->bindParam(":UserId", $UserId, PDO::PARAM_INT);
$stmt->execute();
$total = $stmt->fetchall(PDO::FETCH_OBJ);
if($total == NULL)
{
return NULL;
}
else
return $total;
}

// Returns a particular expense record(with given expense id)


public function delexp($ID){
$stmt = $this->pdo->prepare("DELETE FROM expense WHERE ID = :id");
$stmt->bindParam(":id", $ID, PDO::PARAM_INT);
$stmt->execute();
}

}
?>

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 36

User.php
<?php
class User extends Base{
function __construct($pdo)
{
$this->pdo = $pdo;
}

// Removes extra space and html code from input


public function checkInput($var)
{
$var = htmlspecialchars($var);
$var = trim($var);
$var = stripslashes($var);
return $var;
}

// Logs a user in
public function login($username, $password)
{
$stmt = $this->pdo->prepare("SELECT UserId FROM user WHERE Username = :username AND
Password = :password");
$stmt->bindParam(":username", $username, PDO::PARAM_STR);
$hash = md5($password);
$stmt->bindParam(":password", $hash, PDO::PARAM_STR);
$stmt->execute();
$user = $stmt->fetch(PDO::FETCH_OBJ);
$count = $stmt->rowCount();

if($count>0)
{

$_SESSION['UserId'] = $user->UserId;
header("Location: templates/dashboard.php");
}
else
{
return false;
}
}

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 37

// Checks if email already exists


public function checkEmail($email)
{
$stmt = $this->pdo->prepare("SELECT UserId FROM user WHERE Email = :email");
$stmt->bindParam(":email", $email, PDO::PARAM_STR);
$stmt->execute();
$user = $stmt->fetch(PDO::FETCH_OBJ);
$count = $stmt->rowCount();
if($count>0)
{
return true;
}
else
{
return false;
}
}

// Checks if username already exists


public function checkUsername($username)
{
$stmt = $this->pdo->prepare("SELECT UserId FROM user WHERE Username = :username");
$stmt->bindParam(":username", $username, PDO::PARAM_STR);
$stmt->execute();
$user = $stmt->fetch(PDO::FETCH_OBJ);
$count = $stmt->rowCount();
if($count>0)
{
return true;
}
else
{
return false;
}
}

// Returns the path of profile picture from database by user id


public function Photofetch($UserId) {
$stmt = $this->pdo->prepare("SELECT Photo FROM user WHERE UserId = :UserId");
$stmt->bindParam(":UserId", $UserId, PDO::PARAM_INT);
$stmt->execute();
$user = $stmt->fetch(PDO::FETCH_OBJ);
return $user->Photo;
}

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 38

// Logs a user out


public function logout()
{
session_destroy();
header("Location: ". BASE_URL .'index.php');
}

// Checks if a user is logged in


public function loggedIn()
{
if (isset($_SESSION['UserId'])) {
return true;
}
return false;
}

// Returns a user's entire data


public function userData($user_id) {
$stmt = $this->pdo->prepare("SELECT * FROM user WHERE UserId = :user_id");
$stmt->bindParam(":user_id", $user_id, PDO::PARAM_INT);
$stmt->execute();
return $stmt->fetch(PDO::FETCH_OBJ);
}

}
?>

Connection.php
<?php

$dsn = 'mysql:host=localhost; dbname=expenseman';


$user = 'root';
$pass = '';

try {
$pdo = new PDO($dsn, $user, $pass);
}
catch(PDOException $e){
echo "Connection Error! ". $e->getMessage();
}
?>

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 39

Init.php
<?php
session_start();
include_once 'connection.php';
include_once 'base.php';
include_once 'user.php';
include_once 'expense.php';
include_once 'budget.php';

global $pdo;

$getFromU = new User($pdo);


$getFromB = new Budget($pdo);
$getFromE = new Expense($pdo);

define("BASE_URL", "http://localhost/project/");
?>

Addexpenses.php
<?php
include_once "../init.php";

//User login checker


if ($getFromU->loggedIn() === false) {
header('Location: ../index.php');
}

include_once 'skeleton.php';

// Create an expense record


if(isset($_POST['addexpense']))
{
$dt = date("Y-m-d H:i:s", strtotime($_POST["dateexpense"]));
$itemname = $_POST['item'];
$itemcost = $_POST['costitem'];
$getFromE->create("expense", array('UserId'=>$_SESSION['UserId'], 'Item' => $itemname,
'Cost'=>$itemcost, 'Date' => $dt));
echo '<script>
Swal.fire({
title: "Done!",
text: "Records Updated Successfully",
icon: "success",
confirmButtonText: "Close"

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 40

})
</script>';
}
?>

<div class="wrapper">
<div class="row">
<div class="col-12 col-m-12 col-sm-12" >
<div class="card">
<div class="counter" style="height: 60vh; display: flex; align-items: center; justify-content:
center;">
<form action="" method="post">
<div>
<label style="font-family: 'Source Sans Pro'; font-size: 1.3em; ">Date of
Expense:</label><br><br>
<input class="text-input" type="datetime-local" value="" name="dateexpense"
required="true" style="width: 100%; padding-top: 8px; "><br><br>
</div>
<div>
<label style="font-family: 'Source Sans Pro'; font-size: 1.3em; ">Item:</label><br>
<input type="text" class="text-input" name="item" value="" required="true" style="width:
100%; padding-top: 10px; "><br><br>
</div>

<div>
<label style="font-family: 'Source Sans Pro'; font-size: 1.3em; ">Cost of Item:</label><br>
<input class="text-input" type="text" value="" required="true" name="costitem"
onkeypress='validate(event)' style="width: 100%; padding-top: 10px; "><br><br>
</div>

<div><br>
<button type="submit" class="pressbutton" name="addexpense">Add</button>
</div>

</div>

</form>
</div>
</div>
</div>

</div>
</div>

<script src="../static/js/set-budget.js"></script>

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 41

Changepass.php
<?php
include_once "../init.php";

// User login check


if ($getFromU->loggedIn() === false) {
header('Location: ../index.php');
}

include_once 'skeleton.php';

// Password validation and change


if(isset($_POST['changepwd']))
{

$old_pass_hash = $getFromU->userData($_SESSION['UserId'])->Password;
$confirmpass = md5($_POST['oldpass']);
function function_alert($message) {
echo "<script>
Swal.fire({
title: '',
text: '$message',
icon: '',
confirmButtonText: 'Okay!'
})
</script>";
}
if($confirmpass === $old_pass_hash)
{
$getFromU->update('user',$_SESSION['UserId'], array('Password' => md5($_POST['newpass'])));
function_alert("Password Updated Successfully");
}
else
{
function_alert("Could Not Change Password");
}
}

?>

<div class="wrapper">
<div class="row">
<div class="col-12 col-m-12 col-sm-12" >
<div class="card">

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 42

<div class="counter" style="height: 60vh; display: flex; align-items: center; justify-content:


center;">
<form action="" method="post" onsubmit="return validate()" id="form">

<div class="formcontrol">
<label style="font-family: 'Source Sans Pro'; font-size: 1.3em; ">Current
Password:</label><br>
<input type="password" class="text-input" name="oldpass" id="oldpass" value=""
required="true" style="padding-top: 10px; "><br>
<small></small>
</div>
<div class="formcontrol">
<label style="font-family: 'Source Sans Pro'; font-size: 1.3em; ">New
Password:</label><br>
<input type="password" class="text-input" name="newpass" id="newpass" value=""
required="true" style="padding-top: 10px; "><br>
<small></small>
</div>
<div class="formcontrol">
<label style="font-family: 'Source Sans Pro'; font-size: 1.3em; ">Re-Type
Password:</label><br>
<input type="password" class="text-input" name="cnewpass" id="cpass" value=""
required="true" style="padding-top: 10px; "><br>
<small></small>
</div>

<div><br>
<button type="submit" class="pressbutton" name="changepwd">Change
Password</button>
</div>

</div>

</form>
</div>
</div>
</div>

</div>
</div>

<script src="../static/js/changepass.js"></script>
<link rel="stylesheet" src="../static/css/changepass.css">

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 43

Dashboard.php
<?php
include_once "../init.php";

//User login check


if ($getFromU->loggedIn() === false) {
header('Location: ../index.php');
}

include_once 'skeleton.php';

if (isset($_SESSION['swal']))
{
echo $_SESSION['swal'];
unset($_SESSION['swal']);
}

// Budget validity checker


$budget_validity = $getFromB->budget_validity_checker($_SESSION['UserId']);
if($budget_validity == false)
{
$getFromB->del_budget_record($_SESSION['UserId']);
}

// Today's Expenses
$today_expense = $getFromE->Expenses($_SESSION['UserId'],0);
if($today_expense == NULL)
{
$today_expense = "No Expenses Logged Today";
}
else
{
$today_expense = "₹ ".$today_expense;
}

// Yesterday's Expenses
$Yesterday_expense = $getFromE->Yesterday_expenses($_SESSION['UserId']);
if($Yesterday_expense == NULL)
{
$Yesterday_expense = "No Expenses Logged Yesterday";
}
else
{
$Yesterday_expense = "₹ ".$Yesterday_expense;

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 44

// Last 7 Days' Expenses


$week_expense = $getFromE->Expenses($_SESSION['UserId'],6);
if($week_expense == NULL)
{
$week_expense = "No Expenses Logged This Week";
}
else
{
$week_expense = "₹ ".$week_expense;
}

// Last 30 Days' Expenses


$monthly_expense = $getFromE->Expenses($_SESSION['UserId'],29);
if($monthly_expense == NULL)
{
$monthly_expense = "No Expenses This Month";
}
else
{
$monthly_expense = "₹ ".$monthly_expense;
}

// Total Expenses
$total_expenses = $getFromE->totalexp($_SESSION['UserId']);
if($total_expenses == NULL)
{
$total_expenses = "No Expenses Logged Yet";
}
else
{
$total_expenses = "₹ ".$total_expenses;
}

// Budget Left for the month


$budget_left = $getFromB->checkbudget($_SESSION['UserId']);
if($budget_left == NULL)
{
$budget_left = "Not Set Yet";
}
else
{
$currmonexp = $getFromE->Current_month_expenses($_SESSION['UserId']);
if($currmonexp==NULL)

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 45

{
$currmonexp = 0;
}
$budget_left = $budget_left - $currmonexp;
$budget_left = "₹ ".$budget_left;
}

?>
<div class="wrapper">
<div class="row">
<div class="col-4 col-m-4 col-sm-4">
<div class="card">
<div class="counter bg-danger" style="color:white;">
<p><i class="fas fa-tasks"></i></p>
<h3>
Today's Expenses
</h3>
<p style="font-size: 1.2em;">
<?php echo $today_expense ?>
</p>
</div>
</div>
</div>
<div class="col-4 col-m-4 col-sm-4">
<div class="card">
<div class="counter bg-primary" style="color:white;">
<p><i class="fas fa-undo-alt"></i></p>
<h3>
Yesterday's Expenses
</h3>
<p style="font-size: 1.2em;">
<?php echo $Yesterday_expense ?>
</p>
</div>
</div>
</div>
<div class="col-4 col-m-4 col-sm-4">
<div class="card">
<div class="counter bg-warning" style="color:white;">
<p><i class="fas fa-calendar-week"></i></p>
<h3>
Last 7 day's Expenses
</h3>
<p style="font-size: 1.2em;">
<?php echo $week_expense ?>

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 46

</p>
</div>
</div>
</div>
<div class="col-4 col-m-4 col-sm-4">
<div class="card">
<div class="counter bg-vio" style="color:white;">
<p><i class="fas fa-calendar"></i></p>
<h3>
Last 30 day's Expenses
</h3>
<p style="font-size: 1.2em;">
<?php echo $monthly_expense ?>
</p>
</div>
</div>
</div>
<div class="col-4 col-m-4 col-sm-4">
<div class="card">
<div class="counter bg-success" style="color:white;">
<p><i class="bi bi-currency-rupee"></i></p>
<h3>
Monthly Budget Left
</h3>
<p style="font-size: 1.2em;">
<?php echo $budget_left ?>
</p>
</div>
</div>
</div>
<div class="col-4 col-m-4 col-sm-4">
<div class="card">
<div class="counter bg-yell" style="color:white;">
<p><i class="fas fa-file-invoice-dollar" aria-hidden="true"></i></p>
<h3>
Total Expenses
</h3>
<p style="font-size: 1.2em;">
<?php echo $total_expenses ?>
</p>
</div>
</div>
</div>
</div>
</div>

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 47

Manage-expenses.php
<?php
include_once "../init.php";

// User login checker


if ($getFromU->loggedIn() === false) {
header('Location: ../index.php');
}

include_once 'skeleton.php';

// Deletes expense record


if(isset($_POST['delrec']))
{
$getFromE->delexp($_POST['ID']);
echo "<script>
Swal.fire({
title: 'Done!',
text: 'Record deleted successfully',
icon: 'success',
confirmButtonText: 'Close'
})
</script>";
}

?>

<div class="wrapper">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">

<i class="fas fa-ellipsis-h"></i>


<h3 style="font-family:'Source Sans Pro'; font-size: 1.5em;">
Expenses
</h3>
</div>
<div class="card-content">

<table>
<thead>
<tr>
<th>#</th>

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 48

<th>Item</th>
<th>Cost</th>
<th>Date</th>
<th>Action</th>
</tr>
</thead>

<tbody>
<?php
$totexp = $getFromE->allexp($_SESSION['UserId']);
if($totexp !== NULL)
{
$len = count($totexp);
for ($x = 1; $x <= $len; $x++) {
echo "<tr>
<td>".$x."</td>
<td>".$totexp[$x-1]->Item."</td>
<td>"."₹ ".$totexp[$x-1]->Cost."</td>
<td>".date("d-m-Y",strtotime($totexp[$x-1]->Date))."</td>
<td><form style='margin-block-end: 0;' action='' method='post'><input
style='display:none;' name='ID' value=".$totexp[$x-1]->ID."></input><button type='submit' name='delrec'
class='btn btn-default' style='background:none; color:#8f8f8f; font-size:1em;'>
<i class='far fa-trash-alt' style='color:red;'></i></button></form></td>
</tr>";
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

c) Screen Shots

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 49

(figure: 4.1)

(figure: 4.2)

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 50

(figure: 4.3)

(figure: 4.4)

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 51

(figure: 4.5)

5. TESTING
‘Software testing is the process used to help identify the correctness, completeness, Security, and quality
of developed computer software. Testing is a process of executing a Program or application with the
intent of finding errors with that in mind, testing can never completely establish the correctness of
arbitrary computer software. In other words, testing is Comparisons testing should be distinguished from
the separate discipline of software quality Assurance, which encompasses all business process areas, not
testing.
Type of tests done in our project are as follows:
a) Testing Approaches
Testing in hardware and software refers to the process of evaluating the performance or behavior of
hardware devices or software applications against the specified requirements or expectations.

Testing in hardware involves evaluating the physical components of a device, such as the circuit board,
sensors, and other electronic components, to ensure that they function correctly. This includes testing for
functionality, durability, safety, and reliability. Software testing, on the other hand, involves evaluating
the behavior of software applications to ensure that they perform as expected. This includes testing for
functionality, performance, security, usability, and compatibility.

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 52

In both hardware and software testing, there are several types of testing, including functional testing,
performance testing, security testing, usability testing, compatibility testing, and regression testing. Each
type of testing focuses on different aspects of the device or application and helps to identify different
types of defects or issues.

b) Test Cases
Acceptance testing: User acceptance of a system is the key factor for the success of any system. The
System under the consideration is tested for user acceptation by constantly keeping in touch with
prospective system users at the time of developing thee making changes whenever required

Compatibility Testing: Testing is to ensure compatibility of an application. Compatibility testing can be


Performed manually software developed using these tools and it’s running in windows; in this way the
compatibility testing is conducted.

System Testing: Testing conducted on a complete, integrated system to evaluate the system’s
Compliance with its specified requirements. System testing requires no knowledge of the Inner design of
the code or logic.

Unit Testing: Unit testing focuses on the verification of the smallest unit of software design using the
unit plans prepared during the design phase of the system, error within the boundary of the module are
uncovered in this testing phase, each and sub module were found to be working satisfactorily. In unit
testing the entire system is divided into small part or units according to roughly. So many errors in a unit
if any are debugged right there, thus saving the time. In this project all the views are tested to ensure that
they operate correctly.
• In our project forms, views and reports are readable and abbreviations are avoided as much as possible.
• List boxes, radio buttons, check boxes are used so that users can easily select the available options. •
Proper validations are done so as to avoid any errors related to database.

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 53

Validation testing: This test succeeds when the software function in a manner that can be reasonable
expected by the user. After the validation test has been conducted one of the following two conditions
exists.
• The function or the performance characteristics confirmed to the specifications and are accepted.
• A deviation from specification is uncovered and appropriate messages are given. This testing is used in
our project to our project to test each page, form, view and report is checked against the requirement
document so as to ensure that it’s desired.

6. CONCLUSION

Tracking your expenses daily can not only save your amount, but it can also assist you set financial goals for the
longer term. If you know exactly where your amount goes every month, you will easily see where some
cutbacks and compromises can be made. The project that we have developed is more efficient than the other
income and expense trackers. The project successfully avoids the manual calculation which is performed usually
in the absence of an expense tracker. The modules are developed efficiently and in an attractive manner. The
application will eliminate sticky notes, spreadsheets, and ledgers that cause confusion, data inconsistency
problems while recording and splitting expenses. With our application users can manage their expenses more
effectively and they will be better at managing the expenses.

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR


Budget and Expense Tracker 54

The developed system is an independent and totally self-contained product which will prove to be beneficial to
both the company hosting it as well as its members. Many features will be present in the system that will
facilitate money management of the users of the system. On the first instance, the members need to register with
the system. They will get unique login information which they can use every time they visit the system. Our
Intelligent Online Budget Tracker will then allow them to:

 Track their budget


 Analyze their budget
 Predict their future budgets

School of Sciences, CHRIST (Deemed to be University), Delhi, NCR

You might also like