Files
roa2web-service-auto/data-entry-app
Marius Mutu 21c12ddb0f feat: Add data-entry-app for fiscal receipts with approval workflow
New application for entering fiscal receipts (bonuri fiscale) with:

Backend (FastAPI + SQLModel + Alembic):
- Receipt, ReceiptAttachment, AccountingEntry models
- CRUD operations with async SQLite database
- Workflow: DRAFT → PENDING_REVIEW → APPROVED/REJECTED
- Auto-generation of accounting entries with VAT calculation
- File upload support (images, PDFs)
- Predefined expense types (Fuel, Materials, Office, etc.)
- Nomenclature service for partners, accounts, cash registers

Frontend (Vue.js 3 + PrimeVue + Pinia):
- ReceiptsListView with filters and stats
- ReceiptCreateView with image upload
- ReceiptDetailView with accounting entries
- ReceiptApprovalView for accountant approval

Documentation:
- REQUIREMENTS.md with functional specifications
- ARCHITECTURE.md with technical decisions
- CLAUDE.md for AI assistant guidance

Phase 1 MVP uses SQLite, prepared for Oracle integration in Phase 2.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 17:30:51 +02:00
..

Data Entry App - Bonuri Fiscale

Aplicatie pentru introducere bonuri fiscale cu workflow de aprobare.

Quick Start

Prerequisites

  • Python 3.10+
  • Node.js 18+
  • (Optional) SSH tunnel pentru Oracle nomenclatoare

Backend Setup

cd data-entry-app/backend

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Linux/Mac
# sau: venv\Scripts\activate  # Windows

# Install dependencies
pip install -r requirements.txt

# Create .env file
cp .env.example .env
# Edit .env with your settings

# Run migrations
alembic upgrade head

# Start server
uvicorn app.main:app --reload --port 8003

Frontend Setup

cd data-entry-app/frontend

# Install dependencies
npm install

# Start dev server
npm run dev -- --port 3010

Access

Features

Pentru Utilizatori

  • Upload poze bonuri fiscale
  • Completare date bon (suma, data, furnizor)
  • Selectie tip cheltuiala
  • Trimitere spre aprobare

Pentru Contabili

  • Vizualizare bonuri in asteptare
  • Editare note contabile propuse
  • Aprobare/Respingere bonuri
  • Aprobare in masa

Workflow

DRAFT → PENDING_REVIEW → APPROVED/REJECTED → (SYNCED in Oracle)
  1. DRAFT: Utilizator completeaza datele
  2. PENDING_REVIEW: Sistemul genereaza note contabile automat
  3. APPROVED: Contabil a aprobat bonul
  4. REJECTED: Contabil a respins (utilizatorul poate corecta)

Project Structure

data-entry-app/
├── backend/
│   ├── app/
│   │   ├── main.py              # FastAPI entry point
│   │   ├── config.py            # Settings
│   │   ├── db/
│   │   │   ├── database.py      # SQLite engine
│   │   │   ├── models/          # SQLModel models
│   │   │   └── crud/            # CRUD operations
│   │   ├── schemas/             # Pydantic schemas
│   │   ├── services/            # Business logic
│   │   └── routers/             # API endpoints
│   ├── migrations/              # Alembic migrations
│   ├── data/
│   │   ├── receipts.db          # SQLite database
│   │   └── uploads/             # Uploaded files
│   └── requirements.txt
│
├── frontend/
│   ├── src/
│   │   ├── views/receipts/      # Page components
│   │   ├── components/receipts/ # Reusable components
│   │   ├── stores/              # Pinia stores
│   │   └── router/              # Vue Router
│   ├── package.json
│   └── vite.config.js
│
└── docs/                        # Documentation

Environment Variables

Backend (.env)

# SQLite
SQLITE_DATABASE_PATH=data/receipts.db

# File uploads
UPLOAD_PATH=data/uploads
MAX_UPLOAD_SIZE_MB=10

# Oracle (for nomenclatures)
ORACLE_USER=CONTAFIN_ORACLE
ORACLE_PASSWORD=your_password
ORACLE_HOST=localhost
ORACLE_PORT=1526
ORACLE_SID=ROA

# JWT (shared with reports-app)
JWT_SECRET_KEY=your_secret_key
JWT_ALGORITHM=HS256

Development

Create new migration

cd backend
alembic revision --autogenerate -m "Add new field"
alembic upgrade head

Run tests

# Backend
cd backend && pytest

# Frontend
cd frontend && npm run test

API Documentation

Full API documentation available at http://localhost:8003/docs when backend is running.

Key Endpoints

Method Endpoint Description
POST /api/receipts/ Create receipt
GET /api/receipts/ List receipts
GET /api/receipts/{id} Get receipt details
POST /api/receipts/{id}/submit Submit for review
POST /api/receipts/{id}/approve Approve receipt
POST /api/receipts/{id}/reject Reject receipt
POST /api/receipts/{id}/attachments Upload attachment

Phase 2 (Future)

  • Oracle sync for approved receipts
  • Integration with pack_contafin procedures
  • Automatic posting to ACT/RUL tables