Files
roa2web-service-auto/data-entry-app/CLAUDE.md
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

142 lines
3.8 KiB
Markdown

# CLAUDE.md - Data Entry App
## Scop
Aplicatie pentru introducere date in ERP (bonuri fiscale, chitante) cu workflow de aprobare.
## Documentatie de Referinta
- **Cerinte**: `docs/data-entry/REQUIREMENTS.md`
- **Arhitectura**: `docs/data-entry/ARCHITECTURE.md`
- **Quick Start**: `README.md`
## Decizii Tehnice
- **ORM**: SQLModel (Pydantic + SQLAlchemy)
- **Migrari**: Alembic
- **Database**: SQLite (Faza 1) → Oracle (Faza 2)
- **Frontend**: Vue.js 3 + PrimeVue (consistent cu reports-app)
## Workflow Bonuri
```
1. DRAFT → utilizator completeaza + upload poza
2. PENDING_REVIEW → sistem genereaza note contabile
3. APPROVED/REJECTED → contabil aproba sau respinge
4. SYNCED → (Faza 2) date in Oracle
```
## Structura Directoare
```
data-entry-app/
├── backend/ # FastAPI API (port 8003)
│ ├── app/
│ │ ├── db/ # SQLModel models + CRUD
│ │ ├── schemas/ # Pydantic schemas
│ │ ├── services/ # Business logic
│ │ └── routers/ # API endpoints
│ ├── migrations/ # Alembic migrations
│ └── data/ # SQLite DB + uploads
├── frontend/ # Vue.js UI (port 3010)
│ └── src/
│ ├── views/ # Page components
│ ├── components/ # Reusable components
│ └── stores/ # Pinia stores
└── docs/ # Documentatie specifica
```
## Componente Partajate
- `shared/database/oracle_pool.py` - Conexiune Oracle pentru nomenclatoare
- `shared/auth/` - JWT authentication
## Comenzi Dezvoltare
```bash
# Backend
cd data-entry-app/backend
pip install -r requirements.txt
alembic upgrade head
uvicorn app.main:app --reload --port 8003
# Frontend
cd data-entry-app/frontend
npm install
npm run dev -- --port 3010
# Migrari
cd data-entry-app/backend
alembic revision --autogenerate -m "description"
alembic upgrade head
```
## Tipuri Cheltuieli (hardcoded in Faza 1)
| Cod | Tip | Cont | TVA |
|-----|-----|------|-----|
| FUEL | Combustibil | 6022 | 19% |
| MATERIALS | Materiale | 6028 | 19% |
| OFFICE | Rechizite | 6024 | 19% |
| PHONE | Telefonie | 626 | 19% |
| PARKING | Parcare | 6022 | 19% |
| FOOD | Alimentatie | 6028 | 0% |
| TRANSPORT | Transport | 624 | 19% |
| OTHER | Altele | 628 | 19% |
## Integrare Oracle (Faza 2)
Vezi `docs/PACK_CONTAFIN.pck` pentru procedurile stocate:
- `pack_contafin.init_scriere_act_rul_local()`
- `INSERT INTO ACT_TEMP (...)`
- `pack_contafin.finalizeaza_scriere_act_rul()`
## API Endpoints Summary
### Receipts CRUD
- `POST /api/receipts/` - Create
- `GET /api/receipts/` - List (filterable)
- `GET /api/receipts/{id}` - Detail
- `PUT /api/receipts/{id}` - Update (DRAFT only)
- `DELETE /api/receipts/{id}` - Delete (DRAFT only)
### Workflow
- `POST /api/receipts/{id}/submit` - Send for review
- `POST /api/receipts/{id}/approve` - Approve
- `POST /api/receipts/{id}/reject` - Reject
- `POST /api/receipts/{id}/resubmit` - Resubmit after rejection
### Attachments
- `POST /api/receipts/{id}/attachments` - Upload
- `GET /api/attachments/{id}/download` - Download
- `DELETE /api/attachments/{id}` - Delete
### Nomenclatures
- `GET /api/receipts/partners` - Partners from Oracle
- `GET /api/receipts/accounts` - Accounts from Oracle
- `GET /api/receipts/cash-registers` - Cash registers from Oracle
- `GET /api/receipts/expense-types` - Expense types (hardcoded)
## Testing
```bash
# Backend tests
cd backend && pytest
# Frontend tests
cd frontend && npm run test
```
## Common Issues
### SQLite locked
- Asigura-te ca nu ai multiple procese care acceseaza DB-ul
### Upload fails
- Verifica permisiuni pe `data/uploads/`
- Verifica MIME type (doar image/*, application/pdf)
### Migration errors
- `alembic downgrade -1` pentru rollback
- Sterge migration file si regenereaza