# Pocket Change Showdown: The Penny-Pincher's Paradise

> Fuck yeah! It's time to tackle your moving expenses with a dash of style and a whole lot of sass! πŸ’°

<div align="center">

Hey look, there's more Flair than a corporate drone with a Monday morning hangover!

![Flask](https://img.shields.io/badge/Flask-2.3.3-000000?style=for-the-badge&logo=flask)
![Docker](https://img.shields.io/badge/Docker-Ready-bluecrabby?style=for-the-badge&logo=docker)
![Kubernetes](https://img.shields.io/badge/Kubernetes-Ready-bluekitty?style=for-the-badge&logo=kubernetes&logoColor=white)
![License](https://img.shields.io/badge/License-MIT?style=for-the-badge&logo=MIT&label=MIT)

<img src="https://teb.codes/2-Code/Flask/Pocket-Change-Showdown/logo.png" alt="logo" width="150"/>    

Think you're bad at managing expenses? Ah, quit your whining. We've got everything: [sassy Features](#features) β€’ super-speed [Quick Start](#quick-start) β€’ hassle-free [Installation](#installation) β€’ wordy [Documentation](#documentation) β€’ places to rant... I mean, [Contributing](#contributing)!
</div>

---

## πŸ“‹ Table of Contents
- [What Features?](#features)
- [Screenshots – Because Who Reads?](#screenshots)
- [Quick Start – No, Really, It’s Quick](#quick-start)
- [Slog through Installation](#installation)
  - [Docker - Walk the Weird Whale](#docker)
  - [Kubernetes - Because You're Fancy](#kubernetes)
  - [Local Mayhem - Developer Stuff](#local-development)
- [Mess About with Configuration](#configuration)
- [Usage - What’s the Point?](#usage)
- [Guff About API Documentation](#api-documentation)
- [What Matters in Development?](#development)
- [License - Free Stuff's Always Good](#license)

## ✨ Features
### Core Functionality
- πŸ“Έ **Receipt Management** - Store craploads of receipts. We dare you.
- πŸ’³ **Multiple Payment Methods** - We track whether you spent cash, credit, IOUs, or favors.
- 🏷️ **Smart Categorization** - Keep your spending habits smart and snarky.
- πŸ“Š **Analytics Dashboard** - Like looking at a magic crystal ball of shame.
- 🎨 **8 Color Themes** - Because your expenses can't be as drab as your personality.
- πŸ“± **Mobile Responsive** - Track on the go, from your phone or hell, a potato.
- πŸ”’ **No Login Required** - No strings attached, like that one-night stand.

### Data Management
- πŸ“₯ **CSV Import** - Bring the madness of an Excel sheet to a whole new level.
- πŸ“€ **CSV Export** - Send your data on a field trip!
- πŸ“„ **Template Download** - Look, Ma! I’m organized.
- πŸ’Ύ **Persistent Storage** - Data that laughs in the face of restarts.

### PCS-Specific Categories
- 🚚 Moving
- ✈️ Travel  
- 🏠 Housing
- πŸ“¦ Storage
- πŸš— Transportation
- 🏨 Lodging
- πŸ” Food
- πŸ“¦ Supplies
- πŸ›ŽοΈ Services
- βž• Make up your own crap!

## πŸ“Έ Screenshots

<details>
  <summary><i>Click to show screenshots</i></summary>
# Dashboard
Interactive analytics with spending trends and category breakdowns.


# Expense Entry
Simple form with receipt upload and auto-complete fields.
![](./Expense.png)

# Homepage
A general overview of expenses
![](./Home.png)

# Import/Export
Efficient data importing and exporting with template
![](./Im-Export.png)

# PDF Export
Printer friendly PDF with customizable content
![](./PDF.png)

# Settings
Manage categories, payment methods, and themes.
![](./Settings.png)

</details>

### Sample PDF
Don’t just stand there, gawk! [pdf_sample.pdf](./pdf_sample.pdf)

## πŸš€ Quick Start
### Docker (Recommended)
```bash
# Unleash the Kraken with the latest image
docker run -d \
  --name pcs-tracker \
  -p 5001:5001 \
  -v pcs-data:/app/data \
  -v pcs-uploads:/app/uploads \
  tebwritescode/pocket-change-showdown:latest
# Chuckle maniacally at http://localhost:5001
```

### Docker Compose
```bash
# Phone-up Chuck Norris: "We're cloning a repo"
git clone https://github.com/tebwritescode/pocket-change-showdown.git
cd pocket-change-showdown
# Compose your mess with Docker Compose
docker-compose up -d
# Dance your way to http://localhost:5001
```

## πŸ“¦ Installation
### Docker
#### Recognizing All Sorts
Because compatibility is key, unless it isn't!
```bash
# Pull for your peculiar machine
docker pull --platform linux/arm64 tebwritescode/pocket-change-showdown:latest
# Or let Docker rub its chin and decide
docker pull tebwritescode/pocket-change-showdown:latest
```

#### Docker Run Degeneracy
```bash
# Deploy it, Captain
docker run -d \
  --name pcs-tracker \
  -p 5001:5001 \
  tebwritescode/pocket-change-showdown:latest
# Make it last longer than a baking lesson
docker run -d \
  --name pcs-tracker \
  -p 5001:5001 \
  -v $(pwd)/data:/app/data \
  -v $(pwd)/uploads:/app/uploads \
  tebwritescode/pocket-change-showdown:latest
# Secret sauce for the discerning chef
docker run -d \
  --name pcs-tracker \
  -p 5001:5001 \
  -e SECRET_KEY="your-secret-key-here" \
  -e FLASK_ENV="production" \
  -v pcs-data:/app/data \
  -v pcs-uploads:/app/uploads \
  tebwritescode/pocket-change-showdown:latest
```

### Kubernetes
```bash
# Manifest your destiny, or just the code
kubectl apply -f k8s/
# Or one by bloody one
kubectl apply -f k8s/namespace.yaml
kubectl apply -f k8s/secret.yaml
kubectl apply -f k8s/pvc.yaml
kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml
kubectl apply -f k8s/ingress.yaml  # Optional, like an appendix

# Check if your stuff's intact
kubectl get all -n pcs-tracker
# If it worked, buy yourself a drink at http://<node-ip>:30001
```

#### Kubernetes Thingamabobs
- **Persistent Volumes** - Turns out you don’t need to webscrape for data–it sticks around.
- **Health Checks** - It only mostly dies.
- **Resource Limits** - So demanding!
- **Multi-Service** - Load balance like a tightrope walker.
- **Ingress Ready** - Fancy domain? Me too.

### Local Development
```bash
# Kiss the clouds goodbye
git clone https://github.com/tebwritescode/pocket-change-showdown.git
cd pocket-change-showdown
# Create a virtual haven
python3 -m venv venv
source venv/bin/activate  
# Unload a bag of dependencies
pip install -r requirements.txt
# Go-Go-Gadget application
python app.py
# Channel your inner regulator at http://localhost:5001
```

## βš™οΈ Configuration
### Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `SECRET_KEY` | SMERSH-level deception sessions key | `pcs-secret-key-2024` |
| `FLASK_ENV` | Sneaky environment mood | `production` |
| `DATABASE_URL` | Alchemize this: your database | `sqlite:///data/pcs_tracker.db` |
| `MAX_CONTENT_LENGTH` | Maximum cr-p (content) upload size | `16777216` (16MB) |

### Data Persistence
To make data hang around like a bad smell:
- `/app/data` - SQLite domicile
- `/app/uploads` - Receipts chill as BLOBs

## πŸ“± Usage
### Tossin' Pennies - Adding Expenses
1. Sing "Add Expense!" from any rooftop or just click it
2. Wake up from title-only dream
3. Attach facepalming receipts (optional)
4. Ceremoniously hit "Save"

### Inflicting Data - Importing
1. Explore **Import/Export** β†’ **Import CSV**
2. Don shiny template armor
3. Be daVinci, fill your masterpiece
4. Blast off with CSV sere-naah-de
 
### Cheese-Cutting Format
```csv
Date,Title,Description,Category,Cost,Payment Method,Location,Vendor,Notes,Tags
2024-01-15,Moving Truck,U-Haul rental,Moving,299.99,Credit Card,Downtown,U-Haul,26ft truck,moving
2024-01-16,Hotel Stay,Overnight stay,Lodging,125.00,Company Card,Holiday Inn,Holiday Inn,1 night,travel
```

### Manipulating Categories & Payment Methods
1. Go where no wo/man has deemed necessary: **Settings**
2. Cust-omize your little heart out
3. Create methods even mad scientists couldn’t
4. Marry whimsy: color themes purr with indulgence 

### Accidental Analytics Dashboard
- Scorn last week, guilt-trip for next: from nanosecond to year
- See-spend scenario via doughnut dive
- Payment method squabbles (Bar chart showdown)
- Dailies take you on the trend train (Line chart)
- Top dog categories, percentages & flaunting aplenty

## πŸ”Œ API Guff
### Endpoints
| Method | Endpoint | Quirky Description |
|--------|----------|--------------------|
| GET | `/` | Home sweet home(wrecker) |
| GET | `/expenses` | Expense expedition |
| GET/POST | `/expense/new` | New expense enlightenment |
| GET/POST | `/expense/<id>/edit` | Edit the unavoidable |
| POST | `/expense/<id>/delete` | PURGE! |
| GET | `/expense/<id>/receipt` | Picture-perception |
| GET | `/dashboard` | Analytical nincompoopery |
| GET | `/api/expense_data` | JSON chateria |
| GET/POST | `/settings` | Mischief management |
| POST | `/settings/category/add` | Go rogue - add category |
| POST | `/settings/payment/add` | Payment etiquette upgrade |
| GET | `/export` | CSV in Wonderland |
| GET/POST | `/import` | CSV Carousel |
| GET | `/template` | CSV preface nobility |

### API Response Satire
```json
GET /api/expense_data?period=month
{
  "categories": {
    "labels": ["Moving", "Travel", "Housing"],
    "data": [1250.50, 890.25, 2100.00]
  },
  "payment_methods": {
    "labels": ["Credit Card", "Cash", "Company Card"],
    "data": [3500.75, 450.00, 290.00]
  },
  "daily_trend": {
    "labels": ["2024-01-01", "2024-01-02"],
    "data": [125.50, 340.25]
  }
}
```

## πŸ› οΈ Development - Why Bother?
### Tech Stack
- **Backend**: Flask, spicy SQLAlchemy
- **Frontend**: Bootstrap, Chart.js, Font Awesome (a peacock)
- **Database**: SQLite: SQLAlchemy Sings
- **File Storage**: Database belly storage
- **Deployment**: Orchestrations with Docker, Kubernetes & Gunicorn bravado

### Structure of Madness
```
pocket-change-showdown/
β”œβ”€β”€ app.py                 # App-worthy babel
β”œβ”€β”€ requirements.txt       # Dependency lug
β”œβ”€β”€ Dockerfile            # Docker concoction
β”œβ”€β”€ docker-compose.yml    # Docker squad
β”œβ”€β”€ templates/            # HTML insidiousness
β”‚   β”œβ”€β”€ base.html        # The totally base
β”‚   β”œβ”€β”€ index.html       # Page of presents
β”‚   β”œβ”€β”€ expenses.html    # Expense paradox
β”‚   β”œβ”€β”€ expense_form.html # Input vs Reality
β”‚   β”œβ”€β”€ dashboard.html   # Chase your shame
β”‚   β”œβ”€β”€ settings.html    # Hangover fixes
β”‚   └── import.html      # CSV courtship
β”œβ”€β”€ k8s/                  # Kubernetes enigma
β”‚   β”œβ”€β”€ namespace.yaml
β”‚   β”œβ”€β”€ secret.yaml
β”‚   β”œβ”€β”€ pvc.yaml
β”‚   β”œβ”€β”€ deployment.yaml
β”‚   β”œβ”€β”€ service.yaml
β”‚   └── ingress.yaml
└── data/                 # Runtime ingenuity
```

### Born from Code
```bash
# Glayvin! Build me this Docker monstrosity
docker build -t pcs-tracker .
# Partake in fetching multi-arch wonders
docker buildx build \
  --platform linux/amd64,linux/arm64,linux/arm/v7 \
  -t tebwritescode/pocket-change-showdown:latest \
  --push .
```

### The Flat Schema (Non-Skiable)
```sql
-- Ground Zero table for expense
CREATE TABLE expense (
    id INTEGER,
    title VARCHAR(200),
    description TEXT,
    category_id INTEGER,
    cost FLOAT,
    payment_method_id INTEGER,
    date DATE,
    receipt_image BLOB,
    receipt_filename VARCHAR(200),
    location VARCHAR(200),
    vendor VARCHAR(200),
    notes TEXT,
    tags VARCHAR(500),
    created_at DATETIME,
    updated_at DATETIME,
    PRIMARY KEY (id)
);
-- Column of categorization
CREATE TABLE category (
    id INTEGER,
    name VARCHAR(100),
    color VARCHAR(7),
    icon VARCHAR(50),
    is_default BOOLEAN,
    PRIMARY KEY (id)
);
-- Noteworthy payment table
CREATE TABLE payment_method (
    id INTEGER,
    name VARCHAR(100),
    icon VARCHAR(50),
    is_default BOOLEAN,
    PRIMARY KEY (id)
);
-- Settings booth
CREATE TABLE settings (
    id INTEGER,
    color_scheme VARCHAR(50),
    default_view VARCHAR(20),
    PRIMARY KEY (id)
);
```

## πŸ“„ License - Go Forth and Conquer!
This project is merrily open source and blissfully up for grabs under the [MIT License](LICENSE).

## πŸ™ Cheers & Acknowledgments
- Built under the spell of Flask and Bootstrap
- Charts magicked by Chart.js
- Icons with Font Awesome - Awe as your own

## πŸ“ž Screech for Help
For tirades, discontent, or amusing suggestions:
- Holler on [GitHub Issues](https://github.com/tebwritescode/pocket-change-showdown/issues)
- Vent thoroughly in GitHub Discussions

---

<div align="center">

**P**ocket **C**hange **S**howdown - Because tracking every penny is nothing short of glorious insanity!

</div>
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9