# BudgetPro

A Qt-based financial management and budgeting application with a ribbon-style interface.

## Overview

BudgetPro is a desktop application designed for managing company finances, budgets, products, and invoices. It features a modern ribbon interface similar to Microsoft Office applications, built using Qt Widgets and the SARibbon library.

## Key Features

- **Company Management**: Create and manage multiple companies/enterprises
- **Product Catalog**: Maintain a database of products/services with pricing
- **Third-Party Management**: Track suppliers and customers
- **Budget Planning**: Create hierarchical budgets with detailed breakdowns
- **Invoice Tracking**: Manage incoming and outgoing invoices
- **Data Visualization**: Tree views for hierarchical financial data
- **Custom Editors**: Specialized delegates for different data types (combobox, rich text, etc.)
- **Template Editor**: Visual template designer for document export
- **Document Export**: Export documents as PDF, XLSX, and DOCX with configurable templates

## Technical Stack

- **Framework**: Qt 6 (Widgets module)
- **UI Library**: SARibbon for ribbon-style interface
- **Database**: SQL backend (via custom sqltable.h)
- **Build System**: QMake (.pro file)
- **Language**: C++11

## Project Structure

```
BudgetPro/
├── main.cpp                 # Application entry point
├── mainwindow.h/cpp         # Main window with ribbon interface
├── gui/                     # GUI forms and components
│   ├── form*.ui/h/cpp       # Various data entry forms (budget, product, etc.)
│   └── SARibbon/            # Ribbon library components
├── widget/                  # Custom widgets and delegates
├── utils/                   # Utility classes and helpers
├── data/                    # Data access layer (sqltable.h)
├── templates/               # Document export templates (JSON)
├── src/
│   ├── dao/                 # Data Access Objects
│   │   ├── templatedao.h/cpp    # Template CRUD operations
│   │   └── templateengine.h/cpp # Export engine (PDF/XLSX/DOCX)
│   └── gui/
│       └── forms/
│           ├── formtemplateeditor.h/cpp # Visual template editor
│           └── formtemplatelist.h/cpp   # Template list manager
└── resources/               # Qt resource file (icons, stylesheets, etc.)
```

## Getting Started

### Prerequisites

- Qt 6 development framework
- C++ compiler with C++11 support
- Make/build tools

### Building

```bash
# Using qmake
qmake BudgetPro.pro
make

# Or using Qt Creator
# Open BudgetPro.pro in Qt Creator and build
```

### Running

```bash
./BudgetPro  # Linux/macOS
BudgetPro.exe  # Windows
```

## Data Management

The application uses a SQL database for persistent storage. Database initialization and schema management are handled through the `sqltable.h` interface.

## Custom Components

BudgetPro includes several custom Qt components:
- `QMTreeView`: Enhanced tree view for hierarchical data
- Custom delegates for:
  - Combobox editing in tables
  - Rich text rendering/editing
  - Numeric input with formatting
  - Item numbering in hierarchical views
  - Popup tables for complex selection
- `TreeModel`: Custom model for tree-structured data
- `TemplateEngine`: Document export engine supporting PDF, XLSX, DOCX
- `TemplateDAO`: Data access for document templates
- `formTemplateEditor`: Visual template designer
- `formTemplateList`: Template list management
- `AvatarWidget`: For displaying user/entity avatars

## Extending the Application

To add new features:
1. Create new form classes inheriting from `formBase`
2. Design UI forms using Qt Designer (.ui files)
3. Implement data access methods using the existing DAO patterns
4. Add ribbon buttons/actions in MainWindow to access new features
5. Register new forms in the main window's workspace management

## License

This project is based on Qt examples and may be subject to Qt's licensing terms. Please check individual file headers for specific copyright and licensing information.