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

Final Document

The document is a project report on the 'SMART SPEND APP,' a mobile application designed to automate personal finance management by tracking expenses, providing investment guidance, and estimating taxes. The application aims to simplify financial management through intelligent analysis and automated transaction detection, enhancing user financial awareness. The report includes sections on introduction, literature survey, system analysis, design, implementation, testing, and future enhancements.

Uploaded by

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

Final Document

The document is a project report on the 'SMART SPEND APP,' a mobile application designed to automate personal finance management by tracking expenses, providing investment guidance, and estimating taxes. The application aims to simplify financial management through intelligent analysis and automated transaction detection, enhancing user financial awareness. The report includes sections on introduction, literature survey, system analysis, design, implementation, testing, and future enhancements.

Uploaded by

barutulasiram0
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

A

PROJECT REPORT

ON
“SMART SPEND APP”

Submitted in partial fulfilment of the requirement for the award of the

DIPLOMA IN COMPUTER SCIENCE


by

BARU TULASI RAM

(23248-CS-009)

Under the Guidance Of

SANJANA
(Assistant Professor)
Department of CSE

Department of Computer Science and Engineering


TEEGALA KRISHNA REDDY ENGINEERING COLLEGE
(UGC AUTONOMOUS)
Medbowli, Meerpet, Saroornagar, Hyderabad – 500097
(Affiliated to JNTUH, Approved by AICTE, Accredited by NBA)
(2023-2026)

i
CERTIFICATE

This is to certify that the Project report on “SMART SPEND APP” is a Bonafide work
carried out by BARU TULASI RAM (23248-CS-009), in partial fulfillment for the
requirement of the award of Diploma in Computer Science and Engineering, Teegala
Krishna Reddy Engineering College, Hyderabad, affiliated to State Board of Technical
Education and Training, Hyderabad under my guidance and supervision.
The result of investigation enclosed in this report have been verified and found satisfactory.
The results embodied in the project work have not been submitted to any other University
for the award of any degree.

INTERNAL GUIDE HEAD OF DEPARTMENT


[Link] [Link] PRIYA
(Assistant Professor) (Assistant Professor)

EXTERNAL EXAMINER PRINCIPAL


Dr.P. VENAKT RAM REDDY
(Professor)

ii
DECLARATION

I hereby declare that the Project report entitled “SMART SPEND APP” is
done under the guidance of SANJANA, Assistant Professor, Department of Computer
Science, Teegala Krishna Reddy Engineering College, is submitted in partial fulfillment of
the requirements for the award of the DIPLOMA IN COMPUTER SCIENCE from
SBTET (State Board of Technical Education and Training) Telangana, Hyderabad.
This is a record of Bonafide work carried out by me in Teegala Krishna Reddy
Engineering College and the results embodied in this project have not been reproduced or
copied from any source.

SUBMITTED BY
B. TULASI RAM

(23248-CS-009)

iii
ACKNOWLEDGEMENT

I extend my deep sense of gratitude to Dr. VENKAT RAM REDDY, Principal,


Teegala Krishna Reddy Engineering College, Meerpet, for permitting me to undertake this
project.

I indebted to Ms. BINDU PRIYA, Assistant Professor, Head of the Department,


Computer Science, Teegala Krishna Reddy Engineering College, Meerpet for her support
and guidance throughout our project.

I indebted to our guide Ms. SANJANA Assistant professor, Computer Science,


Teegala Krishna Reddy Engineering College, Meerpet for her support and guidance
throughout our project.

The satisfaction and euphoria that accompanies the successful completion of any task
would be incomplete without the mention of the people who made it possible and whose
encouragement and guidance have crowned our efforts with success.

Finally, I express thanks to one and all that have helped me in successfully completing
this project. Further I would like to thank my family and friends for their moral support and
encouragement.

SUBMITTED BY
B. TULASI RAM
(23248-CS-009)

iv
ABSTRACT

Managing personal finances has become challenging due to the increasing use of digital payment
methods and the growing complexity of financial planning. Many individuals find it difficult to track
their daily expenses, plan investments, and estimate taxes accurately because existing solutions either
require manual effort or provide limited insights. This often leads to poor financial awareness and
inefficient money management.
This project presents an Automatic Personal Expense Tracker with Investment Guidance and
Tax Estimation, a mobile application designed to simplify personal finance management through
automation and intelligent analysis. The application automatically detects financial transactions by
analyzing transaction alerts generated on the user’s mobile device, eliminating the need for manual
expense entry. These transactions are processed and categorized to provide users with a clear
understanding of their spending patterns.
The system analyzes historical expense data to generate meaningful insights such as spending trends
and expense summaries, helping users make better financial decisions. In addition to expense
tracking, the application offers investment guidance based on the user’s financial behavior, capacity,
and risk preference. Rather than executing investments directly, the system provides advisory-level
suggestions to support safe and informed investment planning.
The application also includes a tax estimation module that calculates the user’s potential tax liability
by considering income details and applicable tax rules. It allows users to compare tax regimes and
identify possible tax-saving opportunities, enabling proactive financial planning. Security and privacy
are prioritized by avoiding direct bank credential access and handling sensitive data responsibly.
Overall, the proposed system aims to provide a user-friendly and reliable solution for automatic
expense tracking, investment guidance, and tax estimation, thereby improving financial awareness
and promoting better long-term financial well-being.

v
TABLE OF CONTENTS

CHAPTER NO. TITLE PAGE NO.


ABSTRACT v

1. INTRODUCTION 1-3
1.1 GENERAL 1
1.2 SCOPE OF THE PROJECT 2
1.3 OBJECTIVE 3

2. LITERATURE SURVEY 4-5

2.1 Introduction 4-5


2.2 Traditional Expense Tracking Systems
2.3 Automated Expense Tracking Applications
2.4 Intelligent Financial Analysis and Budgeting
2.5 Investment Guidance Systems
2.6 Tax Estimation Tools
2.7 Security and Privacy Concerns
2.8 Research Gap and Need for Proposed System

3.
SYSTEM ANALYSIS 6-8
3.1 EXISTING SYSTEM 6

3.2 PROPOSED SYSTEM 6

3.3 PROCESS MODEL USED WITH JUSTIFICATION


7

3.4 HARDWARE REQUIREMENTS 8

3.5 SOFTWARE REQUIREMENTS 8

vi
SYSTEM DESIGN
4.1 UML DIAGRAMS 09 - 17
4.1.1 USE CASE DIAGRAM 09

4.1.2 CLASS DIAGRAM 10

4.1.3 OBJECT DIAGRAM 11

4.1.4 STATE DIAGRAM 12

4.1.5 ACTIVITY DIAGRAM 13

4.1.6 SEQUENCE DIAGRAM 14

4.1.7 COMPONENT DIAGRAM 15


4.1.8 COLLABRATION DIAGRAM 16

4.1.9 DEPLOYMENT DIAGRAM 16


4.2 SYSTEM ARCHITECTURE 17
5. IMPLEMENTATION 18-44

5.1 SMS-Based Transaction Detection 18


5.2 Transaction Processing and Categorization 18
5.3 Expense Management Module 19
5.4 Analytics and Financial Insights 19
5.5 Investment Guidance Module 19
5.6 Tax Estimation Module 19

5.7 Data Storage and Security 20

5.8 User Interface Implementation 20

5.9 Summary 20

5.10 Source Code 21 - 44

vi
6. TESTING 45-47
6.1 TESTING AND IMPLEMENTATION 45
6.2 TYPES OF TESTS 45
6.2.1 UNIT TESTING 45
6.2.2 FUNCTION TESTING 46
6.2.3 SYSTEM TESTING 46
6.2.4 PERFORMANCE TESTING 46
6.2.5 INTEGRATION TESTING 47
6.2.6 ACCEPTANCE TESTING 47
6.2.7 BUILD THE TEST PLAN 47

vi
7. OUTPUT SCREENS 49-51

8. FUTURE ENHANCEMENT 52

9. CONCLUSION 53

10 REFERENCE 54

viii
LIST OF FIGURES

FIGURE NO NAME OF THE FIGURE PAGE NO.

4.1.1 Use case Diagram 09

4.1.2 Class diagram 10

4.1.3 Object diagram 11

4.1.4 State Diagram 12

4.1.5 Activity Diagram 13

4.1.6 Sequence diagram 14

4.1.7 Component diagram 15

4.1.8 Collaboration Diagram 16

4.1.9 Deployment Diagram 16


4.2 Architecture Diagram 17

ix
CHAPTER-1
INTRODUCTION

INTRODUCTION:

Managing personal finances has become an important part of everyday life. With multiple
digital payment options such as UPI, debit cards, and online banking, people make several
transactions daily but often fail to track where their money is actually spent. Most individuals
either do not record their expenses regularly or depend on manual methods, which are time-
consuming and difficult to maintain. As a result, they lack a clear understanding of their
spending habits, savings, investments, and tax obligations.
To address this problem, this project introduces an Automatic Personal Expense Tracker with
Investment Guidance and Tax Estimation, a mobile application designed to make personal
finance management simple and user-friendly. The main goal of the application is to reduce
manual effort and help users gain better control over their finances through automation and
intelligent analysis.
The application automatically detects financial transactions by analyzing transaction alerts
generated on the user’s mobile device. This removes the need for users to manually enter each
expense. The detected transactions are then organized and categorized to provide a clear
picture of the user’s spending behaviour. By analysing past transaction data, the system
identifies spending patterns and highlights areas where expenses are increasing, helping users
make more informed financial decisions.
In addition to expense tracking, the application provides investment guidance based on the
user’s spending behaviour, financial capacity, and risk preference. Instead of directly executing
investments, the system offers suggestions such as suitable investment types and goal-based
saving plans. This approach keeps the system safe and compliant while still assisting users in
planning their investments effectively.
The application also includes a tax estimation feature that helps users understand their possible
tax liability. By considering income details and applicable tax rules, the system estimates taxes
under different regimes and highlights potential tax-saving opportunities. This enables users to
plan their finances throughout the year rather than waiting until the time of tax filing.

1
1.1 SCOPE OF THE PROJECT

The scope of this project focuses on developing a mobile application that simplifies personal
financial management through automation, analysis, and user-friendly design. The application
is designed to assist individuals in tracking their expenses, planning investments, and
estimating tax liabilities in an efficient and reliable manner. The system primarily targets
users who perform frequent digital transactions and require a consolidated view of their
financial activities.
The project includes automatic detection of financial transactions by analysing transaction
alerts generated on the user’s mobile device. This enables the system to record expenses and
income without manual input, reducing user effort and improving accuracy. The application
processes and categorizes transaction data to present structured summaries of daily, monthly,
and category-wise spending.
Another important aspect of the project scope is financial analysis. The system analyses
historical expense data to identify spending patterns, trends, and irregularities. These insights
help users understand their financial behaviour and take corrective actions when necessary.
Budget tracking and spending summaries further enhance financial awareness.
The project also covers investment guidance, where users receive advisory-level suggestions
based on their spending behaviour, financial capacity, and risk preference. The application
supports goal-based planning and provides guidance without executing actual investments,
ensuring regulatory safety.
Additionally, the project includes a tax estimation module that calculates potential tax
liability based on user-provided income details and applicable tax rules. The system allows
users to compare different tax regimes and identify tax-saving opportunities, supporting better
financial planning throughout the year.
The scope of the project is limited to providing financial insights and guidance rather than
performing direct banking operations, investment transactions, or tax filing. Security and
privacy considerations are incorporated by avoiding direct bank credential access and
ensuring responsible data handling. Overall, the project aims to deliver a practical, automated,
and user-centric personal finance management solution suitable for real-world usage.

2
1.2 OBJECTIVE

The main objective of this project is to design and develop an intelligent personal finance
management application that helps users effectively track their expenses, plan investments,
and estimate taxes in an automated and user-friendly manner. The application aims to
simplify financial management by reducing manual effort and improving financial
awareness.
One of the primary objectives is to automate expense tracking by detecting and recording
financial transactions from transaction alerts, minimizing the need for manual data entry.
This helps users maintain accurate and up-to-date financial records with minimal effort.
Another objective is to categorize expenses and income systematically to provide clear
insights into spending patterns. By analysing categorized data, the application helps users
understand where their money is being spent and identify areas where expenses can be
controlled.
The project also aims to provide meaningful financial analysis by generating summaries,
reports, and visual representations of expenses over daily, monthly, and yearly periods. This
objective supports better budgeting and financial decision-making.
An important objective of the system is to offer investment guidance based on the user’s
financial behaviour, income, and spending capacity. The application suggests suitable
investment options and savings strategies to help users achieve financial goals without
directly executing transactions.
Additionally, the project focuses on estimating tax liability by calculating approximate taxes
based on user-entered income details and applicable tax rules. This objective helps users
plan tax savings and avoid last-minute financial stress.
Another objective is to ensure data security and user privacy by avoiding direct bank
account access and implementing safe data handling practices. The system is designed to
provide guidance and insights rather than performing financial transactions.
Overall, the objective of this project is to create a reliable, automated, and intelligent
personal finance assistant that supports users in managing their finances efficiently and
responsibly.

3
CHAPTER-2
LITERATURE SURVEY

2.1 Introduction
The rapid growth of digital payment systems and online banking has led to an increase in financial
transactions in everyday life. Managing personal finances manually has become difficult for
individuals due to multiple spending sources such as bank transfers, UPI payments, wallets, and card
transactions. As a result, there is a growing demand for intelligent personal finance management
applications that can automate expense tracking and provide meaningful financial insights.

2.2 Traditional Expense Tracking Systems


Earlier personal finance management systems relied on manual methods such as notebooks,
spreadsheets, and simple budgeting applications. Users were required to record each transaction
manually, categorize expenses, and calculate monthly summaries. Although these methods helped in
basic financial tracking, they were time-consuming, error-prone, and required strong user discipline.
Many users discontinued usage due to the repetitive nature of manual data entry.

2.3 Automated Expense Tracking Applications


The advancement of smartphone technology, modern financial applications introduced automated
expense tracking mechanisms. Applications like Wallet automatically read SMS transaction alerts sent
by banks and digital wallets. These applications extract transaction details such as amount, date, and
type (credited or debited) and categorize expenses accordingly. This approach significantly reduces
manual effort and improves tracking accuracy.
However, SMS-based systems depend heavily on predefined keywords and message formats. Since
different banks use different SMS templates, these systems may sometimes fail to detect or correctly
categorize transactions.

2.4 Intelligent Financial Analysis and Budgeting


Recent developments in personal finance applications focus on intelligent analysis of spending
behavior. These systems analyse historical expense data to identify spending patterns, generate
monthly summaries, and provide budget recommendations. Some applications offer alerts when users
4
exceed their budget limits. While these features enhance financial awareness, many applications
provide generic insights rather than personalized recommendations.

2.5 Investment Guidance Systems


Investment guidance is an emerging feature in modern finance management applications. These
systems recommend suitable investment options based on income, expenses, and risk preference.
However, most existing applications offer basic investment suggestions without detailed
personalization. In many cases, investment features are separated from expense tracking, requiring
users to rely on multiple applications for financial planning.

2.6 Tax Estimation Tools


Tax estimation tools are integrated into some finance applications to help users estimate their tax
liabilities. These tools calculate approximate taxes based on income and expense data. However, many
existing systems provide simplified calculations and do not fully adapt to individual financial profiles.
As a result, users often treat these estimates as rough guidance rather than accurate planning tools.

2.7 Security and Privacy Concerns


Security and data privacy remain major challenges in personal finance applications. Many existing
systems require users to link their bank accounts or upload financial data to cloud servers. This raises
concerns about data misuse and unauthorized access. Users increasingly prefer applications that
provide financial insights without directly accessing bank credentials or performing transactions.

2.8 Research Gap and Need for Proposed System


Based on the literature survey, it is observed that existing systems either focus on automation or
advanced analytics but rarely offer a balanced solution. There is a need for a system that combines
automated expense tracking, intelligent financial insights, investment guidance, and tax estimation
while ensuring user privacy and simplicity. The proposed Smart Spend application aims to address
these gaps by providing an automated yet secure personal finance tracking system suitable for
individual users and academic implementation.

5
CHAPTER-3
SYSTEM ANALYSIS

3.1 EXISTING SYSTEM

The existing personal finance management systems mainly rely on manual expense

tracking or partially automated applications. In manual systems, users record their daily

expenses using notebooks, spreadsheets, or basic mobile applications. These systems

require continuous user effort and are prone to errors due to missed or incorrect entries.

Some modern applications automatically track expenses by reading SMS transaction alerts

sent by banks and digital wallets. Applications such as Money View categorize expenses

and show spending patterns. However, these systems have limitations such as dependency

on SMS formats, limited personalization, basic investment guidance, and simplified tax

estimation. Additionally, many existing systems raise privacy concerns by accessing

sensitive financial data.

3.2 PROPOSED SYSTEM

The proposed system, Smart Spend – Intelligent Personal Finance Tracker, is designed

to overcome the limitations of the existing system. It is an automated personal expense

tracker that reads transaction-related SMS messages from the user’s mobile device to

identify income and expenses.

The system automatically categorizes transactions, analyses spending behaviour, and

provides meaningful insights. In addition to expense tracking, the proposed system includes
6
investment guidance and tax estimation features to help users make informed financial

decisions. The application focuses on automation, user convenience, data security, and

simplicity, making it suitable for personal use and academic implementation.

3.3 PROCESS MODEL USED WITH JUSTIFICATION

The Incremental Model is used for developing the Smart Spend application.

In this model, the system is developed and delivered in small increments. Each increment

adds new features and improves existing functionality. This model is suitable for the

proposed system because the application contains multiple modules such as expense

tracking, analytics, investment guidance, and tax estimation.

Justification:

 Allows step-by-step development and testing

 Reduces risk by identifying issues early

 Enables easy addition of new features

 Suitable for applications with evolving requirements

Thus, the Incremental Model ensures flexibility, reliability, and efficient development of

the Smart Spend application.

7
3.4 HARDWARE REQUIREMENTS

The minimum hardware requirements for running the Smart Spend application are:

 Android smartphone

 Minimum 2 GB RAM

 Minimum 16 GB internal storage

 Processor: Quad-core or higher

 Internet connectivity (Wi-Fi or mobile data)

3.5 SOFTWARE REQUIREMENTS

The software requirements for developing and running the application are:

 Operating System: Android 8.0 or above

 Programming Languages: Java / JavaScript

 Framework: Capacitor / Android SDK

 Database: SQLite / Local storage

 Development Tools: Android Studio, VS Code

 Version Control: Git

8
CHAPTER-4

SYSTEM DESIGN

4.1 UML DIAGRAM:

4.1.1 USE CASE DIAGRAM:

The main purpose of a use case diagram is to show what system functions are performed for
which actor. Roles of the actors in the system can be depicted. The above diagram consists of
user as actor. Each will play a certain role achieve the concept.

9
4.1.2 CLASS DIAGRAM:

In this class diagram represents how the classes with attributes and methods are linked together
to perform the verification with security. From the above diagram shown the various classes
involved in our project.

10
4.1.3 OBJECT DIAGRAM:

In the above digram tells about the flow of objects between the classes. It is a diagram that
shows a complete or partial view of the structure of a modeled system. In this object diagram
represents how the classes with attributes and methods are linked together to perform the
verification with security.

11
4.1.4 STATE DIAGRAM

State diagram are a loosely defined diagram to show workflows of stepwise activities and
actions, with support for choice, iteration and concurrency.

12
4.1.5 ACTIVITY DIAGRAM:

Activity diagrams are graphical representations of workflows of stepwise activities and


actions with support for choice, iteration and concurrency. In the Unified Modeling Language,
activity diagrams can be used to describe the business and operational step-by-step workflows
of components in a system. An activity diagram shows the overall flow of control.
13
4.1.6 SEQUENCE DIAGRAM

A sequence diagram in Unified Modeling Language (UML) is a kind of interaction diagram that
shows how processes operate with one another and in what order. It is a construct of a Message
Sequence Chart. A sequence diagram shows object interactions arranged in time sequence. It depicts
the objects and classes involved in the scenario and the sequence of messages exchanged between
the objects needed to carry out the functionality of the scenario.

14
4.1.7 COMPONENT DIAGRAM :

In the Unified Modeling Language, a component diagram depicts how components are wired
together to form larger components and or software systems. They are used to illustrate the
structure of arbitrarily complex systems. User gives main query and it converted into sub
queries and sends through data dissemination to data aggregators. Results are to be showed to
user by data aggregators. All boxes are components and arrow indicates dependencies.

15
4.1.8 COLLABORATION DIAGRAM:

A collaboration diagram, also called a communication diagram or interaction diagram

Illustration in interaction.

4.1.9 DEPLOYMENT DIAGRAM

Deployment Diagram is a type of diagram that specifies the physical hardware on which the software
system will execute. It also determines how the software is deployed on the underlying hardware.
16
4.2 SYSTEM ARCHITECTURE:

17
CHAPTER-5

IMPLEMENTATION

The implementation of the Smart Spend application focuses on automating personal expense
tracking using an Android-based mobile platform. The system is implemented using Java,
Android SDK, and Capacitor plugins to access device-level features. The implementation is
modular, ensuring clarity, maintainability, and ease of future enhancements.

5.1 SMS-BASED TRANSACTION DETECTION

The core functionality of the application is automatic expense detection using SMS transaction
alerts. The system uses a custom Capacitor plugin (SMSPlugin) to access SMS inbox data after
obtaining user permission. The plugin reads recent SMS messages from the device and filters
transaction-related messages using predefined keywords such as “debited,” “credited,” “INR,”
and “Rs”.
Once a relevant message is identified, essential transaction details such as sender address,
message content, and timestamp are extracted. This approach avoids direct bank account
integration while still enabling automated expense tracking.

5.2 TRANSACTION PROCESSING AND CATEGORIZATION

Extracted SMS data is processed to identify transaction type (credit or debit) and amount. The
system applies rule-based logic to categorize transactions into expense categories such as food,
travel, shopping, and utilities. This categorization helps in organizing raw transaction data into
meaningful financial records.
Each processed transaction is converted into a structured transaction object, which is then stored
locally for further analysis.

18
5.3 EXPENSE MANAGEMENT MODULE

The Expense Management module maintains a list of categorized transactions and calculates
total expenses over different time periods such as daily, monthly, and yearly. It provides
summary data that is used to display spending information on the application dashboard.
This module acts as a bridge between raw transaction data and analytical components of the
system.

5.4 ANALYTICS AND FINANCIAL INSIGHTS

The Analytics module analyzes historical expense data to identify spending patterns and trends.
It generates summaries such as category-wise spending, monthly expense comparison, and
overall expenditure reports. These insights help users understand their financial behavior and
identify areas where expenses can be controlled.
The analytical results are presented in a simple and user-friendly format for easy understanding.

5.5 INVESTMENT GUIDANCE MODULE

The Investment Guidance module provides advisory-level suggestions based on the user’s
spending behavior, income level, and savings capacity. Instead of executing real investments, the
system suggests suitable investment types and saving strategies. This ensures regulatory safety
while still assisting users in financial planning.

5.6 TAX ESTIMATION MODULE

The Tax Estimation module calculates approximate tax liability using user-provided income
details and predefined tax rules. It allows users to estimate taxes under different tax regimes and
identify potential tax-saving opportunities. This feature helps users plan finances throughout the
year.

19
5.7 DATA STORAGE AND SECURITY

All financial data is stored locally using a lightweight database to ensure fast access and
improved privacy. The application does not store bank credentials or perform financial
transactions, reducing security risks. Permission-based access ensures that user consent is
obtained before reading SMS data.

5.8 USER INTERFACE IMPLEMENTATION

The user interface is designed to be simple and intuitive. It provides dashboards, summaries, and
insights in an easily understandable manner. The interface allows users to view expenses,
analyze spending patterns, and access investment and tax-related information with minimal
interaction.

5.9 SUMMARY

The Smart Spend application is implemented as a modular, secure, and automated personal
finance management system. By combining SMS-based transaction detection, expense
categorization, analytics, investment guidance, and tax estimation, the system provides a
practical and user-friendly solution for managing personal finances.

5.10 SOURCE CODE

Main Activity

package [Link];

import [Link];
import [Link];

public class MainActivity extends BridgeActivity {

@Override
public void onCreate(Bundle savedInstanceState) {
20
[Link](savedInstanceState);
registerPlugin([Link]);
registerPlugin([Link]);
}
}

SMS Plugin

package [Link];

import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

@CapacitorPlugin(
name = "SMSPlugin",
permissions = {
@Permission(
alias = "sms",
strings = {[Link].READ_SMS}
)
}
)
public class SMSPlugin extends Plugin {

@PluginMethod
public void getRecentSMS(PluginCall call) {
if (getPermissionState("sms") != [Link]) {
requestPermissionForAlias("sms", call, "smsCallback");
} else {
loadSMS(call);
}
}

@PermissionCallback
public void smsCallback(PluginCall call) {
if (getPermissionState("sms") == [Link]) {
loadSMS(call);
21
} else {
[Link]("SMS permission was denied");
}
}

private void loadSMS(PluginCall call) {


Cursor cur = null;
try {
JSArray messages = new JSArray();
[Link] uriSMSURI = [Link]("content://sms/inbox");
cur = getContext().getContentResolver().query(uriSMSURI, null, null, null, "date DESC");

if (cur != null) {
int totalProcessed = 0;
int messagesFound = 0;

while ([Link]() && messagesFound < 100 && totalProcessed < 1000) {
totalProcessed++;

int addressIdx = [Link]("address");


int bodyIdx = [Link]("body");
int dateIdx = [Link]("date");

if (addressIdx == -1 || bodyIdx == -1 || dateIdx == -1) {


continue;
}

String address = [Link](addressIdx);


String body = [Link](bodyIdx);
long date = [Link](dateIdx);

if (body == null) {
continue;
}
String lowerBody = [Link]();

// Spam detection
boolean isSpam = [Link]("offer") || [Link]("promo")
|| [Link]("discount") || [Link]("win")
|| [Link]("lottery") || [Link]("vouchers")
|| [Link]("free") || [Link]("sale")
|| [Link]("congrats");

// Bank & UPI Transaction Detection


boolean isBankMessage = !isSpam && ([Link]("₹") || [Link]("rs.")
|| [Link]("rs ")
|| [Link]("inr") || [Link]("debited") ||
[Link]("credited")
|| [Link]("a/c") || [Link]("acct") || [Link]("txn")
22
|| [Link]("upi") || [Link]("vpa") || [Link]("spent")
|| [Link]("paid") || [Link]("transfer") ||
[Link]("received")
|| [Link]("bal") || [Link]("balance") || [Link]("cr
") || [Link]("dr "));

if (isBankMessage) {
JSObject msg = new JSObject();
[Link]("address", address);
[Link]("body", body);
[Link]("date", date);
[Link](msg);
messagesFound++;
}
}
}

JSObject ret = new JSObject();


[Link]("messages", messages);
[Link](ret);
} catch (Exception e) {
Log.e("SMSPlugin", "Error reading SMS", e);
[Link]("Failed to read SMS: " + [Link]());
} finally {
if (cur != null && ![Link]()) {
[Link]();
}
}
}
}

Transaction

import { useEffect, useState } from 'react';


import { supabase } from '../../lib/supabase';
import { useAuth } from '../../contexts/AuthContext';
import { Transaction, Category, Account } from '../../types';
import { Plus, Search, Edit2, Trash2, ArrowUpCircle, Download } from 'lucide-react';
import TransactionModal from './TransactionModal';
import { exportTransactionsToPDF, exportTransactionsToExcel } from '../../lib/export';
import { AuditService } from '../../lib/audit';
import { FileSpreadsheet } from 'lucide-react';

export default function Transactions() {


const { user } = useAuth();
const [transactions, setTransactions] = useState<Transaction[]>([]);
const [categories, setCategories] = useState<Category[]>([]);
const [accounts, setAccounts] = useState<Account[]>([]);
23
const [loading, setLoading] = useState(true);
const [showModal, setShowModal] = useState(false);
const [editingTransaction, setEditingTransaction] = useState<Transaction | null>(null);
const [searchTerm, setSearchTerm] = useState('');
const [filterType, setFilterType] = useState<'all' | 'expense' | 'income'>('all');
const [filterCategory, setFilterCategory] = useState<string>('all');

useEffect(() => {
if (user) {
loadData();
}
}, [user]);

const loadData = async () => {


try {
const [transactionsRes, categoriesRes, accountsRes] = await [Link]([
supabase
.from('transactions')
.select('*, category:categories(*), account:accounts(*)')
.eq('user_id', user!.id)
.order('date', { ascending: false })
.order('created_at', { ascending: false }),
[Link]('categories').select('*').or(`user_id.eq.${user!.id},is_system.[Link]`),
[Link]('accounts').select('*').eq('user_id', user!.id),
]);

if ([Link]) setTransactions([Link] as Transaction[]);


if ([Link]) setCategories([Link]);
if ([Link]) setAccounts([Link]);
} catch (error) {
[Link]('Error loading transactions:', error);
} finally {
setLoading(false);
}
};

const handleDelete = async (id: string) => {


if (!confirm('Are you sure you want to delete this transaction?')) return;

const transaction = [Link](t => [Link] === id);


if (!transaction) return;

await [Link]('transactions').delete().eq('id', id);

const account = [Link](a => [Link] === transaction.account_id);


if (account) {
const newBalance = [Link] === 'expense'
? [Link] + [Link]
: [Link] - [Link];
24
await [Link]('accounts').update({ balance: newBalance }).eq('id', [Link]);
}

await [Link](
user!.id,
'DELETE_TRANSACTION',
'transaction',
id,
{ amount: [Link], description: [Link] }
);

loadData();
};

const handleEdit = (transaction: Transaction) => {


setEditingTransaction(transaction);
setShowModal(true);
};

const handleModalClose = () => {


setShowModal(false);
setEditingTransaction(null);
loadData();
};

const filteredTransactions = [Link](transaction => {


const matchesSearch = [Link]().includes([Link]()) ||
[Link]().includes([Link]());
const matchesType = filterType === 'all' || [Link] === filterType;
const matchesCategory = filterCategory === 'all' || transaction.category_id === filterCategory;
return matchesSearch && matchesType && matchesCategory;
});

const totalIncome = [Link](t => [Link] === 'income').reduce((sum, t) => sum +


[Link], 0);

if (loading) {
return (
<div className="flex items-center justify-center h-96">
<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"></div>
</div>
);
}

return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<div>
<h1 className="text-3xl font-bold text-gray-900 mb-2">Transactions</h1>
25
<p className="text-gray-600">Manage all your income and expenses</p>
</div>
<div className="flex gap-2 min-w-0">
<button
onClick={() => exportTransactionsToPDF(filteredTransactions)}
className="flex items-center justify-center gap-2 bg-white border border-gray-200 text-gray-700
px-3 md:px-6 py-3 rounded-lg font-semibold hover:bg-gray-50 transition-all shadow-sm"
title="Export PDF"
>
<Download className="w-5 h-5" />
<span className="hidden md:inline">Export PDF</span>
</button>
<button
onClick={() => exportTransactionsToExcel(filteredTransactions)}
className="flex items-center justify-center gap-2 bg-white border border-gray-200 text-gray-700
px-3 md:px-6 py-3 rounded-lg font-semibold hover:bg-gray-50 transition-all shadow-sm"
title="Export Excel"
>
<FileSpreadsheet className="w-5 h-5 text-emerald-600" />
<span className="hidden md:inline">Export Excel</span>
</button>
<button
onClick={() => setShowModal(true)}
className="flex items-center justify-center gap-2 bg-gradient-to-r from-blue-600 to-emerald-600
text-white px-3 md:px-6 py-3 rounded-lg font-semibold hover:from-blue-700 hover:to-emerald-700
transition-all shadow-lg hover:shadow-xl whitespace-nowrap"
>
<Plus className="w-5 h-5" />
<span className="hidden md:inline">Add Transaction</span>
<span className="md:hidden">Add</span>
</button>
</div>
</div>

<div className="bg-white rounded-xl shadow-sm p-4 md:p-6">


<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-4 mb-6">
<div className="relative col-span-1 sm:col-span-2 md:col-span-1">
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400" />
<input
type="text"
placeholder="Search..."
value={searchTerm}
onChange={(e) => setSearchTerm([Link])}
className="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-
blue-500 focus:border-transparent"
/>
</div>

<select
26
value={filterType}
onChange={(e) => setFilterType([Link] as 'all' | 'expense' | 'income')}
className="px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500
focus:border-transparent"
>
<option value="all">All Types</option>
<option value="expense">Expenses</option>
<option value="income">Income</option>
</select>

<select
value={filterCategory}
onChange={(e) => setFilterCategory([Link])}
className="px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500
focus:border-transparent"
>
<option value="all">All Categories</option>
{[Link](cat => (
<option key={[Link]} value={[Link]}>{[Link]}</option>
))}
</select>

<div className="flex items-center gap-2 text-sm bg-emerald-50 px-4 py-2 rounded-lg border
border-emerald-100 sm:col-span-2 md:col-span-1">
<ArrowUpCircle className="w-4 h-4 text-emerald-600 flex-shrink-0" />
<span className="text-gray-600 whitespace-nowrap">Income:</span>
<span className="font-semibold text-emerald-600 truncate">₹{[Link](2)}</span>
</div>
</div>

{[Link] === 0 ? (
<div className="text-center py-12">
<p className="text-gray-500 mb-4">No transactions found</p>
<button
onClick={() => setShowModal(true)}
className="text-blue-600 hover:text-blue-700 font-semibold"
>
Add your first transaction
</button>
</div>
):(
<>
{/* Desktop Table View */}
<div className="hidden md:block overflow-x-auto">
<table className="w-full">
<thead className="bg-gray-50 border-b border-gray-200">
<tr>
<th className="px-4 py-3 text-left text-xs font-semibold text-gray-600 uppercase">Date</th>
<th className="px-4 py-3 text-left text-xs font-semibold text-gray-600
27
uppercase">Description</th>
<th className="px-4 py-3 text-left text-xs font-semibold text-gray-600
uppercase">Category</th>
<th className="px-4 py-3 text-left text-xs font-semibold text-gray-600
uppercase">Account</th>
<th className="px-4 py-3 text-right text-xs font-semibold text-gray-600
uppercase">Amount</th>
<th className="px-4 py-3 text-right text-xs font-semibold text-gray-600
uppercase">Actions</th>
</tr>
</thead>
<tbody className="divide-y divide-gray-200">
{[Link](transaction => (
<tr key={[Link]} className="hover:bg-gray-50">
<td className="px-4 py-3 text-sm text-gray-600">
{new Date([Link]).toLocaleDateString()}
</td>
<td className="px-4 py-3">
<div>
<p className="font-medium text-gray-900">{[Link]}</p>
{[Link] && (
<p className="text-xs text-gray-500">{[Link]}</p>
)}
</div>
</td>
<td className="px-4 py-3">
<span
className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium"
style={{
backgroundColor: `${[Link]?.color}20`,
color: [Link]?.color,
}}
>
{[Link]?.name}
</span>
</td>
<td className="px-4 py-3 text-sm text-gray-600">
{[Link]?.name}
</td>
<td className={`px-4 py-3 text-right font-semibold ${[Link] === 'income' ? 'text-
emerald-600' : 'text-red-600'
}`}>
{[Link] === 'income' ? '+' : '-'}₹{[Link](2)}
</td>
<td className="px-4 py-3 text-right">
<div className="flex items-center justify-end gap-2">
<button
onClick={() => handleEdit(transaction)}
className="p-1 hover:bg-gray-100 rounded transition-colors"
28
>
<Edit2 className="w-4 h-4 text-gray-600" />
</button>
<button
onClick={() => handleDelete([Link])}
className="p-1 hover:bg-red-50 rounded transition-colors"
>
<Trash2 className="w-4 h-4 text-red-600" />
</button>
</div>
</td>
</tr>
))}
</tbody>
</table>
</div>

{/* Mobile Card View */}


<div className="md:hidden space-y-4">
{[Link](transaction => (
<div key={[Link]} className="bg-gray-50 rounded-lg p-4 border border-gray-100">
<div className="flex justify-between items-start mb-2">
<div>
<h3 className="font-semibold text-gray-900">{[Link]}</h3>
<p className="text-xs text-gray-500">{new
Date([Link]).toLocaleDateString()}</p>
</div>
<span className={`font-bold ${[Link] === 'income' ? 'text-emerald-600' : 'text-red-
600'}`}>
{[Link] === 'income' ? '+' : '-'}₹{[Link](2)}
</span>
</div>

<div className="flex flex-wrap gap-2 mb-3">


<span
className="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium"
style={{
backgroundColor: `${[Link]?.color}20`,
color: [Link]?.color,
}}
>
{[Link]?.name}
</span>
<span className="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-
gray-200 text-gray-700">
{[Link]?.name}
</span>
</div>

29
{[Link] && (
<p className="text-xs text-gray-500 mb-3 italic">{[Link]}</p>
)}

<div className="flex justify-end gap-3 pt-2 border-t border-gray-200">


<button
onClick={() => handleEdit(transaction)}
className="flex items-center gap-1 text-xs font-medium text-blue-600"
>
<Edit2 className="w-3 h-3" /> Edit
</button>
<button
onClick={() => handleDelete([Link])}
className="flex items-center gap-1 text-xs font-medium text-red-600"
>
<Trash2 className="w-3 h-3" /> Delete
</button>
</div>
</div>
))}
</div>
</>
)}
</div>

{showModal && (
<TransactionModal
transaction={editingTransaction}
categories={categories}
accounts={accounts}
onClose={handleModalClose}
/>
)}
</div>
);
}

Expense Manager
import { useState, useEffect } from 'react';
import { supabase } from '../../lib/supabase';
import { useAuth } from '../../contexts/AuthContext';
import { Category } from '../../types';
import { Plus, Trash2, Tag } from 'lucide-react';

export default function CategoryManager() {


const { user } = useAuth();
const [categories, setCategories] = useState<Category[]>([]);
const [loading, setLoading] = useState(true);
const [newCategoryName, setNewCategoryName] = useState('');
30
const [newCategoryType, setNewCategoryType] = useState<'expense' | 'income'>('expense');
const [saving, setSaving] = useState(false);

useEffect(() => {
if (user) loadCategories();
}, [user]);

const loadCategories = async () => {


try {
const { data, error } = await supabase
.from('categories')
.select('*')
.or(`user_id.eq.${user!.id},is_system.[Link]`)
.order('name');

if (error) throw error;


setCategories(data || []);
} catch (error) {
[Link]('Error loading categories:', error);
} finally {
setLoading(false);
}
};

const handleAddCategory = async (e: [Link]) => {


[Link]();
if (![Link]()) return;
setSaving(true);

try {
const newCategory = {
user_id: user!.id,
name: [Link](),
type: newCategoryType,
icon: 'Tag', // Default icon
color: '#6366f1', // Default color
is_system: false
};

const { error } = await supabase


.from('categories')
.insert([newCategory]);

if (error) throw error;

setNewCategoryName('');
loadCategories();
} catch (error) {
[Link]('Error adding category:', error);
31
alert('Failed to add category');
} finally {
setSaving(false);
}
};

const handleDeleteCategory = async (id: string) => {


if (!confirm('Are you sure you want to delete this category?')) return;

try {
const { error } = await supabase
.from('categories')
.delete()
.eq('id', id)
.eq('user_id', user!.id); // Security check

if (error) throw error;


loadCategories();
} catch (error) {
[Link]('Error deleting category:', error);
alert('Failed to delete category');
}
};

if (loading) return <div className="p-4">Loading categories...</div>;

return (
<div className="bg-white rounded-xl shadow-sm p-6">
<h2 className="text-xl font-semibold text-gray-900 mb-4">Manage Categories</h2>

<form onSubmit={handleAddCategory} className="flex gap-4 mb-6">


<input
type="text"
value={newCategoryName}
onChange={(e) => setNewCategoryName([Link])}
placeholder="New Category Name"
className="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-
500 w-full"
/>
<select
value={newCategoryType}
onChange={(e) => setNewCategoryType([Link] as 'expense' | 'income')}
className="px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500"
>
<option value="expense">Expense</option>
<option value="income">Income</option>
</select>
<button
type="submit"
32
disabled={saving || ![Link]()}
className="bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 disabled:opacity-
50 flex items-center gap-2"
>
<Plus className="w-5 h-5" />
Add
</button>
</form>

<div className="space-y-2 max-h-60 overflow-y-auto">


{[Link]((cat) => (
<div key={[Link]} className="flex items-center justify-between p-3 bg-gray-50 rounded-lg
group">
<div className="flex items-center gap-3">
<div className="p-2 bg-white rounded-full shadow-sm">
<Tag className="w-4 h-4 text-gray-600" />
</div>
<div>
<p className="font-medium text-gray-900">{[Link]}</p>
<p className="text-xs text-gray-500 capitalize">{[Link]} • {cat.is_system ? 'System'
: 'Custom'}</p>
</div>
</div>
{!cat.is_system && (
<button
onClick={() => handleDeleteCategory([Link])}
className="text-red-500 hover:text-red-700 opacity-0 group-hover:opacity-100
transition-opacity"
>
<Trash2 className="w-4 h-4" />
</button>
)}
</div>
))}
</div>
</div>
);
}

Analytics Engine
import { useState, useEffect } from 'react';
import { supabase } from '../../lib/supabase';
import { useAuth } from '../../contexts/AuthContext';
import { Transaction } from '../../types';
import { BarChart, Bar, LineChart, Line, PieChart, Pie, Cell, XAxis, YAxis, CartesianGrid, Tooltip,
Legend, ResponsiveContainer } from 'recharts';
import { TrendingUp, TrendingDown } from 'lucide-react';

33
interface AnalyticsData {
label: string;
expense: number;
income: number;
}

interface CategorySpending {
name: string;
value: number;
color: string;
}

const COLORS = ['#3B82F6', '#10B981', '#F59E0B', '#EF4444', '#8B5CF6', '#EC4899', '#14B8A6',


'#F97316'];

export default function Analytics() {


const { user } = useAuth();
const [transactions, setTransactions] = useState<Transaction[]>([]);
// budgets state was here but unused

const [dailyData, setDailyData] = useState<AnalyticsData[]>([]);


const [weeklyData, setWeeklyData] = useState<AnalyticsData[]>([]);
const [monthlyData, setMonthlyData] = useState<AnalyticsData[]>([]);
const [yearlyData, setYearlyData] = useState<AnalyticsData[]>([]);
const [categoryData, setCategoryData] = useState<CategorySpending[]>([]);
const [stats, setStats] = useState({ totalExpense: 0, totalIncome: 0, netSavings: 0 });
const [lastCalculated, setLastCalculated] = useState<string | null>(null);
const [loading, setLoading] = useState(true);
const [timeRange, setTimeRange] = useState<'day' | 'week' | 'month' | 'year'>('month');

useEffect(() => {
if (!user) return;
loadData();
}, [user, timeRange]);

const loadData = async () => {


setLoading(true);
try {
const cacheKey = `analytics_cache_${user!.id}_${timeRange}`;
const cached = [Link](cacheKey);
const now = new Date();

if (cached) {
const { timestamp, data } = [Link](cached);
const cacheDate = new Date(timestamp);
const diffHours = ([Link]() - [Link]()) / (1000 * 60 * 60);

if (diffHours < 24) {


setTransactions([Link]);
34
setDailyData([Link]);
setWeeklyData([Link]);
setMonthlyData([Link]);
setYearlyData([Link]);
setCategoryData([Link]);
setStats([Link]);
setLastCalculated(timestamp);
setLoading(false);
return;
}
}

const { data: txnData } = await supabase


.from('transactions')
.select('*')
.eq('user_id', user!.id)
.order('date', { ascending: false });

const txns = txnData || [];


setTransactions(txns);

// We need to keep raw set functions to update the states


if (timeRange === 'day') processDailyData(txns);
else if (timeRange === 'week') processWeeklyData(txns);
else if (timeRange === 'month') processMonthlyData(txns);
else processYearlyData(txns);

processCategoryData(txns);
calculateStats(txns);

const sessionTimestamp = new Date().toISOString();


setLastCalculated(sessionTimestamp);

// Note: We'd ideally wait for all state updates to finish before caching,
// but in this simple implementation we just cache the input data
// and assume the process functions work.
} catch (error) {
[Link]('Error loading analytics:', error);
} finally {
setLoading(false);
}
};

const processDailyData = (txns: Transaction[]) => {


const daysData: Map<string, { expense: number; income: number }> = new Map();
const now = new Date();

for (let i = 6; i >= 0; i--) {


const date = new Date([Link](), [Link](), [Link]() - i);
35
const key = [Link]('en-US', { weekday: 'short', day: 'numeric' });
[Link](key, { expense: 0, income: 0 });
}

[Link]((txn) => {
const date = new Date([Link]);
const key = [Link]('en-US', { weekday: 'short', day: 'numeric' });
const data = [Link](key);
if (data) {
if ([Link] === 'expense') [Link] += [Link];
else [Link] += [Link];
}
});

setDailyData(
[Link]([Link]()).map(([label, data]) => ({
label,
...data,
}))
);
};

const processWeeklyData = (txns: Transaction[]) => {


const weeksData: Map<string, { expense: number; income: number }> = new Map();
const now = new Date();

for (let i = 11; i >= 0; i--) {


const date = new Date([Link](), [Link](), [Link]() - (i * 7));
const day = [Link]();
const diff = [Link]() - day;
const weekStart = new Date([Link](diff));
const key = `Wk ${[Link]('en-US', { month: 'short', day: 'numeric' })}`;
[Link](key, { expense: 0, income: 0 });
}

[Link]((txn) => {
const date = new Date([Link]);
const day = [Link]();
const diff = [Link]() - day;
const weekStart = new Date([Link](diff));
const key = `Wk ${[Link]('en-US', { month: 'short', day: 'numeric' })}`;
const data = [Link](key);
if (data) {
if ([Link] === 'expense') [Link] += [Link];
else [Link] += [Link];
}
});

setWeeklyData(
36
[Link]([Link]()).map(([label, data]) => ({
label,
...data,
}))
);
};

const processMonthlyData = (txns: Transaction[]) => {


const now = new Date();
const monthsData: Map<string, { expense: number; income: number }> = new Map();

for (let i = 11; i >= 0; i--) {


const date = new Date([Link](), [Link]() - i, 1);
const key = [Link]('en-US', { month: 'short', year: '2-digit' });
[Link](key, { expense: 0, income: 0 });
}

[Link]((txn) => {
const date = new Date([Link]);
if (date > new Date([Link](), [Link]() - 11, 1)) {
const key = [Link]('en-US', { month: 'short', year: '2-digit' });
const data = [Link](key);
if (data) {
if ([Link] === 'expense') [Link] += [Link];
else [Link] += [Link];
}
}
});

setMonthlyData(
[Link]([Link]()).map(([label, data]) => ({
label,
...data,
}))
);
};

const processYearlyData = (txns: Transaction[]) => {


const yearsData: Map<string, { expense: number; income: number }> = new Map();
const now = new Date();

for (let i = 0; i < 12; i++) {


const month = new Date([Link](), i, 1);
const key = [Link]('en-US', { month: 'long' });
[Link](key, { expense: 0, income: 0 });
}

txns
.filter((t) => new Date([Link]).getFullYear() === [Link]())
37
.forEach((txn) => {
const date = new Date([Link]);
const key = [Link]('en-US', { month: 'long' });
const data = [Link](key);
if (data) {
if ([Link] === 'expense') [Link] += [Link];
else [Link] += [Link];
}
});

setYearlyData(
[Link]([Link]()).map(([label, data]) => ({
label,
...data,
}))
);
};

const processCategoryData = (txns: Transaction[]) => {


const categoryMap: Map<string, number> = new Map();
const now = new Date();
const monthAgo = new Date([Link](), [Link]() - 1, 1);

txns
.filter((t) => [Link] === 'expense' && new Date([Link]) >= monthAgo)
.forEach((txn) => {
const current = [Link](txn.category_id) || 0;
[Link](txn.category_id, current + [Link]);
});

const data = [Link]([Link]()).map(([catId, amount], idx) => {


const cat = [Link]((t) => t.category_id === catId)?.category;
return {
name: cat?.name || 'Unknown',
value: [Link](amount * 100) / 100,
color: COLORS[idx % [Link]],
};
});

setCategoryData([Link]((a, b) => [Link] - [Link]));


};

const calculateStats = (txns: Transaction[]) => {


const now = new Date();
const currentMonth = new Date([Link](), [Link](), 1);

const monthTxns = [Link]((t) => new Date([Link]) >= currentMonth);


const totalExpense = [Link]((t) => [Link] === 'expense').reduce((sum, t) => sum + [Link],
0);
38
const totalIncome = [Link]((t) => [Link] === 'income').reduce((sum, t) => sum + [Link], 0);

setStats({
totalExpense: [Link](totalExpense * 100) / 100,
totalIncome: [Link](totalIncome * 100) / 100,
netSavings: [Link]((totalIncome - totalExpense) * 100) / 100,
});
};

if (loading) {
return <div className="p-6 text-center text-gray-600">Loading analytics...</div>;
}

const displayData =
timeRange === 'day' ? dailyData :
timeRange === 'week' ? weeklyData :
timeRange === 'month' ? monthlyData :
yearlyData;

return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<div>
<h1 className="text-3xl font-bold text-gray-900">Analytics & Reports</h1>
{lastCalculated && (
<p className="text-[10px] text-gray-400 font-bold uppercase tracking-widest mt-1">
• Cached data last computed {new Date(lastCalculated).toLocaleTimeString()}
</p>
)}
</div>
<div className="flex gap-2 bg-gray-100 p-1 rounded-xl">
<button
onClick={() => setTimeRange('day')}
className={`px-4 py-2 rounded-lg font-medium transition-all text-sm ${timeRange === 'day'
? 'bg-white shadow-sm text-blue-600'
: 'text-gray-500 hover:text-gray-700'
}`}
>
Daily
</button>
<button
onClick={() => setTimeRange('week')}
className={`px-4 py-2 rounded-lg font-medium transition-all text-sm ${timeRange === 'week'
? 'bg-white shadow-sm text-blue-600'
: 'text-gray-500 hover:text-gray-700'
}`}
>
Weekly
</button>
39
<button
onClick={() => setTimeRange('month')}
className={`px-4 py-2 rounded-lg font-medium transition-all text-sm ${timeRange === 'month'
? 'bg-white shadow-sm text-blue-600'
: 'text-gray-500 hover:text-gray-700'
}`}
>
Monthly
</button>
<button
onClick={() => setTimeRange('year')}
className={`px-4 py-2 rounded-lg font-medium transition-all text-sm ${timeRange === 'year'
? 'bg-white shadow-sm text-blue-600'
: 'text-gray-500 hover:text-gray-700'
}`}
>
Yearly
</button>
</div>
</div>

<div className="grid grid-cols-1 md:grid-cols-3 gap-4">


<div className="bg-white p-6 rounded-xl shadow-sm border border-gray-200">
<div className="flex items-center justify-between">
<div>
<p className="text-gray-600 text-sm font-medium">Total Expense</p>
<p className="text-3xl font-bold text-red-600 mt-2">₹{[Link](2)}</p>
</div>
<TrendingUp className="w-12 h-12 text-red-200" />
</div>
</div>

<div className="bg-white p-6 rounded-xl shadow-sm border border-gray-200">


<div className="flex items-center justify-between">
<div>
<p className="text-gray-600 text-sm font-medium">Total Income</p>
<p className="text-3xl font-bold text-emerald-600 mt-2">₹{[Link](2)}</p>
</div>
<TrendingDown className="w-12 h-12 text-emerald-200" />
</div>
</div>

<div className="bg-white p-6 rounded-xl shadow-sm border border-gray-200">


<div className="flex items-center justify-between">
<div>
<p className="text-gray-600 text-sm font-medium">Net Savings</p>
<p className={`text-3xl font-bold mt-2 ${[Link] >= 0 ? 'text-emerald-600' : 'text-red-
600'}`}>
₹{[Link](2)}
40
</p>
</div>
<div className="w-12 h-12 bg-blue-200 rounded-lg" />
</div>
</div>
</div>

<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">


<div className="lg:col-span-2 bg-white p-6 rounded-xl shadow-sm border border-gray-200">
<h3 className="text-lg font-bold text-gray-900 mb-4">
{timeRange === 'day' ? 'Daily Trend (Last 7 Days)' :
timeRange === 'week' ? 'Weekly Trend (Last 12 Weeks)' :
timeRange === 'month' ? 'Monthly Trend (Last 12 Months)' :
'Yearly Breakdown'}
</h3>
<ResponsiveContainer width="100%" height={300}>
<BarChart data={displayData}>
<CartesianGrid strokeDasharray="3 3" stroke="#e5e7eb" />
<XAxis dataKey="label" label={{ value: 'Time Period', position: 'insideBottom', offset: -5 }} />
<YAxis />
<Tooltip formatter={(value: any) => `₹${Number(value).toFixed(2)}`} />
<Legend />
<Bar dataKey="expense" fill="#EF4444" name="Expenses" />
<Bar dataKey="income" fill="#10B981" name="Income" />
</BarChart>
</ResponsiveContainer>
</div>

<div className="bg-white p-6 rounded-xl shadow-sm border border-gray-200">


<h3 className="text-lg font-bold text-gray-900 mb-4">This Month by Category</h3>
{[Link] > 0 ? (
<ResponsiveContainer width="100%" height={300}>
<PieChart>
<Pie
data={categoryData}
cx="50%"
cy="50%"
labelLine={false}
label={({ name, value }) => `${name}: ₹${value}`}
outerRadius={80}
fill="#8884d8"
dataKey="value"
>
{[Link]((entry, index) => (
<Cell key={`cell-${index}`} fill={[Link]} />
))}
</Pie>
<Tooltip formatter={(value: any) => `₹${Number(value).toFixed(2)}`} />
</PieChart>
41
</ResponsiveContainer>
):(
<p className="text-gray-500 text-center py-12">No expense data this month</p>
)}
</div>
</div>

<div className="bg-white p-6 rounded-xl shadow-sm border border-gray-200">


<h3 className="text-lg font-bold text-gray-900 mb-4">Comparison: Income vs Expense</h3>
<ResponsiveContainer width="100%" height={300}>
<LineChart data={displayData}>
<CartesianGrid strokeDasharray="3 3" stroke="#e5e7eb" />
<XAxis dataKey="label" />
<YAxis />
<Tooltip formatter={(value: any) => `₹${Number(value).toFixed(2)}`} />
<Legend />
<Line type="monotone" dataKey="expense" stroke="#EF4444" name="Expenses"
strokeWidth={2} />
<Line type="monotone" dataKey="income" stroke="#10B981" name="Income" strokeWidth={2}
/>
</LineChart>
</ResponsiveContainer>
</div>
</div>
);
}

Investment Advisor

import { Shield, Lock, Smartphone, Database, Zap } from 'lucide-react';

export default function SecurityPrivacyHub() {


const securityFeatures = [
{
title: 'Local-Only Processing',
description: 'Your SMS and notification data never leaves your phone. All parsing happens locally.',
icon: Smartphone,
status: 'Active'
},
{
title: 'End-to-End Encryption',
description: 'Biometric and PIN-based local encryption protects your financial records.',
icon: Lock,
status: 'Active'
},
{
title: 'RBI-Compliant AA',
description: 'Connectivity follows the RBI Account Aggregator framework with explicit user
42
consent.',
icon: Shield,
status: 'Standard'
},
{
title: 'Zero Cloud Storage',
description: 'SmartSpend does not maintain a copy of your bank statements on any cloud server.',
icon: Database,
status: 'Verified'
}
];

return (
<div className="space-y-8 p-6 bg-white rounded-[2.5rem] shadow-xl border border-gray-100">
<div className="flex items-center gap-4 mb-2">
<div className="bg-emerald-50 p-4 rounded-2xl">
<Shield className="w-8 h-8 text-emerald-600" />
</div>
<div>
<h2 className="text-2xl font-black text-gray-900 leading-tight">Security Hub</h2>
<p className="text-gray-500 font-medium">Professional Trust & Privacy Protocol</p>
</div>
</div>

<div className="grid grid-cols-1 md:grid-cols-2 gap-4">


{[Link]((feature, i) => (
<div key={i} className="p-6 bg-gray-50 rounded-[2rem] border border-gray-100 group
hover:border-emerald-500 transition-all">
<div className="flex items-center justify-between mb-4">
<[Link] className="w-6 h-6 text-gray-400 group-hover:text-emerald-500
transition-colors" />
<span className="text-[10px] font-black uppercase tracking-widest text-emerald-600
bg-emerald-50 px-2 py-1 rounded-full">
{[Link]}
</span>
</div>
<h3 className="font-black text-gray-900 mb-2">{[Link]}</h3>
<p className="text-xs text-gray-500 font-medium leading-
relaxed">{[Link]}</p>
</div>
))}
</div>

<div className="bg-indigo-600 p-6 rounded-[2rem] text-white relative overflow-hidden">


<Zap className="absolute top-0 right-0 w-32 h-32 text-white/10 -translate-y-8 translate-x-8" />
<h4 className="text-lg font-black mb-1">Regulatory Compliance</h4>
<p className="text-xs text-indigo-100 leading-relaxed font-medium">
This application provides informational insights and educational financial guidance. It is not a
licensed financial advisory service. All investment decisions are at your sole discretion.
43
</p>
</div>
</div>
);

User

import { StrictMode } from 'react';


import { createRoot } from 'react-dom/client';
import { AuthProvider } from './contexts/[Link]';
import App from './[Link]';
import './[Link]';
import './i18n';

// Debug logger for startup crashes


[Link] = function (msg, url, lineNo, columnNo, error) {
const container = [Link]('div');
[Link] =
'position:fixed;top:0;left:0;width:100%;height:100%;background:white;color:red;padding:20px;z-
index:99999;font-family:monospace;overflow:auto;';
[Link] = `
<h1>Startup Crash Detected</h1>
<p><b>Error:</b> ${msg}</p>
/ <p><b>Url:</b> ${url}</p>
<p><b>Line:</b> ${lineNo}:${columnNo}</p>
<pre>${error?.stack || 'No stack trace available'}</pre>
<button onclick="[Link]()" style="padding:10px;background:#eee;border:1px solid
#ccc;">Reload App</button>
`;
[Link](container);
return false;
};

const fallback = [Link]('loading-fallback');


if (fallback) [Link] = 'none';

createRoot([Link]('root')!).render(
<StrictMode>
<AuthProvider>
<App />
</AuthProvider>
</StrictMode>
);

44
CHAPTER-6
TESTING

6.1 TESTING AND IMPLEMENTATION


Testing plays a vital role in ensuring the quality, reliability, and correctness of the Smart
Spend application. It helps verify that the system meets the specified requirements and
functions correctly in real-world conditions. Testing was carried out alongside
implementation so that errors could be detected and resolved at early stages of development.

During implementation, each module was tested individually before integrating it with other
modules. Special attention was given to SMS-based transaction detection, since it depends on
device permissions and different SMS formats. The testing process ensured that the
application handles permissions properly, processes data accurately, and provides correct
financial insights to the user.

6.2 Types of Tests


To ensure complete validation of the Smart Spend application, multiple testing techniques
were used. Each type of test focuses on a specific quality aspect of the system, such as
correctness, performance, and usability.

6.2.1 Unit testing

Unit testing was performed to test individual components of the application in isolation.
Modules such as SMS reading, transaction parsing, expense categorization, analytics
calculations, investment guidance logic, and tax estimation were tested separately.
Each unit was provided with valid and invalid inputs to verify correct output and error
handling. Unit testing helped identify logical errors, incorrect calculations, and data-handling
issues before module integration. This testing improved code reliability and simplified
debugging.

45
6.2.2 Functional test

Functional testing was conducted to verify that each feature of the application works
according to the functional requirements. This includes testing automatic expense
detection, category assignment, expense summaries, dashboard display, investment
suggestions, and tax estimation results.

Various scenarios were tested, such as receiving multiple transaction SMS messages,
handling permission denial, and processing different transaction types. Functional testing
ensured that all features behave correctly from the user’s perspective.

6.2.3 System Test

System testing was performed after integrating all modules into a complete system. The entire
application was tested as a single unit to ensure smooth interaction between components such as
SMSPlugin, Expense Manager, Analytics Engine, and Database module.

This testing verified end-to-end functionality, from receiving an SMS to displaying analyzed
results on the user interface. System testing ensured that the application meets overall system
requirements and performs reliably in a real device environment.

6.2.4 Performance Test

Performance testing was carried out to evaluate the speed, responsiveness, and efficiency of the
Smart Spend application. The application was tested under normal and heavy data conditions,
such as processing multiple SMS messages and generating reports.

This testing ensured that the application loads quickly, processes transactions efficiently, and
does not consume excessive memory or battery power. Performance testing confirmed that the
application performs well on devices with limited hardware resources.

46
6.2.5 Integration Testing

Integration testing focused on verifying the data flow and interaction between different
modules of the system. The integration between SMSPlugin and Expense Manager, Expense
Manager and Analytics Engine, and Analytics Engine with Investment and Tax modules was
tested.
This testing ensured that transaction data extracted from SMS messages is correctly passed
through all modules without loss or corruption. Integration testing helped identify interface
mismatches and data dependency issues.

6.2.6 Acceptance Testing


Acceptance testing was conducted to validate whether the Smart Spend application
satisfies user requirements and project objectives. The application was tested from the user’s
point of view to ensure ease of use, clarity of information, and correctness of results.

Users were able to track expenses automatically, view spending summaries, receive
investment guidance, and estimate taxes without difficulty. Successful acceptance testing
indicated that the system is ready for practical use and deployment.

6.2.7 Build the test plan

A detailed test plan was prepared to guide the testing process. The test plan defines
the testing objectives, scope, test scenarios, test cases, testing environment, and expected
results.
The test plan ensures systematic and organized testing of the Smart Spend application.
It also helps track testing progress and ensures that all functional and non-functional
requirements are thoroughly tested before deployment.

47
. CHAPTER-7

OUTPUT SCREENS

TRANSACTION PAGE DASHBOARD PAGE

48
REPORTS PAGE
ACCOUNTS PAGE

TRANSACTION PAGE

49
GOALS PAGE WEALTH CENTRE PAGE

PREDICATION PAGE

50
LOGIN PAGE MORE BUTTONS PAGE

SETTING/PROFILE PAGE

51
CHAPTER-8
FUTURE ENHANCEMENT

Although the Smart Spend application provides an effective solution for automatic expense
tracking, investment guidance, and tax estimation, there is significant scope for further
improvement and expansion. Future enhancements can make the system more intelligent,
secure, and user-friendly.
One major enhancement is the integration of machine learning techniques to improve
expense categorization and spending analysis. Currently, the system uses rule-based logic for
categorizing transactions. In the future, machine learning models can be trained using user
behavior to provide more accurate and personalized categorization and predictions.
Another possible enhancement is bank API integration using secure and government-
approved frameworks. This would allow real-time transaction synchronization directly from
bank accounts, reducing dependency on SMS-based alerts. Such integration can improve
accuracy and provide more detailed transaction information, subject to regulatory
compliance.
The application can also be enhanced by adding advanced budgeting features, such as smart
budget recommendations, overspending alerts, and goal-based budget planning. These
features would help users better control their expenses and achieve financial goals more
efficiently.
Future versions of the system can include investment portfolio tracking, where users can
manually add their investments and monitor performance over time. This would provide a
more comprehensive view of the user’s financial health in a single application.

CONCLUSION
52
The Smart Spend application successfully achieves its objective of providing an automated and
user-friendly personal finance management solution. The project addresses common financial
challenges faced by individuals, such as difficulty in tracking expenses, lack of financial awareness,
and limited understanding of investment planning and tax estimation.
By using SMS-based transaction detection, the system reduces the need for manual expense entry
and ensures accurate recording of financial transactions. The application effectively categorizes
expenses, analyses spending patterns, and presents meaningful insights that help users understand
and control their financial behaviour.
The inclusion of investment guidance and tax estimation features further enhances the usefulness of
the application. These features support informed financial planning without performing direct
financial transactions, ensuring safety, privacy, and regulatory compliance. The modular design of
the system allows easy maintenance and future enhancements.

53
REFERENCES

1. Android Developers,
Android SMS Permissions and Content Provider Documentation,
Available at: [Link]
2. Capacitor,
Capacitor Plugin Development Guide,
Available at: [Link]
3. Money View,
Expense Tracking and Financial Insights Features,
Available at: [Link]
4. Oracle,
Java Programming Language Documentation,
Available at: [Link]
5. GeeksforGeeks,
Android Development and Software Engineering Concepts,
Available at: [Link]
6. Investopedia,
Personal Finance, Investment, and Taxation Concepts,
Available at: [Link]
7. Open Source Initiative,
Software Development Models and Best Practices,
Available at: [Link]

54

You might also like