Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
291 changes: 291 additions & 0 deletions FinanceApp/.qtcreator/CMakeLists.txt.user

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions FinanceApp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.19)

project(FinanceApp LANGUAGES CXX)


find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets Charts)
find_package(Qt6 6.5 REQUIRED COMPONENTS Core Widgets Charts Sql)

qt_standard_project_setup()

qt_add_executable(FinanceApp
WIN32 MACOSX_BUNDLE
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
transactionwindow.h transactionwindow.cpp transactionwindow.ui
database.cpp
database.h
add_containers.h add_containers.cpp add_containers.ui


)

target_link_libraries(FinanceApp
PRIVATE
Qt6::Core
Qt6::Widgets
Qt6::Charts
Qt6::Sql
)

include(GNUInstallDirs)

install(TARGETS FinanceApp
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
6 changes: 6 additions & 0 deletions FinanceApp/Dashboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Run the update_translations CMake target to populate the source strings in this file.
-->
<!DOCTYPE TS>
<TS version="2.1" sourcelanguage="en"/>
Binary file added FinanceApp/Dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions FinanceApp/FIles/FinanceApp/FinanceApp_en_US.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Run the update_translations CMake target to populate the source strings in this file.
-->
<!DOCTYPE TS>
<TS version="2.1" language="en_US" sourcelanguage="en"/>
Binary file added FinanceApp/FIles/FinanceApp/pixabot-f005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions FinanceApp/Finance
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Run the update_translations CMake target to populate the source strings in this file.
-->
<!DOCTYPE TS>
<TS version="2.1" sourcelanguage="en"/>
3 changes: 3 additions & 0 deletions FinanceApp/FinanceApp_en_US.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US"></TS>
Binary file added FinanceApp/FinanceMan.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FinanceApp/QT_Design.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FinanceApp/QT_Environmentpng.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 96 additions & 0 deletions FinanceApp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# FinanceApp

A lightweight personal finance dashboard built with **C++**, **Qt 6**, **Qt Charts**, and **SQLite**. The application provides a graphical dashboard for displaying financial information and organizing transactions by category and tag.

## Description

FinanceApp is a desktop personal finance dashboard created as a contribution for issue #93 of the `All-In-One-Python-Projects` repository.

The project uses Qt Widgets for the graphical user interface and Qt Charts for financial visualization. SQLite is used through Qt's SQL module to provide local database storage.

The application includes:

- A graphical finance dashboard
- Transaction information displayed in a table
- Category and tag information for transactions
- A spending/money-allocation pie chart
- Transaction and deposit interface windows
- Local SQLite database support
- Database functions for recording transactions, managing category balances, and calculating financial totals

The dashboard was designed to provide a lightweight alternative to larger personal finance applications while keeping the interface simple and easy to understand.

## Prerequisites

The following software is required to build and run FinanceApp:

- C++ compiler
- Qt 6.5 or later
- Qt Widgets
- Qt Charts
- Qt SQL
- SQLite
- CMake 3.19 or later
- Qt Creator (recommended)

## Installing Instructions

1. Clone the repository:

```bash
git clone https://github.com/king04aman/All-In-One-Python-Projects.git
```

2. Open the `FinanceApp` directory in Qt Creator.

3. Configure the project with a Qt 6 kit and CMake.

4. Build the project.

5. Run `FinanceApp`.

The application uses an SQLite database named `finance.db` for local financial data.

## Database Structure and Behavior

The database layer is implemented in [`database.h`](./database.h) and [`database.cpp`](./database.cpp) using Qt's SQL module with the SQLite driver. When the `Database` object is created, it opens `finance.db` in the application's current working directory and creates the database tables.

The database contains two tables:

| Table | Columns | Purpose |
|---|---|---|
| `containers` | `id` (auto-incrementing primary key), `category`, `tag`, `amount` | Stores the user's category balances. A category is the named container, while the tag classifies it as `Spending`, `Giving`, or `Saving`. |
| `transactions` | `id` (auto-incrementing primary key), `category`, `tag`, `amount` | Keeps a record of transaction entries, including their category, tag, and amount. |

The `Database` class provides the following operations:

- `create_Container_Table()` and `create_Transaction_Table()` define the tables when the database is initialized.
- `addContainer(category, tag, amount)` adds a starting balance or allocation to `containers`.
- `addTransaction(category, tag, amount)` records a transaction in `transactions` and subtracts its amount from the matching container (the same category and tag).
- `deleteContainer()` removes all rows from `containers`. It does not delete the transaction history.
- `getTotal()` returns the sum of the current amounts in all containers.
- `totalSpending()`, `totalGiving()`, and `totalSaving()` return the sum of container amounts for the corresponding tag.
- `getDatabase()` exposes the Qt database connection so other parts of the application can run queries.

The add-container and transaction windows validate their input before calling the database methods. After a successful save, the main window reads the container rows again to refresh the category table and updates the balance and pie chart using the total functions. Transaction records are stored separately from container balances; the displayed totals are calculated from the current `containers` amounts.

## Technologies Used

- **C++** — application logic
- **Qt Widgets** — graphical user interface
- **Qt Charts** — financial data visualization
- **Qt SQL** — database interface
- **SQLite** — local data storage
- **CMake** — project configuration and build system

## Screenshot

"...\All-In-One-Python-Projects\FinanceApp\QT_Design.png"
"...\All-In-One-Python-Projects\FinanceApp\QT_Environmentpng.png"
"...\All-In-One-Python-Projects\FinanceApp\Dashboard.png"



## Author

Joshua Wilson
6 changes: 6 additions & 0 deletions FinanceApp/Tracker/Finance
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Run the update_translations CMake target to populate the source strings in this file.
-->
<!DOCTYPE TS>
<TS version="2.1" sourcelanguage="en"/>
Binary file added FinanceApp/TransactionDashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions FinanceApp/add_containers.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#include "add_containers.h"
#include "ui_add_containers.h"
#include <qmovie.h>

add_containers::add_containers(MainWindow *mainwindow, Database& database, QWidget *parent)
: QDialog(parent)
, ui(new Ui::add_containers), db(database), mainwindow(mainwindow)

{
ui->setupUi(this);
connect(ui->saveButton, &QPushButton::clicked, this, &add_containers::savebutton);
connect(ui->cancelButton, &QPushButton::clicked, this, &add_containers::cancelbutton);
QMovie *movie = new QMovie("C:/Users/wilso/CLionProjects/Personal Finance Tracker/All-In-One-Python-Projects/FinanceApp/FinanceMan.gif");

ui->tgiflabel->setMovie(movie);
movie->setScaledSize(QSize(371, 71));
ui->tgiflabel->setAlignment(Qt::AlignCenter);
ui->tgiflabel->setMovie(movie);
movie->start();


}

add_containers::~add_containers()
{
delete ui;
}

void add_containers::cancelbutton(){
this->close();
}

void add_containers::savebutton(){
//backend saving
QString new_cat = ui->category_textedit->toPlainText();
QString new_tag = ui->tag_textedit->toPlainText();
QString amt_text = ui->amount_textedit->toPlainText();

bool valid;
double amount = amt_text.toDouble(&valid);

// Validation
if (new_cat.isEmpty()) {
qDebug() << "Error: Group name is required.";
return;
}

if (!valid || amount <= 0) {
qDebug() << "Error: Enter a valid amount greater than 0.";
return;
}

if (new_tag != "Spending" &&
new_tag != "Giving" &&
new_tag != "Saving") {

qDebug() << "Error: Enter a valid tag";
return;
}

//Database Updating
db.addContainer(new_cat,new_tag,amount);
mainwindow->updateContainers();
mainwindow->updateLabels();
mainwindow->updatePieChart();


this->close();

}
28 changes: 28 additions & 0 deletions FinanceApp/add_containers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef ADD_CONTAINERS_H
#define ADD_CONTAINERS_H

#include <QDialog>
#include "database.h"
#include "mainwindow.h"

namespace Ui {
class add_containers;
}

class add_containers : public QDialog
{
Q_OBJECT

public:
explicit add_containers(MainWindow *mainwindow, Database& database, QWidget *parent = nullptr);
~add_containers();

private:
Ui::add_containers *ui;
void cancelbutton();
void savebutton();
Database& db;
MainWindow *mainwindow;
};

#endif // ADD_CONTAINERS_H
Loading
Loading