0% found this document useful (0 votes)
2 views39 pages

Project3 2 Yr

The 'Monthly Expense Tracker System' is a web application developed in PHP and MySQL to help users efficiently manage and track their monthly expenses. It offers features like income and expense recording, categorization, report generation, and data visualization to aid in financial decision-making. The system emphasizes user-friendliness, data security, and scalability for future enhancements.

Uploaded by

Yugal Sarode
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views39 pages

Project3 2 Yr

The 'Monthly Expense Tracker System' is a web application developed in PHP and MySQL to help users efficiently manage and track their monthly expenses. It offers features like income and expense recording, categorization, report generation, and data visualization to aid in financial decision-making. The system emphasizes user-friendliness, data security, and scalability for future enhancements.

Uploaded by

Yugal Sarode
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

Monthly Expense Tracker System

Abstract

The "Monthly Expense Tracker System" is a web-based application developed using PHP and
MySQL that aims to help users manage and track their monthly expenses efficiently. The system
allows users to record their income and expenditures, categorize transactions, and generate detailed
reports to analyze their spending habits. By providing a user-friendly interface and comprehensive
data visualization, the expense tracker enables users to maintain a balanced budget and make
informed financial decisions. The backend, powered by PHP, ensures robust data processing and
secure transaction handling, while the use of MySQL facilitates reliable data storage and retrieval.

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 1


Monthly Expense Tracker System

Introduction

In today's fast-paced world, managing personal finances has become increasingly important. The
ability to track income and expenses accurately can significantly impact one's financial stability
and planning. Traditional methods of tracking expenses, such as manual entry in notebooks or
spreadsheets, can be cumbersome and error-prone. To address this issue, we propose a "Monthly
Expense Tracker System" that leverages modern web technologies to provide an efficient and
effective solution for personal financial management.

This system is designed to offer a comprehensive platform where users can record their financial
transactions, categorize them, and generate insightful reports. The use of PHP for backend
development ensures dynamic content generation and secure data handling, while mysql provides
a reliable database management system for storing and querying data. The application aims to
simplify the process of expense tracking, making it accessible and convenient for users of all
financial literacy levels

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 2


Monthly Expense Tracker System

Objectives

The primary objective of the "Monthly Expense Tracker System" is to create a robust and user-
friendly web application that facilitates effective personal financial management. Specific
objectives include:

1. Automate Expense Tracking: Develop a system that allows users to record and categorize
their income and expenses effortlessly.

2. Generate Reports: Provide tools for generating detailed financial reports that help users
understand their spending patterns and identify areas for improvement.

3. Enhance User Experience: Design an intuitive and responsive user interface that makes
the expense tracking process straightforward and enjoyable.

4. Ensure Data Security: Implement robust security measures to protect user data and ensure
the privacy of financial information.

5. Facilitate Budgeting: Enable users to set budgets for different categories and monitor their
adherence to these budgets over time.

6. Provide Insights: Use data visualization techniques to present financial data in an easily
understandable format, aiding users in making informed financial decisions.

7. Scalable Architecture: Design the system with a scalable architecture to accommodate


future enhancements and an increasing number of users

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 3


Monthly Expense Tracker System

Features

The Monthly Expense Tracker System is a powerful, PHP-based web application designed to help
users manage their finances efficiently. Here’s a closer look at the key features that make this
system an essential tool for personal finance management.

1. User Registration : Simple Sign-Up Process: New users can quickly register by providing
basic information such as their name, email, and a secure password.

2. Login : Secure Access: Returning users can log in securely with their registered email and
password.

3. Dashboard : The dashboard provides a comprehensive overview of the user’s financial


status, including total expenses. Users can quickly navigate to different sections like adding
expenses, viewing detailed reports, and managing categories.

4. Expense Summary : Visual widgets display summaries of expenses by category, making


it easy to see where money is being spent.

5. Recent Transactions : A list of recent transactions is shown on the dashboard for quick
reference.

6. Add Expense : Users can add new expenses through a simple form that requires details
like amount, category, date.

7. Category Selection : Expenses can be categorized into predefined categories such as food,
rent, entertainment, etc.

8. View Expenses : Users can view a detailed list of all recorded expenses, filtered by date,
category, or amount.

9. Date Range Analysis : Users can view expenses for specific date ranges, such as weekly,
monthly, or yearly, to analyze their spending over time.

10. Reports using Graphs and Charts : Interactive pie charts and bar graphs provide a visual
representation of expenses, making it easier to grasp financial data at a glance. Line graphs
display spending trends over time, helping users identify fluctuations and patterns in their
expenses.

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 4


Monthly Expense Tracker System

System Design

1. User Requirement :

Number of modules
• Login module
• Expense module
• Categories module

2. Software Requirement :

• Operating System: Windows


• Technology
1. Front End: HTML, CSS, Java script, Bootstrap
2. Back end: PHP, MySQL
• Web Server: Apache included in XAMPP window
• Database: MySQL

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 5


Monthly Expense Tracker System

3. User module :

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 6


Monthly Expense Tracker System

4. Data Flow Diagram :

The Data Flow Diagram (DFD) is also called as bubble chart. It is a simple graphical formalism
that can be used to represent a system in terms of input data to the system, various processing
carried out on this data, and the output data is generated by this system The data flow diagram
(DFD) in one of the most important modeling tools. It is used to model the system components.
These components are the system process, the data used by the process, an external entity that
interucts with the systern and the information flows in the system. DFD shows how the information
moves through the system and how it is modified by a series of transformations. It is a graphical
technique that depicts information flow and the transformations that are applied as data moves
from input to output.DFD is also known as bubble chart. A DFD may be used to represent a system
at any level of abstraction.

Data Flow Diagram

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 7


Monthly Expense Tracker System

Coding

<?php
require('config.php');
session_start();
$errormsg = "";
if (isset($_POST['email'])) {
$email = stripslashes($_REQUEST['email']);
$email = mysqli_real_escape_string($con, $email);
$password = stripslashes($_REQUEST['password']);
$password = mysqli_real_escape_string($con, $password);
$query = "SELECT * FROM `users` WHERE email='$email'and password='" .
md5($password) . "'";
$result = mysqli_query($con, $query) or die(mysqli_error($con));
$rows = mysqli_num_rows($result);
if ($rows == 1) {
$_SESSION['email'] = $email;
header("Location: index.php");
} else {
$errormsg = "Wrong";
}
} else {
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Login</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<style>
.login-form {
width: 340px;
margin: 50px auto;
font-size: 15px;
}
.login-form form {
margin-bottom: 15px;

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 8


Monthly Expense Tracker System

background: #fff;
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
padding: 30px;
border: 1px solid #ddd;
}
.login-form h2 {
color: #636363;
margin: 0 0 15px;
position: relative;
text-align: center;
}
.login-form h2:before,
.login-form h2:after {
content: "";
height: 2px;
width: 30%;
background: #d4d4d4;
position: absolute;
top: 50%;
z-index: 2;
}
.login-form h2:before {
left: 0;
}

.login-form h2:after {
right: 0;
}

.login-form .hint-text {
color: #999;
margin-bottom: 30px;
text-align: center;
}

.login-form a:hover {
text-decoration: none;
}

.form-control,
.btn {
min-height: 38px;
border-radius: 2px;

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 9


Monthly Expense Tracker System

}
.btn {
font-size: 15px;
font-weight: bold;
}
</style>
</head>
<body>
<div class="login-form">
<form action="" method="POST" autocomplete="off">
<h2 class="text-center"></h2>
<p class="hint-text">Login Panel</p>
<div class="form-group">
<input type="text" name="email" class="form-control" placeholder="Email"
required="required">
</div>
<div class="form-group">
<input type="password" name="password" class="form-control" placeholder="Password"
required="required">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success btn-block" style="border-
radius:0%;">Login</button>
</div>
<div class="clearfix">
<label class="float-left form-check-label"><input type="checkbox"> Remember
me</label>
</div>
</form>
<p class="text-center">Don't have an account?<a href="register.php" class="text-danger">
Register Here</a></p>
</div>
</body>
<!-- Bootstrap core JavaScript -->
<script src="js/jquery.slim.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- Menu Toggle Script -->
<script>
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
</script>

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 10


Monthly Expense Tracker System

<script>
feather.replace()
</script>
</html>
<?php
require('config.php');
if (isset($_REQUEST['firstname'])) {
if ($_REQUEST['password'] == $_REQUEST['confirm_password']) {
$firstname = stripslashes($_REQUEST['firstname']);
$firstname = mysqli_real_escape_string($con, $firstname);
$lastname = stripslashes($_REQUEST['lastname']);
$lastname = mysqli_real_escape_string($con, $lastname);
$email = stripslashes($_REQUEST['email']);
$email = mysqli_real_escape_string($con, $email);
$password = stripslashes($_REQUEST['password']);
$password = mysqli_real_escape_string($con, $password);
$trn_date = date("Y-m-d H:i:s");
$query = "INSERT into `users` (firstname, lastname, password, email, trn_date) VALUES
('$firstname','$lastname', '" . md5($password) . "', '$email', '$trn_date')";
$result = mysqli_query($con, $query);
if ($result) {
header("Location: login.php");
}
} else {
echo ("ERROR: Please Check Your Password & Confirmation password");
}
}
?>
<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">

<title>Register</title>

<!-- Bootstrap core CSS -->


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

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 11


Monthly Expense Tracker System

body {
color: #000;
background: #fff;
font-family: 'Roboto', sans-serif;
}

.form-control {
height: 40px;
box-shadow: none;
color: #969fa4;
}

.form-control:focus {
border-color: #5cb85c;
}

.form-control,
.btn {
border-radius: 3px;
}

.signup-form {
width: 450px;
margin: 0 auto;
padding: 30px 0;
font-size: 15px;
}

.signup-form h2 {
color: #636363;
margin: 0 0 15px;
position: relative;
text-align: center;
}

.signup-form h2:before,
.signup-form h2:after {
content: "";
height: 2px;
width: 30%;
background: #d4d4d4;
position: absolute;
top: 50%;

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 12


Monthly Expense Tracker System

z-index: 2;
}

.signup-form h2:before {
left: 0;
}

.signup-form h2:after {
right: 0;
}

.signup-form .hint-text {
color: #999;
margin-bottom: 30px;
text-align: center;
}

.signup-form form {
color: #999;
border-radius: 3px;
margin-bottom: 15px;
background: #fff;
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
padding: 30px;
border: 1px solid #ddd;
}

.signup-form .form-group {
margin-bottom: 20px;
}

.signup-form input[type="checkbox"] {
margin-top: 3px;
}

.signup-form .btn {
font-size: 16px;
font-weight: bold;
min-width: 140px;
outline: none !important;
}

.signup-form .row div:first-child {

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 13


Monthly Expense Tracker System

padding-right: 10px;
}

.signup-form .row div:last-child {


padding-left: 10px;
}

.signup-form a:hover {
text-decoration: none;
}

.signup-form form a {
color: #5cb85c;
text-decoration: none;
}

.signup-form form a:hover {


text-decoration: underline;
}
</style>
</head>

<body>
<div class="signup-form">
<form action="" method="POST" autocomplete="off">
<h2>Register</h2>
<div class="form-group">
<div class="row">
<div class="col"><input type="text" class="form-control" name="firstname"
placeholder="First Name" required="required"></div>
<div class="col"><input type="text" class="form-control" name="lastname"
placeholder="Last Name" required="required"></div>
</div>
</div>
<div class="form-group">
<input type="email" class="form-control" name="email" placeholder="Email"
required="required">
</div>
<div class="form-group">
<input type="password" class="form-control" name="password" placeholder="Password"
required="required">
</div>
<div class="form-group">

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 14


Monthly Expense Tracker System

<input type="password" class="form-control" name="confirm_password"


placeholder="Confirm Password" required="required">
</div>
<div class="form-group">
<label class="form-check-label"><input type="checkbox" required="required"> I accept
the <a href="#">Terms of Use</a> &amp; <a href="#">Privacy Policy</a></label>
</div>
<div class="form-group">
<button type="submit" class="btn btn-danger btn-lg btn-block" style="border-
radius:0%;">Register</button>
</div>
</form>
<div class="text-center">Already have an account? <a class="text-success"
href="login.php">Login Here</a></div>
</div>
</body>
<!-- Bootstrap core JavaScript -->
<script src="js/jquery.slim.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- Croppie -->
<script src="js/profile-picture.js"></script>
<!-- Menu Toggle Script -->
<script>
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
</script>
<script>
feather.replace()
</script>

</html>

<?php
include("config.php");
session_start();
if(!isset($_SESSION["email"])){
header("Location: login.php");
exit();
}

$sess_email = $_SESSION["email"];

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 15


Monthly Expense Tracker System

$sql = "SELECT user_id, firstname, lastname, email, profile_path FROM users WHERE email =
'$sess_email'";
$result = $con->query($sql);

if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$userid=$row["user_id"];
$firstname = $row["firstname"];
$lastname = $row["lastname"];
$username =$row["firstname"]." ".$row["lastname"];
$useremail=$row["email"];
$userprofile="uploads/".$row["profile_path"];
}
} else {
$userid="GHX1Y2";
$username ="Jhon Doe";
$useremail="[email protected]";
$userprofile="Uploads/default_profile.png";
}
?>

<?php
include("session.php");
$exp_category_dc = mysqli_query($con, "SELECT expensecategory FROM expenses WHERE
user_id = '$userid' GROUP BY expensecategory");
$exp_amt_dc = mysqli_query($con, "SELECT SUM(expense) FROM expenses WHERE
user_id = '$userid' GROUP BY expensecategory");

$exp_date_line = mysqli_query($con, "SELECT expensedate FROM expenses WHERE


user_id = '$userid' GROUP BY expensedate");
$exp_amt_line = mysqli_query($con, "SELECT SUM(expense) FROM expenses WHERE
user_id = '$userid' GROUP BY expensedate");
?>
<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 16


Monthly Expense Tracker System

<title>Expense Manager - Dashboard</title>

<!-- Bootstrap core CSS -->


<link href="css/bootstrap.min.css" rel="stylesheet">

<!-- Custom styles for this template -->


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

<!-- Feather JS for Icons -->


<script src="js/feather.min.js"></script>
<style>
.card a {
color: #000;
font-weight: 500;
}

.card a:hover {
color: #28a745;
text-decoration: dotted;
}
</style>

</head>

<body>

<div class="d-flex" id="wrapper">

<!-- Sidebar -->


<div class="border-right" id="sidebar-wrapper">
<div class="user">
<img class="img img-fluid rounded-circle" src="<?php echo $userprofile ?>"
width="120">
<h5><?php echo $username ?></h5>
<p><?php echo $useremail ?></p>
</div>
<div class="sidebar-heading">Management</div>
<div class="list-group list-group-flush">
<a href="index.php" class="list-group-item list-group-item-action sidebar-active"><span
data-feather="home"></span> Dashboard</a>
<a href="add_expense.php" class="list-group-item list-group-item-action "><span data-
feather="plus-square"></span> Add Expenses</a>

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 17


Monthly Expense Tracker System

<a href="manage_expense.php" class="list-group-item list-group-item-action "><span data-


feather="rupee-sign"></span> Manage Expenses</a>
</div>
<div class="sidebar-heading">Settings </div>
<div class="list-group list-group-flush">
<a href="logout.php" class="list-group-item list-group-item-action "><span data-
feather="power"></span> Logout</a>
</div>
</div>
<!-- /#sidebar-wrapper -->

<!-- Page Content -->


<div id="page-content-wrapper">

<nav class="navbar navbar-expand-lg navbar-light border-bottom">

<button class="toggler" type="button" id="menu-toggle" aria-expanded="false">


<span data-feather="menu"></span>
</button>

<div class="collapse navbar-collapse" id="navbarSupportedContent">


<ul class="navbar-nav ml-auto mt-2 mt-lg-0">
<li class="nav-item dropdown">

<div class="" aria-labelledby="navbarDropdown">

</div>
</li>
</ul>
</div>
</nav>

<div class="container-fluid">
<h3 class="mt-4">Dashboard</h3>
<div class="row">
<div class="col-md">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col text-center">
<a href="add_expense.php"><img src="icon/addex.png" width="57px" />
<p>Add Expenses</p>

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 18


Monthly Expense Tracker System

</a>
</div>
<div class="col text-center">
<a href="manage_expense.php"><img src="icon/maex.png" width="57px" />
<p>Manage Expenses</p>
</a>

</a>
</div>
</div>
</div>
</div>
</div>
</div>

<h3 class="mt-4">Full-Expense Report</h3>


<div class="row">
<div class="col-md">
<div class="card">
<div class="card-header">
<h5 class="card-title text-center">Monthly Expenses</h5>
</div>
<div class="card-body">
<canvas id="expense_line" height="150"></canvas>
</div>
</div>
</div>
<div class="col-md">
<div class="card">
<div class="card-header">
<h5 class="card-title text-center">Expense Category</h5>
</div>
<div class="card-body">
<canvas id="expense_category_pie" height="150"></canvas>
</div>
</div>
</div>
</div>

</div>
</div>
<!-- /#page-content-wrapper -->

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 19


Monthly Expense Tracker System

</div>
<!-- /#wrapper -->

<!-- Bootstrap core JavaScript -->


<script src="js/jquery.slim.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<!-- Menu Toggle Script -->
<script>
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
</script>
<script>
feather.replace()
</script>
<script>
var ctx = document.getElementById('expense_category_pie').getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: [<?php while ($a = mysqli_fetch_array($exp_category_dc)) {
echo '"' . $a['expensecategory'] . '",';
} ?>],
datasets: [{
label: 'Expense by Category',
data: [<?php while ($b = mysqli_fetch_array($exp_amt_dc)) {
echo '"' . $b['SUM(expense)'] . '",';
} ?>],
backgroundColor: [
'#6f42c1',
'#dc3545',
'#28a745',
'#007bff',
'#ffc107',
'#20c997',
'#17a2b8',
'#fd7e14',
'#e83e8c',
'#6610f2'
],

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 20


Monthly Expense Tracker System

borderWidth: 1
}]
}
});

var line = document.getElementById('expense_line').getContext('2d');


var myChart = new Chart(line, {
type: 'line',
data: {
labels: [<?php while ($c = mysqli_fetch_array($exp_date_line)) {
echo '"' . $c['expensedate'] . '",';
} ?>],
datasets: [{
label: 'Expense by Date ',
data: [<?php while ($d = mysqli_fetch_array($exp_amt_line)) {
echo '"' . $d['SUM(expense)'] . '",';
} ?>],
borderColor: [
'#adb5bd'
],
backgroundColor: [
'#6f42c1',
'#dc3545',
'#28a745',
'#007bff',
'#ffc107',
'#20c997',
'#17a2b8',
'#fd7e14',
'#e83e8c',
'#6610f2'
],
fill: false,
borderWidth: 2
}]
}
});
</script>
</body>

</html>
<?php
include("session.php");

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 21


Monthly Expense Tracker System

$update = false;
$del = false;
$expenseamount = "";
$expensedate = date("Y-m-d");
$expensecategory = "Entertainment";
if (isset($_POST['add'])) {
$expenseamount = $_POST['expenseamount'];
$expensedate = $_POST['expensedate'];
$expensecategory = $_POST['expensecategory'];

$expenses = "INSERT INTO expenses (user_id, expense,expensedate,expensecategory)


VALUES ('$userid', '$expenseamount','$expensedate','$expensecategory')";
$result = mysqli_query($con, $expenses) or die("Something Went Wrong!");
header('location: add_expense.php');
}

if (isset($_POST['update'])) {
$id = $_GET['edit'];
$expenseamount = $_POST['expenseamount'];
$expensedate = $_POST['expensedate'];
$expensecategory = $_POST['expensecategory'];

$sql = "UPDATE expenses SET expense='$expenseamount', expensedate='$expensedate',


expensecategory='$expensecategory' WHERE user_id='$userid' AND expense_id='$id'";
if (mysqli_query($con, $sql)) {
echo "Records were updated successfully.";
} else {
echo "ERROR: Could not able to execute $sql. " . mysqli_error($con);
}
header('location: manage_expense.php');
}

if (isset($_POST['update'])) {
$id = $_GET['edit'];
$expenseamount = $_POST['expenseamount'];
$expensedate = $_POST['expensedate'];
$expensecategory = $_POST['expensecategory'];

$sql = "UPDATE expenses SET expense='$expenseamount', expensedate='$expensedate',


expensecategory='$expensecategory' WHERE user_id='$userid' AND expense_id='$id'";
if (mysqli_query($con, $sql)) {
echo "Records were updated successfully.";
} else {

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 22


Monthly Expense Tracker System

echo "ERROR: Could not able to execute $sql. " . mysqli_error($con);


}
header('location: manage_expense.php');
}

if (isset($_POST['delete'])) {
$id = $_GET['delete'];
$expenseamount = $_POST['expenseamount'];
$expensedate = $_POST['expensedate'];
$expensecategory = $_POST['expensecategory'];

$sql = "DELETE FROM expenses WHERE user_id='$userid' AND expense_id='$id'";


if (mysqli_query($con, $sql)) {
echo "Records were updated successfully.";
} else {
echo "ERROR: Could not able to execute $sql. " . mysqli_error($con);
}
header('location: manage_expense.php');
}

if (isset($_GET['edit'])) {
$id = $_GET['edit'];
$update = true;
$record = mysqli_query($con, "SELECT * FROM expenses WHERE user_id='$userid' AND
expense_id=$id");
if (mysqli_num_rows($record) == 1) {
$n = mysqli_fetch_array($record);
$expenseamount = $n['expense'];
$expensedate = $n['expensedate'];
$expensecategory = $n['expensecategory'];
} else {
echo ("WARNING: AUTHORIZATION ERROR: Trying to Access Unauthorized data");
}
}

if (isset($_GET['delete'])) {
$id = $_GET['delete'];
$del = true;
$record = mysqli_query($con, "SELECT * FROM expenses WHERE user_id='$userid' AND
expense_id=$id");

if (mysqli_num_rows($record) == 1) {
$n = mysqli_fetch_array($record);

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 23


Monthly Expense Tracker System

$expenseamount = $n['expense'];
$expensedate = $n['expensedate'];
$expensecategory = $n['expensecategory'];
} else {
echo ("WARNING: AUTHORIZATION ERROR: Trying to Access Unauthorized data");
}
}
?>
<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">

<title>Expense Manager - Dashboard</title>

<link href="css/bootstrap.min.css" rel="stylesheet">

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

<script src="js/feather.min.js"></script>

</head>

<body>

<div class="d-flex" id="wrapper">

<!-- Sidebar -->


<div class="border-right" id="sidebar-wrapper">
<div class="user">
<img class="img img-fluid rounded-circle" src="<?php echo $userprofile ?>"
width="120">
<h5><?php echo $username ?></h5>
<p><?php echo $useremail ?></p>
</div>
<div class="sidebar-heading">Management</div>

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 24


Monthly Expense Tracker System

<div class="list-group list-group-flush">


<a href="index.php" class="list-group-item list-group-item-action"><span data-
feather="home"></span> Dashboard</a>
<a href="add_expense.php" class="list-group-item list-group-item-action sidebar-
active"><span data-feather="plus-square"></span> Add Expenses</a>
<a href="manage_expense.php" class="list-group-item list-group-item-action"><span
data-feather=></span> Manage Expenses</a>
</div>
<div class="sidebar-heading">Settings </div>
<div class="list-group list-group-flush">

<a href="logout.php" class="list-group-item list-group-item-action "><span data-


feather="power"></span> Logout</a>
</div>
</div>
<!-- /#sidebar-wrapper -->

<!-- Page Content -->


<div id="page-content-wrapper">

<nav class="navbar navbar-expand-lg navbar-light border-bottom">

<button class="toggler" type="button" id="menu-toggle" aria-expanded="false">


<span data-feather="menu"></span>
</button>

<div class="collapse navbar-collapse" id="navbarSupportedContent">


<ul class="navbar-nav ml-auto mt-2 mt-lg-0">
<li class="nav-item dropdown">

<div class="" aria-labelledby="navbarDropdown">

</div>
</li>
</ul>
</div>
</nav>

<div class="container">
<h3 class="mt-4 text-center">Add Your Daily Expenses</h3>
<hr>
<div class="row ">

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 25


Monthly Expense Tracker System

<div class="col-md-3"></div>

<div class="col-md" style="margin:0 auto;">


<form action="" method="POST">
<div class="form-group row">
<label for="expenseamount" class="col-sm-6 col-form-label"><b>Enter
Amount</b></label>
<div class="col-md-6">
<input type="number" class="form-control col-sm-12" value="<?php
echo $expenseamount; ?>" id="expenseamount" name="expenseamount" required>
</div>
</div>
<div class="form-group row">
<label for="expensedate" class="col-sm-6 col-form-
label"><b>Date</b></label>
<div class="col-md-6">
<input type="date" class="form-control col-sm-12" value="<?php echo
$expensedate; ?>" name="expensedate" id="expensedate" required>
</div>
</div>
<fieldset class="form-group">
<div class="row">
<legend class="col-form-label col-sm-6 pt-
0"><b>Category</b></legend>
<div class="col-md">

<div class="form-check">
<input class="form-check-input" type="radio"
name="expensecategory" id="expensecategory4" value="Medicine" <?php echo
($expensecategory == 'Medicine') ? 'checked' : '' ?>>
<label class="form-check-label" for="expensecategory4">
Medicine
</label>
</div>

<div class="form-check">
<input class="form-check-input" type="radio"
name="expensecategory" id="expensecategory3" value="Food" <?php echo ($expensecategory
== 'Food') ? 'checked' : '' ?>>
<label class="form-check-label" for="expensecategory3">
Food
</label>

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 26


Monthly Expense Tracker System

</div>
<div class="form-check">
<input class="form-check-input" type="radio"
name="expensecategory" id="expensecategory2" value="Bills & Recharges" <?php echo
($expensecategory == 'Bills & Recharges') ? 'checked' : '' ?>>
<label class="form-check-label" for="expensecategory2">
Bills and Recharges
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio"
name="expensecategory" id="expensecategory1" value="Entertainment" <?php echo
($expensecategory == 'Entertainment') ? 'checked' : '' ?>>
<label class="form-check-label" for="expensecategory1">
Entertainment
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio"
name="expensecategory" id="expensecategory7" value="Clothings" <?php echo
($expensecategory == 'Clothings') ? 'checked' : '' ?>>
<label class="form-check-label" for="expensecategory7">
Clothings
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio"
name="expensecategory" id="expensecategory6" value="Rent" <?php echo ($expensecategory
== 'Rent') ? 'checked' : '' ?>>
<label class="form-check-label" for="expensecategory6">
Rent
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio"
name="expensecategory" id="expensecategory8" value="Household Items" <?php echo
($expensecategory == 'Household Items') ? 'checked' : '' ?>>
<label class="form-check-label" for="expensecategory8">
Household Items
</label>
</div>
<div class="form-check">

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 27


Monthly Expense Tracker System

<input class="form-check-input" type="radio"


name="expensecategory" id="expensecategory5" value="Others" <?php echo ($expensecategory
== 'Others') ? 'checked' : '' ?>>
<label class="form-check-label" for="expensecategory5">
Others
</label>
</div>
</div>
</div>
</fieldset>
<div class="form-group row">
<div class="col-md-12 text-right">

<?php ?>
<button type="submit" name="add" class="btn btn-lg btn-block btn-
success" style="border-radius: 0%;">Add Expense</button>
<?php ?>
</div>
</div>
</form>
</div>

<div class="col-md-3"></div>

</div>
</div>
</div>
<!-- /#page-content-wrapper -->

</div>
<!-- /#wrapper -->

<!-- Bootstrap core JavaScript -->


<script src="js/jquery.slim.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<!-- Menu Toggle Script -->
<script>
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
</script>

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 28


Monthly Expense Tracker System

<script>
feather.replace();
</script>
<script>

</script>
</body>
</html>
<?php
include("session.php");

$start_date = '';
$end_date = '';
$sql = "SELECT * FROM expenses WHERE user_id = '$userid'";

if (isset($_POST['filter'])) {
$start_date = $_POST['start_date'];
$end_date = $_POST['end_date'];

if (!empty($start_date) && !empty($end_date)) {


$sql .= " AND expensedate BETWEEN '$start_date' AND '$end_date'";
}
}

$exp_fetched = mysqli_query($con, $sql);


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

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Expense Manager - Dashboard</title>

<link href="css/bootstrap.min.css" rel="stylesheet">


<link href="css/style.css" rel="stylesheet">
<!-- Feather JS for Icons -->
<script src="js/feather.min.js"></script>
</head>

<body>

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 29


Monthly Expense Tracker System

<div class="d-flex" id="wrapper">

<!-- Sidebar -->


<div class="border-right" id="sidebar-wrapper">
<div class="user">
<img class="img img-fluid rounded-circle" src="<?php echo $userprofile ?>"
width="120">
<h5><?php echo $username ?></h5>
<p><?php echo $useremail ?></p>
</div>
<div class="sidebar-heading">Management</div>
<div class="list-group list-group-flush">
<a href="index.php" class="list-group-item list-group-item-action"><span data-
feather="home"></span> Dashboard</a>
<a href="add_expense.php" class="list-group-item list-group-item-action "><span
data-feather="plus-square"></span> Add Expenses</a>
<a href="manage_expense.php" class="list-group-item list-group-item-action sidebar-
active"><span data-feather=""></span> Manage Expenses</a>
</div>
<div class="sidebar-heading">Settings </div>
<div class="list-group list-group-flush">
<a href="logout.php" class="list-group-item list-group-item-action "><span data-
feather="power"></span> Logout</a>
</div>
</div>
<!-- Page Content -->
<div id="page-content-wrapper">
<nav class="navbar navbar-expand-lg navbar-light border-bottom">
<button class="toggler" type="button" id="menu-toggle" aria-expanded="false">
<span data-feather="menu"></span>
</button>

<div class="collapse navbar-collapse" id="navbarSupportedContent">


<ul class="navbar-nav ml-auto mt-2 mt-lg-0">
<li class="nav-item dropdown">
<div class="" aria-labelledby="navbarDropdown">
</div>
</li>
</ul>
</div>
</nav>

<div class="container-fluid">

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 30


Monthly Expense Tracker System

<h3 class="mt-4 text-center">Manage Expenses</h3>


<hr>

<!-- Date filter form -->


<div class="row justify-content-center mb-4">
<div class="col-md-6">
<form method="POST" action="manage_expense.php" class="form-inline">
<label for="start_date" class="mr-2">Start Date:</label>
<input type="date" name="start_date" class="form-control mr-2"
value="<?php echo $start_date; ?>">
<label for="end_date" class="mr-2">End Date:</label>
<input type="date" name="end_date" class="form-control mr-2" value="<?php
echo $end_date; ?>">
<button type="submit" name="filter" class="btn btn-
primary">Submit</button>
</form>
</div>
</div>

<div class="row justify-content-center">


<div class="col-md-6">
<table class="table table-hover table-bordered">
<thead>
<tr class="text-center">
<th>Sr.NO</th>
<th>Date</th>
<th>Amount</th>
<th>Expense Category</th>
</tr>
</thead>
<!-- For adding information into a table -->
<?php
$count = 1;
while ($row = mysqli_fetch_array($exp_fetched)) { ?>
<tr>
<td><?php echo $count; ?></td>
<td><?php echo $row['expensedate']; ?></td>
<td><?php echo $row['expense']; ?></td>
<td><?php echo $row['expensecategory']; ?></td>

</td>
</tr>
<?php $count++;

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 31


Monthly Expense Tracker System

} ?>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->

</div>
<!-- /#wrapper -->

<!-- Bootstrap core JavaScript -->


<script src="js/jquery.slim.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/Chart.min.js"></script>
<!-- Menu Toggle Script -->
<script>
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
</script>
<script>
feather.replace()
</script>

</body>

</html>
<?php
session_start();
if(session_destroy())
{
header("Location: login.php");
}
?>

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 32


Monthly Expense Tracker System

Input/Output Sample Screenshort

❖ Login page

❖ Registration page

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 33


Monthly Expense Tracker System

❖ Dashboard
❖ Dashboard

❖ Add Expense
❖ Dashboard

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 34


Monthly Expense Tracker System

❖ Manage Expenses
❖ Dashboard

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 35


Monthly Expense Tracker System

Future Scope

1. Mobile Application Integration: Developing a mobile app version of the expense tracker
can significantly increase accessibility and user engagement. This would allow users to
track their expenses on the go, offering features like real-time notifications and location-
based expense tracking.

2. Advanced Analytics: Incorporating advanced data analytics and machine learning


algorithms can provide users with deeper insights into their spending habits. Predictive
analytics could forecast future expenses based on past behavior, and provide personalized
financial advice.

3. Integration with Financial Institutions: Enabling direct integration with banks and credit
card companies can automate the process of expense tracking. This would eliminate the
need for manual entry, making the system more user-friendly and efficient.

4. Multi-Currency and Multi-Language Support: Adding support for multiple currencies


and languages can expand the user base globally. This feature is particularly useful for users
who travel frequently or live in multilingual regions.

5. Enhanced Security Features: Implementing advanced security measures such as two-


factor authentication, encryption of sensitive data, and secure user authentication methods
will enhance user trust and protect financial information from unauthorized access.

6. Expense Sharing and Collaboration: Features allowing users to share expenses and
collaborate on budgets can be beneficial for households, roommates, and business partners.
This could include shared accounts and collaborative budget management tools.

7. Bill Reminders and Payment Integration: Adding functionality to set bill reminders and
integrate with payment gateways can help users manage their bills efficiently, avoiding late
fees and maintaining good financial health.

8. Gamification and Rewards: Introducing gamification elements such as achievements,


badges, and rewards for good financial habits can increase user engagement and encourage
better financial practices.

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 36


Monthly Expense Tracker System

9. Open API for Developers: Providing an open API would allow third-party developers to
create additional plugins and features, enhancing the system's functionality and creating a
community-driven ecosystem.

10. Cloud-Based Solution: Transitioning to a cloud-based infrastructure can offer users the
flexibility to access their expense tracker from any device with internet connectivity,
ensuring data is synchronized and backed up securely.

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 37


Monthly Expense Tracker System

Conclusion

In Conclusion, The Monthly Expense Tracker System using a PHP backend is a robust
solution for individuals and families looking to manage their finances more effectively. It
offers a comprehensive platform for tracking expenses, setting budgets, and generating
insightful reports. The use of PHP ensures a reliable and scalable backend, capable of
handling various user demands and data processing requirements. It simplifies the process
of tracking and analyzing expenses, providing users with valuable insights into their
spending behavior. As personal finance management continues to be a critical skill, this
application has the potential to help users achieve greater financial control and stability.

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 38


Monthly Expense Tracker System

References

1. Online Articles and Tutorials: Mearian, L. (2020). "Best Expense Tracker Apps and
Software". TechRadar. Available at: TechRadar.

2. Websites and Blogs: The Balance. (2021). "How to Track Your Spending". Available at:
The Balance.

3. Mobile Applications: Mint: Available on Google Play and App Store.

4. Online Courses: PHP with MySQL Essential Training: The Basics Platform: LinkedIn
Learning Instructor: Kevin Skoglund URL: https://www.linkedin.com/learning/php-with-
mysql-essential-training-1-the-basics

D.C.P.E, P.G.D.C.S.T, H.V.P.M, Amravati. Page 39

You might also like